enhance(e2e): more resilient version of visit('/')
(#10128)
This commit is contained in:
parent
6d82371449
commit
44058f8b85
|
@ -10,11 +10,11 @@ describe('Before setup instance', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it('successfully loads', () => {
|
||||||
cy.visit('/');
|
cy.visitHome();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setup instance', () => {
|
it('setup instance', () => {
|
||||||
cy.visit('/');
|
cy.visitHome();
|
||||||
|
|
||||||
cy.intercept('POST', '/api/admin/accounts/create').as('signup');
|
cy.intercept('POST', '/api/admin/accounts/create').as('signup');
|
||||||
|
|
||||||
|
@ -43,11 +43,11 @@ describe('After setup instance', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it('successfully loads', () => {
|
||||||
cy.visit('/');
|
cy.visitHome();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('signup', () => {
|
it('signup', () => {
|
||||||
cy.visit('/');
|
cy.visitHome();
|
||||||
|
|
||||||
cy.intercept('POST', '/api/signup').as('signup');
|
cy.intercept('POST', '/api/signup').as('signup');
|
||||||
|
|
||||||
|
@ -79,11 +79,11 @@ describe('After user signup', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it('successfully loads', () => {
|
||||||
cy.visit('/');
|
cy.visitHome();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('signin', () => {
|
it('signin', () => {
|
||||||
cy.visit('/');
|
cy.visitHome();
|
||||||
|
|
||||||
cy.intercept('POST', '/api/signin').as('signin');
|
cy.intercept('POST', '/api/signin').as('signin');
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ describe('After user signup', () => {
|
||||||
userId: this.alice.id,
|
userId: this.alice.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.visit('/');
|
cy.visitHome();
|
||||||
|
|
||||||
cy.get('[data-cy-signin]').click();
|
cy.get('[data-cy-signin]').click();
|
||||||
cy.get('[data-cy-signin-username] input').type('alice');
|
cy.get('[data-cy-signin-username] input').type('alice');
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
// -- This will overwrite an existing command --
|
// -- This will overwrite an existing command --
|
||||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||||
|
|
||||||
|
Cypress.Commands.add('visitHome', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.get('button', { timeout: 30000 }).should('be.visible');
|
||||||
|
})
|
||||||
|
|
||||||
Cypress.Commands.add('resetState', () => {
|
Cypress.Commands.add('resetState', () => {
|
||||||
cy.window(win => {
|
cy.window(win => {
|
||||||
win.indexedDB.deleteDatabase('keyval-store');
|
win.indexedDB.deleteDatabase('keyval-store');
|
||||||
|
@ -43,7 +48,7 @@ Cypress.Commands.add('registerUser', (username, password, isAdmin = false) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('login', (username, password) => {
|
Cypress.Commands.add('login', (username, password) => {
|
||||||
cy.visit('/');
|
cy.visitHome();
|
||||||
|
|
||||||
cy.intercept('POST', '/api/signin').as('signin');
|
cy.intercept('POST', '/api/signin').as('signin');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue