I'm trying to set up a custom command to add some session storage items in a project and it doesn't seem to be firing.
The command is as follows
Cypress.Commands.add("login", () => {
window.sessionStorage.setItem("token", "tokengoeshere");
window.sessionStorage.setItem("username", "phoenix");
cy.visit("http://localhost:8080");
});
I have added the file into cypress.json
"supportFile": "tests/e2e/support/index.js",
and the index.js looks like
// Import commands.js using ES2015 syntax:
import "./commands";
When the tests fire session storage is empty