Skip to content

Commit

Permalink
use clases instead of wait
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed May 17, 2022
1 parent 7aeb595 commit 2fddd35
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
Cypress.Commands.add('modalIsVisibleAndFocused', () => {
cy.wait(1000);
cy.get('.DocSearch-Modal').should('be.visible');
cy.get('.DocSearch-Input').should('be.focus');
});

Cypress.Commands.add('modalIsNotVisible', () => {
cy.wait(1000);
cy.get('body').should('not.have.class', 'DocSearch--active');
cy.get('.DocSearch-Modal').should('not.exist');
});

Cypress.Commands.add('darkmode', () => {
cy.get('.react-toggle').click({ force: true });
cy.get('.react-toggle-screenreader-only').blur();
cy.wait(1000);
cy.get('html.dark').should('be.visible');
});

Cypress.Commands.add('openModal', () => {
cy.get('.DocSearch-Button').click();
cy.wait(1000);
cy.modalIsVisibleAndFocused();
});

Cypress.Commands.add('closeModal', () => {
cy.get('body').type('{esc}');
cy.wait(1000);
cy.modalIsNotVisible();
});

Cypress.Commands.add('search', (query: string) => {
cy.wait(1000);
cy.get('.DocSearch-Input').type(query);
});

Expand Down

0 comments on commit 2fddd35

Please sign in to comment.