Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MON-2161 [FIX CYPRESS] #262

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ 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: "[email protected]",
auth0_password: "&fNo#fnEb7ZFm2kd",
user_full_name: "Mr. Bot",
organization_name: "test org",
second_username: "[email protected]",
second_password: "KukiF0rever!"
}
second_password: "KukiF0rever!",
},
});
40 changes: 2 additions & 38 deletions e2e/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,17 @@
/* eslint-disable comma-dangle */
/// <reference types="cypress" />
// ***********************************************
// 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<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

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("/");
Expand Down
25 changes: 3 additions & 22 deletions e2e/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -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()
})
cy.resetState();
});
1 change: 1 addition & 0 deletions e2e/cypress/support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ declare namespace Cypress {
createModelAndVersion(arg1, arg2, arg3): Promise;
addNullsCheck(arg): void;
addCheck(arg1, arg2?): Promise;
resetState(arg?): void;
}
}
Loading