Hey, I need help regarding automating the followin...
# help
b
Hey, I need help regarding automating the following scenario: log in to account change your password login again with the new password How would u do this? in regards to remembering the password for the next test run? So I can repeatedly change the pass and login with it. I am a little bit confused here. How do I transfer this password info between the test runs?
f
the issue is that your tests want to be deterministic -- given some initial known state, perform some actions, and make assertions against the new state. that means when you start your test suite the state of the system needs to be the same. otherwise your tests become flakey because you're making assertions against an initial state that could be wrong. for example let's say you run your test suite and it discovers a bug where the password change sets the new password to an unexpected value. the next time your test runs it may fail, because you're assuming that the previous run didn't cause any problems. if you want true e2e for every scenario, it requires seeding your database before each test to set the initial state. if you don't have that capability, what i'd suggest would be to stub your change password request to return whatever "success" means, and make your assertions on the page (for example does the success message show up) you can check out this guide on testing strategies for network requests to get a feel for the benefits and downsides of stubbed vs true e2e tests., and how to do each https://docs.cypress.io/guides/guides/network-requests#Testing-Strategies
3 Views