|
| 1 | +/* Cypress Tests for the Algolia and Redoc Search Bars */ |
| 2 | + |
| 3 | +describe('Algolia Search', () => { |
| 4 | + before(() => { |
| 5 | + cy.visit('/'); |
| 6 | + }) |
| 7 | + |
| 8 | + it('search box is clickable and brings up modal', () => { |
| 9 | + cy.get('.DocSearch').click(); |
| 10 | + cy.get('.DocSearch-Modal').should('exist'); |
| 11 | + cy.get('.DocSearch-Form').should('exist'); |
| 12 | + cy.get('.DocSearch-Dropdown').should('exist'); |
| 13 | + cy.get('.DocSearch-Footer').should('exist'); |
| 14 | + }) |
| 15 | + |
| 16 | + it('type in searchbar', () => { |
| 17 | + cy.get('#docsearch-input').type('messaging'); |
| 18 | + cy.get('.DocSearch-Dropdown-Container').children().should('have.length.greaterThan', 1); |
| 19 | + cy.get('.DocSearch-Hit-source').first().should('have.text', 'Messaging'); |
| 20 | + cy.get('.DocSearch-HitsFooter > a').invoke('text').should('match', /See all \d+ results/); |
| 21 | + cy.get('.DocSearch-Reset').click(); |
| 22 | + cy.get('#docsearch-input').should('have.text', ''); |
| 23 | + cy.get('#docsearch-input').should('have.attr', 'placeholder', 'Search docs'); |
| 24 | + }) |
| 25 | + |
| 26 | + it('close Algolia search modal', () => { |
| 27 | + cy.get(':nth-child(1) > .DocSearch').click(); |
| 28 | + cy.get('.DocSearch-Modal').should('not.exist'); |
| 29 | + }) |
| 30 | +}) |
| 31 | + |
| 32 | +describe('Redoc Search', () => { |
| 33 | + before(() => { |
| 34 | + cy.visit('/apis/messaging'); |
| 35 | + }) |
| 36 | + |
| 37 | + afterEach(() => { |
| 38 | + cy.get('[data-role="search:results"]').should('exist'); |
| 39 | + cy.get('[data-role="search:results"]').children().should('have.length.greaterThan', 0); |
| 40 | + cy.get('.menu-content [role="search"] i').click(); |
| 41 | + }) |
| 42 | + |
| 43 | + it('search by operation', () => { |
| 44 | + cy.get('.menu-content [role="search"]').type('List'); |
| 45 | + }) |
| 46 | + |
| 47 | + it('search by tag', () => { |
| 48 | + cy.get('.menu-content [role="search"]').type('Media'); |
| 49 | + }) |
| 50 | + |
| 51 | + it('search by endpoint', () => { |
| 52 | + cy.get('.menu-content [role="search"]').type('/messages'); |
| 53 | + }) |
| 54 | +}) |
0 commit comments