Skip to content

Commit aea8de4

Browse files
authored
test(e2e): migrate from cypress to playwright (#1540)
1 parent d837efc commit aea8de4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+864
-1744
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@ module.exports = {
1515
},
1616
},
1717
{
18-
files: ['**/e2e/**/*.cy.ts', '**/e2e/cypress/**/*.ts'],
19-
extends: 'plugin:cypress/recommended',
20-
rules: {
21-
'@typescript-eslint/no-namespace': 'off',
22-
},
23-
},
24-
{
25-
files: ['**/tests/**/*.ts', 'tsup.config.ts'],
18+
files: ['**/tests/**/*.ts', 'e2e/**/*.ts', 'tsup.config.ts'],
2619
rules: {
2720
'@typescript-eslint/explicit-function-return-type': 'off',
2821
'import/no-extraneous-dependencies': 'off',

.github/workflows/e2e.yml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,9 @@ jobs:
3535
- name: Install dependencies
3636
run: pnpm install --frozen-lockfile
3737

38-
- name: Get cypress cache path
38+
- name: Install playwright chromium
3939
working-directory: ./e2e
40-
shell: bash
41-
run: |
42-
echo "CYPRESS_CACHE_PATH=$(pnpm cypress cache path)" >> $GITHUB_ENV
43-
44-
- name: Setup cypress cache
45-
uses: actions/cache@v3
46-
with:
47-
path: ${{ env.CYPRESS_CACHE_PATH }}
48-
key: cypress-${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
49-
restore-keys: |
50-
cypress-${{ runner.os }}-node-${{ matrix.node }}-
51-
cypress-${{ runner.os }}-
52-
53-
- name: Install cypress binary
54-
working-directory: ./e2e
55-
run: pnpm cypress install
40+
run: pnpm playwright install chromium
5641

5742
- name: Build source files
5843
run: pnpm build

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ dist/
1313
coverage/
1414

1515
# E2E temp files
16-
e2e/cypress/screenshots/
16+
e2e/playwright-report/
17+
e2e/test-results/
1718

1819
# Node modules
1920
node_modules/

.vscode/extensions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"recommendations": [
33
"dbaeumer.vscode-eslint",
44
"esbenp.prettier-vscode",
5+
"ms-playwright.playwright",
56
"vue.volar"
67
]
78
}

CONTRIBUTING.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pnpm build
4343
- [TypeScript](https://www.typescriptlang.org/) as the development language
4444
- [ESLint](https://eslint.org/) + [Prettier](https://prettier.io/) for code linting and formatting
4545
- [Vitest](https://vitest.dev/) for unit testing
46-
- [Cypress](https://www.cypress.io/) for end-to-end testing
46+
- [Playwright](https://playwright.dev/) for end-to-end testing
4747

4848
### Scripts
4949

@@ -69,7 +69,7 @@ The `lint` script uses ESLint to check all source files.
6969

7070
#### `pnpm test`
7171

72-
The `test` script uses Vitest to run unit testings, and uses Cypress to run end-to-end testings.
72+
The `test` script uses Vitest to run unit testings, and uses Playwright to run end-to-end testings.
7373

7474
## End-to-end Testing
7575

@@ -97,19 +97,6 @@ pnpm docs:serve
9797

9898
### Run E2E Tests
9999

100-
After starting a dev server or a preview server, you can run e2e tests in another terminal:
101-
102-
```bash
103-
# open Cypress GUI
104-
pnpm cy:open:dev
105-
pnpm cy:open:build
106-
# or, run tests in command line
107-
pnpm cy:run:dev
108-
pnpm cy:run:build
109-
```
110-
111-
If you don't want to start a server and run tests in two different terminals, you can make use of the following commands:
112-
113100
```bash
114101
# run e2e tests in dev mode
115102
pnpm e2e:dev

CONTRIBUTING_zh.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pnpm build
4343
- [TypeScript](https://www.typescriptlang.org/) 作为开发语言
4444
- [ESLint](https://eslint.org/) + [Prettier](https://prettier.io/) 用于代码检查和格式化
4545
- [Vitest](https://vitest.dev/) 用于单元测试
46-
- [Cypress](https://www.cypress.io/) 用于端到端测试
46+
- [Playwright](https://playwright.dev/) 用于端到端测试
4747

4848
### 开发脚本
4949

@@ -69,7 +69,7 @@ pnpm build
6969

7070
#### `pnpm test`
7171

72-
`test` 命令使用 Vitest 来运行单元测试,使用 Cypress 来运行端到端测试。
72+
`test` 命令使用 Vitest 来运行单元测试,使用 Playwright 来运行端到端测试。
7373

7474
## 端到端测试
7575

@@ -97,19 +97,6 @@ pnpm docs:serve
9797

9898
### 运行 E2E 测试
9999

100-
在启动开发服务器或预览服务器后,你可以在另一个终端中运行 e2e 测试:
101-
102-
```bash
103-
# 启动 Cypress 图形界面
104-
pnpm cy:open:dev
105-
pnpm cy:open:build
106-
# 或者,直接在命令行中运行测试
107-
pnpm cy:run:dev
108-
pnpm cy:run:build
109-
```
110-
111-
如果你不想在两个不同终端内启动服务器和运行测试,你可以使用如下命令:
112-
113100
```bash
114101
# 在开发模式下运行 e2e 测试
115102
pnpm e2e:dev

e2e/cypress.config.ts

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

e2e/cypress/support/commands.ts

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

e2e/cypress/support/e2e.ts

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

e2e/docs/components/route-link.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
### Slots
4747

4848
- <RouteLink to="/README.md"><span>text</span></RouteLink>
49-
- <RouteLink to="/README.md"><span>text</span><span>text</span></RouteLink>
49+
- <RouteLink to="/README.md"><span>text</span><span>text2</span></RouteLink>
5050

5151
### Hash and query
5252

0 commit comments

Comments
 (0)