Skip to content

Commit c95c260

Browse files
shilCodemohatShilABBpriyankarpal
authored
added testcases covering all major browsers, removed cypress & added playwright 🧪 (#1481)
* removed cypress & installed playwright - removed cypress (still need to remove folders and update readme.md) - installed playwright - wrote first few tests (homepage) * added more devices to test & completed homepage - firefox and chrome added - completed homepage fully (need to convert to po still) - create npm/yarn e2e script * rm'ed cy dir, added more tests & fixed README - removed cypress directory since all the tests are covered - converted homepage to pageobject - added ideaspage and also added po for it - fixed main readme file to adjust to playwright - added plays.spec to write more tests later * complete set e2e tests added - removed cypress.yml and added pw yml - using list reporter instaed of line reporter - added full sets of tests * comment resolve - typo broweBtn --------- Signed-off-by: Mohat Shil <120472338+shilCode@users.noreply.github.com> Co-authored-by: Mohat Shil <146836180+mohatShilABB@users.noreply.github.com> Co-authored-by: Priyankar Pal <88102392+priyankarpal@users.noreply.github.com>
1 parent 80144b3 commit c95c260

23 files changed

+753
-1127
lines changed
Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Cypress Tests
1+
name: Playwright e2e Tests
22

33
on:
44
push:
@@ -10,7 +10,7 @@ concurrency:
1010
group: environment-${{ github.ref }}
1111
cancel-in-progress: true
1212
jobs:
13-
cypress-run:
13+
playwright-run:
1414
runs-on: ubuntu-latest
1515
if: github.repository == 'reactplay/react-play'
1616
steps:
@@ -21,9 +21,9 @@ jobs:
2121
npm install --legacy-peer-deps
2222
2323
# Install NPM dependencies, cache them correctly
24-
# and run all Cypress tests
25-
- name: Cypress run
26-
uses: cypress-io/github-action@v4
24+
# and run all Playwright tests
25+
- name: Playwright run
26+
uses: actions/checkout@v4
2727
with:
2828
install-command: |
2929
npm install --legacy-peer-deps
@@ -33,3 +33,15 @@ jobs:
3333
env:
3434
# pass GitHub token to detect new build vs re-run build
3535
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
36+
- name: Install dependencies
37+
run: npm ci
38+
- name: Install Playwright Browsers
39+
run: npx playwright install --with-deps
40+
- name: Run Playwright tests
41+
run: yarn e2e
42+
- uses: actions/upload-artifact@v4
43+
if: always()
44+
with:
45+
name: playwright-report
46+
path: playwright-report/
47+
retention-days: 30

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ cypress/e2e/play.cy.ts
4444

4545
# vscode setting
4646
.vscode
47+
/test-results/
48+
/playwright-report/
49+
/blob-report/
50+
/playwright/.cache/

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,34 @@ npm build
196196

197197
It builds the app for production to the `build` folder. It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.
198198

199-
### 🧪 Test App Locally (E2E with Cypress)
199+
--------------------------------------------------------------
200200

201-
Use the following command to run cypress locally:
201+
### 🧪 Test App Locally (E2E with Playwright)
202202

203+
Use the following command to install browser(s) binaries to test locally:
203204
```bash
204-
yarn cypress:open
205+
yarn install playwright
205206
```
206207
OR
207208
```
208-
npm run cypress:open
209+
npm install playwright
209210
```
210211

211-
It will open the cypress dashboard, through which you need to select `E2E Testing`.
212-
Once you are done with the selection you will get options to choose your preferred browser in which you want to run the test.!
213-
Once you select the browser you need to click on `Start E2E Testing in <SELECTED_BROWSER_NAME>.` The chosen browser will pop up you can see a list of cypress tests, click on the test to start testing.!
212+
Use the following command to run Playwright tests:
213+
214+
```bash
215+
yarn e2e
216+
```
217+
OR
218+
```
219+
npm run e2e
220+
```
221+
👀 Read more about testing in [react-play](../react-play/e2e/README.md)
222+
223+
👀 Read more about playwright: https://playwright.dev/
224+
225+
--------------------------------------------------------------
226+
214227

215228
### 🚀 Deploy
216229

cypress.config.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

cypress/e2e/homePage.cy.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

cypress/e2e/ideasPage.cy.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

cypress/e2e/leaderboardPage.cy.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

cypress/support/commands.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

cypress/support/constant.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

cypress/support/e2e.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)