TestCafe重新加载页面并重新执行夹具挂钩

时间:2019-08-19 10:07:27

标签: testing automation e2e-testing page-refresh testcafe

重新加载的常见常识是使用await t.eval(() => location.reload(true));

但是,使用这种方法,如果使用夹具钩安装了任何东西(例如testcafe-testing-library),则一旦重新加载页面后,该页面将不再可用。

有什么办法可以重新执行夹具挂钩?

提出了相关的GitHub问题https://github.com/testing-library/testcafe-testing-library/issues/28

1 个答案:

答案 0 :(得分:2)

请使用the new TestCafe feature将客户端脚本注入测试页,即使重新加载后,您的脚本仍然可用。