Skip to content

Commit bef7bd8

Browse files
Migrate tests from Cypress to Playwright
- Replace @uirouter/cypress-runner with @playwright/test - Add playwright.config.js with web server setup - Create tests/sample-app.spec.js with all 13 tests - Update test scripts in package.json - Remove cypress/ directory and config
1 parent bba69df commit bef7bd8

File tree

10 files changed

+465
-1488
lines changed

10 files changed

+465
-1488
lines changed

cypress.config.js

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

cypress/e2e/sample_app.cy.js

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

cypress/fixtures/example.json

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

cypress/plugins/index.js

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

cypress/support/commands.js

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

cypress/support/e2e.js

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

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"clean": "shx rm -rf _bundles transpiled",
77
"start": "webpack-dev-server --progress --open",
88
"build": "webpack",
9-
"test": "npm run build && cypress-runner run --path .",
10-
"test:open": "npm run build && cypress-runner open --path .",
9+
"test": "npm run build && playwright test",
10+
"test:ui": "npm run build && playwright test --ui",
1111
"e2e": "npm run test",
1212
"gh-pages": "git checkout gh-pages && git rebase master && yarn && webpack && git add -f _bundles && git commit -m 'publish gh-pages' && git push origin gh-pages:gh-pages --force && git checkout master"
1313
},
@@ -38,8 +38,9 @@
3838
"devDependencies": {
3939
"@babel/core": "^7.21.4",
4040
"@babel/preset-env": "^7.14.9",
41-
"@uirouter/cypress-runner": "^3.0.0",
41+
"@playwright/test": "^1.57.0",
4242
"babel-loader": "^9.1.2",
43+
"serve": "^14.2.5",
4344
"shx": "^0.3.4",
4445
"source-map-loader": "^4.0.1",
4546
"webpack": "^5.77.0",

playwright.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const { defineConfig } = require('@playwright/test');
2+
3+
module.exports = defineConfig({
4+
testDir: './tests',
5+
fullyParallel: true,
6+
forbidOnly: !!process.env.CI,
7+
retries: process.env.CI ? 2 : 0,
8+
workers: process.env.CI ? 1 : undefined,
9+
reporter: 'list',
10+
use: {
11+
baseURL: 'http://localhost:4000',
12+
trace: 'on-first-retry',
13+
},
14+
projects: [
15+
{
16+
name: 'chromium',
17+
use: { browserName: 'chromium' },
18+
},
19+
],
20+
webServer: {
21+
command: 'npx serve -s -p 4000 .',
22+
url: 'http://localhost:4000',
23+
reuseExistingServer: !process.env.CI,
24+
},
25+
});

0 commit comments

Comments
 (0)