Second scenario seems to use final DOM from first scenario
- Dominant language
- JavaScript
- Stars
- 7.2k
- Forks
- 621
- PR merge metrics
- No merged PRs in 30d
Description
Is there a way to have chromy or backstop "reset" after each scenario?
I have a SPA hosted at a URL, say 111.11.11.11:8080
This is the homepage that has a login input box, password input box, and enter button.
My first scenario is to test the case where a login is successful.
My second scenario is to test the case where a login is unsuccessful (bad password).
For both scenarios, I have my URL set to the same 111.11.11.11:8080.
My casperjs scripts are almost identical, except the second one has a bad password input.
When I run these tests, backstop throws an error at the second scenario, complaining that it cannot find the login input box. When I set debug=true, I can see that the DOM the second scenario starts with is the same DOM that the first scenario ends with. In other words, even though both scenarios are set to the same URL, the second scenario starts with the SPA already logged in from the first scenario (so then it makes sense there's no login input box - we're already logged in somehow).
I'm wondering how to get around this.
When manually running this, I open a tab and navigate to 111.11.11.11:8080.
This forwards me to 111.11.11.11:8080/#/, which is the homepage of my webapp with the username and password and enter elements.
When I punch in the correct info, it will then log me in but remain on the 111.11.11.11:8080/#/ url since this is a SPA.
I then open a new tab (not unlike backstop running my second scenario, correct?), navigate to 111.11.11.11:8080, which forwards me to 111.11.11.11:8080/#/. I now see the login screen. But chromy/backstop at this point would see the screen already logged in.
I'm thinking this is perhaps why chromy/backstop will reuse the DOM from the first scenario in the second one? From a URL standpoint, there is no difference between my SPA at the homepage (not logged in) and at the welcome screen (logged in) - both are the same URL.
Contributor guide
Assessment
This issue has not been assessed yet.