We can use the new generated client to stay up to date and upgrade packages that depends on docsearch. --------- Co-authored-by: shortcuts <vannicattec@gmail.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
Cypress.Commands.add('modalIsVisibleAndFocused', () => {
|
|
cy.get('.DocSearch-Modal', { timeout: 10000 }).should('be.visible');
|
|
cy.get('.DocSearch-Input').should('be.focus');
|
|
});
|
|
|
|
Cypress.Commands.add('modalIsNotVisible', () => {
|
|
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.get('html.dark').should('be.visible');
|
|
});
|
|
|
|
Cypress.Commands.add('waitLoad', () => {
|
|
cy.get('.DocSearch-Button', { timeout: 10000 }).should('be.visible');
|
|
});
|
|
|
|
Cypress.Commands.add('openModal', () => {
|
|
cy.get('.DocSearch-Button').should('be.visible').click();
|
|
cy.modalIsVisibleAndFocused();
|
|
});
|
|
|
|
Cypress.Commands.add('closeModal', () => {
|
|
cy.get('body').type('{esc}');
|
|
cy.modalIsNotVisible();
|
|
});
|
|
|
|
Cypress.Commands.add('search', (query: string) => {
|
|
cy.get('.DocSearch-Input').should('be.visible').type(query);
|
|
});
|
|
|
|
Cypress.Commands.add('typeQueryMatching', () => {
|
|
cy.search('g');
|
|
});
|
|
|
|
Cypress.Commands.add('typeQueryNotMatching', () => {
|
|
cy.search('zzz');
|
|
});
|