8000 chore(website): switch from Cypress to Playwright (#5814) · adnanhashmi09/typescript-eslint@9ffdb05 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ffdb05

Browse files
chore(website): switch from Cypress to Playwright (typescript-eslint#5814)
* chore(website): switch from Cypress to Playwright * Touched up configs * Fixed linting * Remove remaining setup cruft * Update .github/workflows/ci.yml Co-authored-by: Brad Zacher <brad.zacher@gmail.com> Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
1 parent 56f89d6 commit 9ffdb05

File tree

< 8000 div class="d-flex flex-items-center">

15 files changed

+100
-584
lines changed

15 files changed

+100
-584
lines changed

.github/actions/prepare-install/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ runs:
3333
with:
3434
path: |
3535
${{ steps.yarn-cache-dir-path.outputs.dir }}
36-
~/.cache/Cypress
3736
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3837
restore-keys: |
3938
${{ runner.os }}-yarn-

.github/renovate.json5

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@
5656
matchPackagePrefixes: ['@types/jest'],
5757
groupName: 'jest',
5858
},
59-
{
60-
matchPackageNames: ['cypress', 'cypress-axe'],
61-
matchUpdateTypes: ['minor', 'patch', 'pin', 'digest'],
62-
groupName: 'cypress',
63-
},
6459
],
6560
postUpdateOptions: [
6661
// run yarn dedupe to cleanup the lockfile after updates

.github/workflows/ci.yml

Lines changed: 9 additions & 15 deletions
211
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ jobs:
175175
website_tests:
176176
permissions:
177177
contents: read # to fetch code (actions/checkout)
178-
actions: read # to correctly identify workflow run (cypress-io/github-action)
179178

180179
name: Website tests
181180
needs: [build]
@@ -192,23 +191,18 @@ jobs:
192191
- name: Build
193192
uses: ./.github/actions/prepare-build
194193

195-
- name: Install Cypress
196-
run: yarn cypress install
194+
- name: Install Playwright Browsers
195+
run: npx playwright install --with-deps
197196

198-
- env:
199-
DEBUG: '@cypress/github-action'
200-
name: Cypress run
201-
uses: cypress-io/github-action@v2
202-
with:
203-
project: ./packages/website
204-
start: yarn start
197+
- name: Run Playwright tests
198+
run: yarn playwright test --reporter=list
199+
working-directory: packages/website
205200

206-
- uses: actions/upload-artifact@v3
201+
- if: always()
202+
uses: actions/upload-artifact@v3
207203
with:
208-
name: screenshots
209-
path: |
210-
packages/website/cypress/screenshots/
-
packages/website/cypress/videos/
204+
name: playwright-report
205+
path: packages/website/playwright-report
212206

213207
upload_coverage:
214208
name: Upload Codecov Coverage

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ yarn-error.log*
99
packages/website/.docusaurus
1010
packages/website/.cache-loader
1111
packages/website/build
12-
packages/website/cypress/screenshots
13-
packages/website/cypress/videos
12+
packages/website/playwright-report
13+
packages/website/playwright/.cache
1414
packages/website/static/sandbox
15+
packages/website/test-results
1516

1617
# Runtime data
1718
pids

packages/website/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
overrides: [
1010
{
1111
files: [
12+
'./*.config.*',
1213
'./src/pages/*.tsx',
1314
'./src/components/**/*.tsx',
1415
'./src/components/hooks/*.ts',

packages/website/cypress/integration/index.spec.js

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

packages/website/cypress/plugins/index.js

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

packages/website/cypress/support/commands.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/website/cypress/support/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/website/cypress/utils.js

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

packages/website/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
"serve": "docusaurus serve",
1111
"start": "docusaurus start",
1212
"swizzle": "docusaurus swizzle",
13-
"test": "cypress run",
14-
"test:open": "cypress open",
13+
"test": "playwright test",
1514
"typecheck": "tsc"
1615
},
1716
"dependencies": {
@@ -43,14 +42,14 @@
4342
"react": "^18.0.0"
4443
},
4544
"devDependencies": {
45+
"@axe-core/playwright": "^4.4.5",
4646
"@docusaurus/module-type-aliases": "~2.1.0",
47+
"@playwright/test": "^1.27.1",
4748
"@types/react": "^18.0.9",
4849
"@types/react-helmet": "^6.1.5",
4950
"@types/react-router-dom": "^5.3.3",
5051
"@typescript-eslint/eslint-plugin": "5.40.0",
5152
"copy-webpack-plugin": "^11.0.0",
52-
"cypress": "8.7.0",
53-
"cypress-axe": "^0.14.0",
5453
"eslint-plugin-jsx-a11y": "^6.5.1",
5554
"eslint-plugin-react": "^7.29.4",
5655
"eslint-plugin-react-hooks": "^4.5.0",

packages/website/playwright.config.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import type { PlaywrightTestConfig } from '@playwright/test';
2+
import { devices } from '@playwright/test';
3+
4+
const config: PlaywrightTestConfig = {
5+
forbidOnly: !!process.env.CI,
6+
fullyParallel: true,
7+
reporter: 'html',
8+
retries: 0,
9+
testDir: './tests',
10+
use: {
11+
baseURL: 'http://localhost:3000',
12+
trace: 'on-first-retry',
13+
},
14+
projects: [
15+
{
16+
name: 'chromium',
17+
use: {
18+
...devices['Desktop Chrome'],
19+
},
20+
},
21+
],
22+
webServer: {
23+
command: 'yarn start',
24+
port: 3000,
25+
},
26+
workers: process.env.CI ? 1 : undefined,
27+
};
28+
29+
export default config;

packages/website/tests/index.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import AxeBuilder from '@axe-core/playwright';
2+
import { test } from '@playwright/test';
3+
4+
test('Index', async ({ page }) => {
5+
await page.goto('/');
6+
await new AxeBuilder( 9B08 { page }).analyze();
7+
});

packages/website/tsconfig.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,5 @@
1616
},
1717
"types": ["@docusaurus/module-type-aliases", "@docusaurus/theme-classic"]
1818
},
19-
"include": [
20-
"src/",
21-
"plugins/",
22-
"typings",
23-
"./docusaurusConfig.ts",
24-
"./rulesMeta.ts"
25-
]
19+
"include": ["src", "tests", "plugins", "typings", "./*.ts"]
2620
}

0 commit comments

Comments
 (0)
0