https://cypress.io logo
I would like to reuse several tests for the header...
# e2e-testing
c
I would like to reuse several tests for the header, footer, side menu etc. of my websites for different URL-routes of my website. I want to minimize code duplication. I tried to create functions with the
commands.ts
file but the problem is: 1. My storage
cy.restoreLocalStorage
logic does not work (I have an microsoft authentification, which needs to be saved in the local storage) 2. The tests inside the function are being recognized as independent tests. There is only one single file. I can't find a way to reuse the cypress tests using different
visit
paths as parameter. Is there a best practice, which someone can point me to?