Skip to content

Commit a0f4baa

Browse files
committed
fix(tests): 修复登录页面的按钮点击方式,使用 getByRole 方法替代
1 parent f5da273 commit a0f4baa

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

.github/workflows/frontend-test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ jobs:
7777
working-directory: web
7878
run: ./.github/ci/requirement.install.sh
7979
- name: Start Backend Server
80-
id: start_backend_server
8180
working-directory: web
8281
run: ./.github/ci/run.start-backend-server.sh
8382
env:
@@ -94,7 +93,7 @@ jobs:
9493
path: web/playwright-report/
9594
retention-days: 1
9695
- name: Stop Backend Server
97-
if: steps.start_backend_server.outcome == 'success'
96+
if: always()
9897
working-directory: web
9998
run: ./.github/ci/run.stop-backend-server.sh
10099

web/tests/e2e/pages/loginPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export class LoginPage {
1010
async login(username: string, password: string) {
1111
await this.page.fill('input[name="username"]', username)
1212
await this.page.fill('input[name="password"]', password)
13-
await this.page.click('button[name="登录"]')
13+
await this.page.getByRole('button', { name: '登录' }).click()
1414
}
1515
}

0 commit comments

Comments
 (0)