https://cypress.io logo
Is there a good way to reuse flows? Let's say I ha...
# e2e-testing
s
Is there a good way to reuse flows? Let's say I have a flow test that looks like this
Copy code
TypeScript
it('tests some flow', () => {
  cy.login('some_user_name');
  cy.some_cool_custom_command();
})
Now, instead of testing it with just 'some_user_name', I have a list of perhaps 40 different roles that needs to use that custom command in the flow. For the sake the argument, whatever is done in beforeAll and afterAll must be run for each for the tests. Is there a good way to reuse the test instead of having to write the same flow 40 times?
b
If you have to cycle through the same exact steps for each test case for a different set of creds each time. I'd recommend using https://github.com/bahmutov/cypress-each for simplicity.
2 Views