File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7777 working-directory : web
7878 run : ./.github/ci/requirement.install.sh
7979 - name : Start Backend Server
80+ id : start_backend_server
8081 working-directory : web
8182 run : ./.github/ci/run.start-backend-server.sh
8283 env :
@@ -87,12 +88,13 @@ jobs:
8788 working-directory : web
8889 run : ./.github/ci/run.test.sh
8990 - name : Upload E2E Test Report
91+ if : always()
9092 uses : actions/upload-artifact@v4
9193 with :
9294 path : web/playwright-report/
9395 retention-days : 1
9496 - name : Stop Backend Server
95- if : always()
97+ if : steps.start_backend_server.outcome == 'success'
9698 working-directory : web
9799 run : ./.github/ci/run.stop-backend-server.sh
98100
Original file line number Diff line number Diff line change 1- import { Page } from '@playwright/test' ;
1+ import type { Page } from '@playwright/test'
22
33export class LoginPage {
44 constructor ( public page : Page ) { }
55
66 async goto ( ) {
7- await this . page . goto ( '/login' ) ;
7+ await this . page . goto ( '/login' )
88 }
99
1010 async login ( username : string , password : string ) {
11- await this . page . fill ( 'input[name="username"]' , username ) ;
12- await this . page . fill ( 'input[name="password"]' , password ) ;
13- await this . page . click ( 'button[name="登录"]' ) ;
11+ await this . page . fill ( 'input[name="username"]' , username )
12+ await this . page . fill ( 'input[name="password"]' , password )
13+ await this . page . click ( 'button[name="登录"]' )
1414 }
15- }
15+ }
Original file line number Diff line number Diff line change 1- import { test , expect } from '@playwright/test' ;
1+ import { expect , test } from '@playwright/test'
22
33test . describe . serial ( 'Base Tests' , ( ) => {
4-
54 test ( 'Api Test' , async ( { request } ) => {
6- const response = await request . get ( 'http://localhost:9501' ) ;
5+ const response = await request . get ( 'http://localhost:9501' )
76
8- expect ( response . status ( ) ) . toBe ( 200 ) ;
7+ expect ( response . status ( ) ) . toBe ( 200 )
98
10- expect ( await response . text ( ) ) . toEqual ( 'welcome use mineAdmin' ) ;
11- } ) ;
9+ expect ( await response . text ( ) ) . toEqual ( 'welcome use mineAdmin' )
10+ } )
1211
1312 test ( 'Page Check' , async ( { page } ) => {
14- await page . goto ( '/' ) ;
15-
16- await page . waitForLoadState ( 'networkidle' ) ;
13+ await page . goto ( '/' )
1714
18- await expect ( page . getByRole ( 'button' , { name : '登录' } ) ) . toBeVisible ( ) ;
15+ await page . waitForLoadState ( 'networkidle' )
1916
20- expect ( await page . title ( ) ) . toContain ( 'MineAdmin' ) ;
21- } ) ;
17+ await expect ( page . getByRole ( 'button' , { name : '登录' } ) ) . toBeVisible ( )
2218
23- } ) ;
19+ expect ( await page . title ( ) ) . toContain ( 'MineAdmin' )
20+ } )
21+ } )
Original file line number Diff line number Diff line change 1- import { test , expect } from '@playwright/test' ;
2- import { LoginPage } from '../pages/loginPage.ts' ;
1+ import { test } from '@playwright/test'
2+ import { LoginPage } from '../pages/loginPage.ts'
33
44test . describe ( '登录模块' , ( ) => {
55 test ( '正确账号可以登录' , async ( { page } ) => {
6- const loginPage = new LoginPage ( page ) ;
7- await loginPage . goto ( ) ;
8- await loginPage . login ( 'admin' , '123456' ) ;
9- } ) ;
10- } ) ;
6+ const loginPage = new LoginPage ( page )
7+ await loginPage . goto ( )
8+ await loginPage . login ( 'admin' , '123456' )
9+ } )
10+ } )
You can’t perform that action at this time.
0 commit comments