diff --git a/e2e/cypress.config.ts b/e2e/cypress.config.ts index 3a99342ab..25bc098ad 100644 --- a/e2e/cypress.config.ts +++ b/e2e/cypress.config.ts @@ -12,7 +12,7 @@ export default defineConfig({ // baseUrl: "https://staging-v2.deepchecks.com", defaultCommandTimeout: 20000, responseTimeout: 45000, - baseUrl: "http://127.0.0.1:8000" + baseUrl: "http://127.0.0.1:8000", }, env: { auth0_username: "e2e-testing@deepchecks.com", @@ -20,6 +20,6 @@ export default defineConfig({ user_full_name: "Mr. Bot", organization_name: "test org", second_username: "gabbay-bot@deepchecks.com", - second_password: "KukiF0rever!" - } + second_password: "KukiF0rever!", + }, }); diff --git a/e2e/cypress/support/commands.ts b/e2e/cypress/support/commands.ts index 99f77b8f6..2be6ef616 100644 --- a/e2e/cypress/support/commands.ts +++ b/e2e/cypress/support/commands.ts @@ -1,53 +1,17 @@ -/* eslint-disable comma-dangle */ /// -// *********************************************** -// This example commands.ts shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -// -// declare global { -// namespace Cypress { -// interface Chainable { -// login(email: string, password: string): Chainable -// drag(subject: string, options?: Partial): Chainable -// dismiss(subject: string, options?: Partial): Chainable -// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable -// } -// } -// } Cypress.Commands.add("login", (username: string, password: string) => { cy.url().should("contain", ".auth0.com"); cy.get("#username").type(username); cy.get("#password").type(password); - cy.get('button[name="action"]').click(); + cy.get('button[name="action"]').last().click(); cy.url().should("not.contain", ".auth0.com"); }); Cypress.Commands.add("resetState", () => { const username = Cypress.env("auth0_username"); const password = Cypress.env("auth0_password"); + cy.session(username, () => { cy.clearCookies(); cy.visit("/"); diff --git a/e2e/cypress/support/e2e.ts b/e2e/cypress/support/e2e.ts index 460cc741e..eb62fdaa3 100644 --- a/e2e/cypress/support/e2e.ts +++ b/e2e/cypress/support/e2e.ts @@ -1,24 +1,5 @@ -// *********************************************************** -// This example support/e2e.ts is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') +import "./commands"; beforeEach(() => { - cy.resetState() -}) \ No newline at end of file + cy.resetState(); +}); diff --git a/e2e/cypress/support/index.d.ts b/e2e/cypress/support/index.d.ts index 0475da4e5..4dec32459 100644 --- a/e2e/cypress/support/index.d.ts +++ b/e2e/cypress/support/index.d.ts @@ -10,5 +10,6 @@ declare namespace Cypress { createModelAndVersion(arg1, arg2, arg3): Promise; addNullsCheck(arg): void; addCheck(arg1, arg2?): Promise; + resetState(arg?): void; } }