Search code examples
testingautomatione2e-testingpage-refreshtestcafe

TestCafe reload page and re-execute fixture hook


The common wisdom for reloading is using await t.eval(() => location.reload(true));.

However, with this approach, once the page is reloaded if you have installed anything using the fixture hooks, such as testcafe-testing-library, it will no longer be available.

Is there any way to re-execute the fixture hook?

Relevant GitHub issue raised https://github.com/testing-library/testcafe-testing-library/issues/28


Solution

  • Please use the new TestCafe feature to inject client scripts into testing pages and your scripts will be available even after reloading.