I am a newby on testcafe so it might be ignorance on my part.
When loading a Polymer SPA I am using fixture.page('http...) to initialize the app.
Unfortunately the page is reloaded (and therefor the SPA is reinitialized) between each test.
This is of course not what you want in a SPA but I can't find how to prevent this behavior.
Hi,
聽
Each test is an independent unit that opens a page, does some actions and assertions and closes the page. Each test can change the page state. At the same time, each test should start from a determined state to be independent from others (otherwise, you can't run each test separately). That's why each page starts with a new page.
If you have some common actions that should be executed in each test, you can use fixture hooks or User Roles if you need to be logged in for each test.
Hi @AlexanderMoskovkin,
I can certainly understand that you want a clean test environment the have a clear picture of what get's tested, but if you are working with an single page application (SPA) you definitely don't want to reset the application between tests. You want to be able to jump from one page (or situation) to another and stay in the application. I use the fixture hook to logon but I am afraid this does not solve the problem.
As alternative doing everything in one big test would mean building very large test functions that test a lot of situations. Moreover you cannot see the test steps and if something is wrong the whole testing is stopped.
I am new with e2e browser testing and I don't know if Selenium works the same way (because I much prefer the power and simplicity of TestCafe), but I don't see how to setup a good working test script this way.
I understand you point, it makes sense. We should consider an ability to add some option that switch on a mode where the page state is not completely reset between tests (like just calling navigateTo action)
Yes, exactly.
I am not sure what is happening between tests (next to page reloads), but in this situation nothing should change.
For instance an option on fixture level (something like noReloadBetweenTests).
On Test level it is probably not necessary to create an override for this behavior because you can start with test.page('http...') to do a reload.
closed in favor of the #1770
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow.
Most helpful comment
I understand you point, it makes sense. We should consider an ability to add some option that switch on a mode where the page state is not completely reset between tests (like just calling
navigateToaction)