diff --git a/cypress/e2e/adminGuesser.cy.ts b/cypress/e2e/adminGuesser.cy.ts new file mode 100644 index 0000000..99aca0e --- /dev/null +++ b/cypress/e2e/adminGuesser.cy.ts @@ -0,0 +1,19 @@ +import { login } from './login'; + +const getPaginationText = () => + cy.findByText(/\d+-\d+ of \d+/, { timeout: 10000 }); + +describe('AdminGuesser', () => { + it('should render one menu item per resource', () => { + cy.visit('/'); + login(); + cy.findByText('Companies').should('exist'); + cy.findByText('Contacts').should('exist'); + cy.findByText('Deals').should('exist'); + cy.findByText('Tags').should('exist'); + cy.findByText('Tasks').should('exist'); + cy.findByText('Dealnotes').should('exist'); + cy.findByText('Contactnotes').should('exist'); + cy.findByText('Sales').should('exist'); + }); +}); diff --git a/cypress/e2e/dashboard.cy.ts b/cypress/e2e/dashboard.cy.ts deleted file mode 100644 index c3a0c92..0000000 --- a/cypress/e2e/dashboard.cy.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { login } from './login'; - -describe('Dashboard spec', () => { - it('passes', () => { - cy.visit('/'); - login(); - cy.findByText('Upcoming Deal Revenue').should('exist'); - cy.findByText('My Latest Notes').should('exist'); - cy.findByText('Upcoming tasks').should('exist'); - cy.findByText('Hot contacts').should('exist'); - cy.findByTestId('my-latest-notes') - .find('p') - .should('have.length.gt', 0); - cy.findByTestId('tasks-list').find('li').should('have.length.gt', 0); - cy.findByTestId('hot-contacts').find('li').should('have.length.gt', 0); - }); -}); diff --git a/cypress/e2e/lists.cy.ts b/cypress/e2e/lists.cy.ts index f7b350c..c5ad953 100644 --- a/cypress/e2e/lists.cy.ts +++ b/cypress/e2e/lists.cy.ts @@ -11,57 +11,6 @@ describe('Lists', () => { getPaginationText(); }); - it('should allow to filter by date', () => { - cy.visit('/'); - login(); - cy.findByText('Contacts').click(); - getPaginationText().then(el => { - const count = parseInt(el.text().split('of')[1].trim()); - - cy.findByText('Earlier').click(); - // Use should here to allow built-in retry as it may take a few ms for the list to update - getPaginationText().should(el => { - const countFiltered = parseInt(el.text().split('of')[1].trim()); - expect(countFiltered).to.be.lessThan(count); - }); - }); - }); - - it('should allow to filter by status', () => { - cy.visit('/'); - login(); - cy.findByText('Contacts').click(); - getPaginationText().then(el => { - const count = parseInt(el.text().split('of')[1].trim()); - - cy.findByText('Cold').click(); - // Use should here to allow built-in retry as it may take a few ms for the list to update - getPaginationText().should(el => { - const countFiltered = parseInt(el.text().split('of')[1].trim()); - expect(countFiltered).to.be.lessThan(count); - }); - }); - }); - - it('should allow to filter by tag', () => { - cy.visit('/'); - login(); - cy.findByText('Contacts').click(); - getPaginationText().then(el => { - const count = parseInt(el.text().split('of')[1].trim()); - - cy.findByText('football-fan', { - selector: '[role=button] *', - }).click(); - - // Use should here to allow built-in retry as it may take a few ms for the list to update - getPaginationText().should(el => { - const countFiltered = parseInt(el.text().split('of')[1].trim()); - expect(countFiltered).to.be.lessThan(count); - }); - }); - }); - it('should allow to move through pages', () => { cy.visit('/'); login(); @@ -92,23 +41,11 @@ describe('Lists', () => { cy.visit('/'); login(); cy.findByText('Contacts').click(); - cy.findAllByText(/\d+ days? ago/, { timeout: 10000 }).should( - 'have.length.greaterThan', - 0 - ); - cy.findAllByText(/\d+ years? ago/, { timeout: 10000 }).should( - 'have.length', - 0 - ); - cy.findByText('Sort by Last seen descending').click(); - cy.findByText('Last seen ascending').click(); - cy.findAllByText(/\d+ days? ago/, { timeout: 10000 }).should( + cy.findByLabelText('Sort by Gender descending').click(); + cy.findAllByText('female', { timeout: 10000 }).should( 'have.length', - 0 - ); - cy.findAllByText(/\d+ years? ago/, { timeout: 10000 }).should( - 'have.length.greaterThan', - 0 + 10 ); + cy.findByText('male').should('not.exist'); }); }); diff --git a/packages/demo/index.html b/packages/demo/index.html index ac5e949..22b7231 100644 --- a/packages/demo/index.html +++ b/packages/demo/index.html @@ -9,7 +9,7 @@ -