diff --git a/cypress/e2e/homePage.cy.ts b/cypress/e2e/homePage.cy.ts index 5849825b45..8473dca7d0 100644 --- a/cypress/e2e/homePage.cy.ts +++ b/cypress/e2e/homePage.cy.ts @@ -1,38 +1,26 @@ -/// +// / -import { CONTRIBUTORS_COUNT, TWEET_COUNT } from '../support/constant'; +import { CONTRIBUTORS_COUNT, TESTIMONIALS_COUNT } from '../support/constant'; describe('Test home page', () => { beforeEach(() => { + cy.intercept('POST', '**/v1/graphql').as('contribs'); cy.visit('/'); + cy.wait('@contribs'); }); it('Header component should render properly', () => { - cy.get('[data-testid="app-header"]').should('be.visible'); - cy.get('[data-testid="app-logo"]').should('be.visible'); - cy.get('[data-testid="plays-search-box-container"]').should('not.exist'); - cy.get('[data-testid="header-links-container"]').should('be.visible'); - cy.get('[data-testid="browse-btn"]').should('be.visible').as('browseBtn'); - cy.get('[data-testid="create-btn"]').should('be.visible'); - cy.get('[data-testid="ideas-btn"]').should('be.visible'); - cy.get('[data-testid="github-btn"]').should('be.visible'); - cy.get('[data-testid="twitter-btn"]').should('be.visible'); - cy.get('[data-testid="share-btn"]').should('be.visible'); - cy.get('[data-testid="leaderboard-btn"]').should('be.visible'); + cy.header(); + }); - cy.get('@browseBtn').click(); - cy.get('[data-testid="plays-search-box-container"]').should('be.visible'); + it('Testitomonials section should render and navigation must be clickable', () => { + cy.get('[data-testid="testimonials-section"]').scrollIntoView().should('be.visible'); + cy.get('[data-testid="testimonials-swiper"]').scrollIntoView().should('be.visible'); }); - it('Tweet section should render with all tweets', () => { - cy.intercept('GET', 'https://cdn.syndication.twimg.com/*').as('tweets'); - cy.wait('@tweets'); - cy.get('[data-testid="tweet-container"]').scrollIntoView().should('be.visible'); - cy.get('[data-testid="tweet-container"] [id*="twitter-widget"]').should( - 'have.length', - TWEET_COUNT - ); - cy.get('[data-testid="watch-svg"]').should('not.exist'); + it('Testitomonials should have a number of slides', () => { + cy.get('[data-testid="testimonials-swiper"]').scrollIntoView().should('be.visible'); + cy.get('.swiper-slide').should('have.length', TESTIMONIALS_COUNT); }); it('Contributors section should render with all contributors', () => { diff --git a/cypress/e2e/ideasPage.cy.ts b/cypress/e2e/ideasPage.cy.ts new file mode 100644 index 0000000000..980d92c8b7 --- /dev/null +++ b/cypress/e2e/ideasPage.cy.ts @@ -0,0 +1,11 @@ +// / + +describe('Test play ideas page', () => { + beforeEach(() => { + cy.visit('/ideas'); + }); + + it('Header component should render properly', () => { + cy.header(); + }); +}); diff --git a/cypress/e2e/leaderboardPage.cy.ts b/cypress/e2e/leaderboardPage.cy.ts new file mode 100644 index 0000000000..84ef08ef9c --- /dev/null +++ b/cypress/e2e/leaderboardPage.cy.ts @@ -0,0 +1,11 @@ +// / + +describe('Test leaderboard page', () => { + beforeEach(() => { + cy.visit('/leaderboard'); + }); + + it('Header component should render properly', () => { + cy.header(); + }); +}); diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 95857aea4c..ca09db9b00 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -1,4 +1,4 @@ -/// +// / // *********************************************** // This example commands.ts shows you how to // create various custom commands and overwrite @@ -35,3 +35,20 @@ // } // } // } + +// methods +Cypress.Commands.add('header', () => { + cy.get('[data-testid="app-header"]').should('be.visible'); + cy.get('[data-testid="app-logo"]').should('be.visible'); + cy.get('[data-testid="plays-search-box-container"]').should('not.exist'); + cy.get('[data-testid="header-links-container"]').should('be.visible'); + cy.get('[data-testid="browse-btn"]').should('be.visible').as('browseBtn'); + cy.get('[data-testid="create-btn"]').should('be.visible'); + cy.get('[data-testid="ideas-btn"]').should('be.visible'); + cy.get('[data-testid="github-btn"]').should('be.visible'); + cy.get('[data-testid="twitter-btn"]').should('be.visible'); + cy.get('[data-testid="share-btn"]').should('be.visible'); + cy.get('[data-testid="leaderboard-btn"]').should('be.visible'); + cy.get('@browseBtn').click(); + cy.get('[data-testid="plays-search-box-container"]').should('be.visible'); +}); diff --git a/cypress/support/constant.ts b/cypress/support/constant.ts index 64dd952c4b..82ad9a889a 100644 --- a/cypress/support/constant.ts +++ b/cypress/support/constant.ts @@ -1,2 +1,2 @@ -export const TWEET_COUNT = 11; +export const TESTIMONIALS_COUNT = 9; export const CONTRIBUTORS_COUNT = 29;