From f93baeacb46d583a2a4880a72285c542bc86fbd4 Mon Sep 17 00:00:00 2001 From: Angra974 Date: Mon, 25 Sep 2023 20:46:03 +0400 Subject: [PATCH 1/2] Update cypress e2e tests --- cypress/e2e/homePage.cy.ts | 36 +++++++------------ cypress/e2e/ideasPage.cy.ts | 11 ++++++ cypress/e2e/leaderboardPage.cy.ts | 11 ++++++ cypress/support/commands.ts | 19 +++++++++- cypress/support/constant.ts | 2 +- src/plays/test-cy-tictactooe3/Readme.md | 27 ++++++++++++++ .../Test-cy-tictactooe3.jsx | 29 +++++++++++++++ src/plays/test-cy-tictactooe3/package.json | 11 ++++++ src/plays/test-cy-tictactooe3/styles.css | 1 + 9 files changed, 121 insertions(+), 26 deletions(-) create mode 100644 cypress/e2e/ideasPage.cy.ts create mode 100644 cypress/e2e/leaderboardPage.cy.ts create mode 100644 src/plays/test-cy-tictactooe3/Readme.md create mode 100644 src/plays/test-cy-tictactooe3/Test-cy-tictactooe3.jsx create mode 100644 src/plays/test-cy-tictactooe3/package.json create mode 100644 src/plays/test-cy-tictactooe3/styles.css 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; diff --git a/src/plays/test-cy-tictactooe3/Readme.md b/src/plays/test-cy-tictactooe3/Readme.md new file mode 100644 index 0000000000..007c485ab0 --- /dev/null +++ b/src/plays/test-cy-tictactooe3/Readme.md @@ -0,0 +1,27 @@ +# test_cy_tictactooe3 + +Just testing creation of cypress test + +## Play Demographic + +- Language: js +- Level: Intermediate + +## Creator Information + +- User: Parlier Thierry +- Gihub Link: https://github.com/Parlier Thierry +- Blog: +- Video: + +## Implementation Details + +Update your implementation idea and details here + +## Consideration + +Update all considerations(if any) + +## Resources + +Update external resources(if any) diff --git a/src/plays/test-cy-tictactooe3/Test-cy-tictactooe3.jsx b/src/plays/test-cy-tictactooe3/Test-cy-tictactooe3.jsx new file mode 100644 index 0000000000..aa48432761 --- /dev/null +++ b/src/plays/test-cy-tictactooe3/Test-cy-tictactooe3.jsx @@ -0,0 +1,29 @@ +import PlayHeader from 'common/playlists/PlayHeader'; +import './styles.css'; + +// WARNING: Do not change the entry componenet name +function Tictactooe3(props) { + // Your Code Start below. + + return ( + <> +
+ +
+ {/* Your Code Starts Here */} +
+

Play Details - Test_cy_tictactooe3

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque euismod, urna eu + tincidunt consectetur, nisi nunc ultricies nisi, eget consectetur nunc nisi euismod + nunc. +

+
+ {/* Your Code Ends Here */} +
+
+ + ); +} + +export default Tictactooe3; diff --git a/src/plays/test-cy-tictactooe3/package.json b/src/plays/test-cy-tictactooe3/package.json new file mode 100644 index 0000000000..5a182523c0 --- /dev/null +++ b/src/plays/test-cy-tictactooe3/package.json @@ -0,0 +1,11 @@ +{ + "name": "Test-cy-tictactooe3", + "version": "1.0.0", + "description": "Just testing creation of cypress test", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "Parlier Thierry", + "license": "MIT" +} diff --git a/src/plays/test-cy-tictactooe3/styles.css b/src/plays/test-cy-tictactooe3/styles.css new file mode 100644 index 0000000000..5fd508fa9e --- /dev/null +++ b/src/plays/test-cy-tictactooe3/styles.css @@ -0,0 +1 @@ +/* enter stlyes here */ From 3eafc113de694483852c141b0f1a20054b6d9037 Mon Sep 17 00:00:00 2001 From: Angra974 Date: Mon, 25 Sep 2023 20:47:02 +0400 Subject: [PATCH 2/2] deleted garbage files --- src/plays/test-cy-tictactooe3/Readme.md | 27 ----------------- .../Test-cy-tictactooe3.jsx | 29 ------------------- src/plays/test-cy-tictactooe3/package.json | 11 ------- src/plays/test-cy-tictactooe3/styles.css | 1 - 4 files changed, 68 deletions(-) delete mode 100644 src/plays/test-cy-tictactooe3/Readme.md delete mode 100644 src/plays/test-cy-tictactooe3/Test-cy-tictactooe3.jsx delete mode 100644 src/plays/test-cy-tictactooe3/package.json delete mode 100644 src/plays/test-cy-tictactooe3/styles.css diff --git a/src/plays/test-cy-tictactooe3/Readme.md b/src/plays/test-cy-tictactooe3/Readme.md deleted file mode 100644 index 007c485ab0..0000000000 --- a/src/plays/test-cy-tictactooe3/Readme.md +++ /dev/null @@ -1,27 +0,0 @@ -# test_cy_tictactooe3 - -Just testing creation of cypress test - -## Play Demographic - -- Language: js -- Level: Intermediate - -## Creator Information - -- User: Parlier Thierry -- Gihub Link: https://github.com/Parlier Thierry -- Blog: -- Video: - -## Implementation Details - -Update your implementation idea and details here - -## Consideration - -Update all considerations(if any) - -## Resources - -Update external resources(if any) diff --git a/src/plays/test-cy-tictactooe3/Test-cy-tictactooe3.jsx b/src/plays/test-cy-tictactooe3/Test-cy-tictactooe3.jsx deleted file mode 100644 index aa48432761..0000000000 --- a/src/plays/test-cy-tictactooe3/Test-cy-tictactooe3.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import PlayHeader from 'common/playlists/PlayHeader'; -import './styles.css'; - -// WARNING: Do not change the entry componenet name -function Tictactooe3(props) { - // Your Code Start below. - - return ( - <> -
- -
- {/* Your Code Starts Here */} -
-

Play Details - Test_cy_tictactooe3

-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque euismod, urna eu - tincidunt consectetur, nisi nunc ultricies nisi, eget consectetur nunc nisi euismod - nunc. -

-
- {/* Your Code Ends Here */} -
-
- - ); -} - -export default Tictactooe3; diff --git a/src/plays/test-cy-tictactooe3/package.json b/src/plays/test-cy-tictactooe3/package.json deleted file mode 100644 index 5a182523c0..0000000000 --- a/src/plays/test-cy-tictactooe3/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Test-cy-tictactooe3", - "version": "1.0.0", - "description": "Just testing creation of cypress test", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "Parlier Thierry", - "license": "MIT" -} diff --git a/src/plays/test-cy-tictactooe3/styles.css b/src/plays/test-cy-tictactooe3/styles.css deleted file mode 100644 index 5fd508fa9e..0000000000 --- a/src/plays/test-cy-tictactooe3/styles.css +++ /dev/null @@ -1 +0,0 @@ -/* enter stlyes here */