WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
File tree Expand file tree Collapse file tree 4 files changed +49
-5
lines changed
Expand file tree Collapse file tree 4 files changed +49
-5
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "users" : [
3+ " standard_user" ,
4+ " locked_out_user" ,
5+ " problem_user" ,
6+ " performance_glitch_user" ,
7+ " error_user" ,
8+ " visual_user"
9+ ],
10+ "password" : " secret_sauce"
11+ }
Original file line number Diff line number Diff line change @@ -6,20 +6,20 @@ test.describe("Main Page tests", () => {
66 const mainPage = new MainPage ( page ) ;
77 await mainPage . visitMainPage ( ) ;
88
9- //Перевірка, що поле "Username" відображається
9+ //Verify that the "Username" field is displayed
1010 await expect ( page . locator ( 'input[data-test="username"]' ) ) . toBeVisible ( ) ;
1111
12- //Перевірка, що поле "Password" відображається
12+ //Verify that the "Password" field is displayed
1313 await expect ( page . locator ( 'input[data-test="password"]' ) ) . toBeVisible ( ) ;
1414
15- //Перевірка, що кнопка "Login" відображається і активна
15+ //Verify that the "Login" button is visible and active
1616 await expect ( page . locator ( 'input[data-test="login-button"]' ) ) . toBeVisible ( ) ;
1717 await expect ( page . locator ( 'input[data-test="login-button"]' ) ) . toBeEnabled ( ) ;
1818
19- //Перевірка, що список користувачів відображається
19+ //Verify that the user list is displayed
2020 await expect ( page . locator ( 'div[data-test="login-credentials"]' ) ) . toBeVisible ( ) ;
2121
22- //Перевірка, що блок з паролем відображається
22+ //Checking that the password block is displayed
2323 await expect ( page . locator ( 'div[data-test="login-password"]' ) ) . toBeVisible ( ) ;
2424 } ) ;
2525} ) ;
Original file line number Diff line number Diff line change @@ -6,4 +6,13 @@ export class MainPage {
66 async visitMainPage ( ) {
77 await this . page . goto ( '/' ) ;
88 }
9+ async fillUsername ( username : string ) {
10+ await this . page . fill ( 'input[name="user-name"]' , username ) ;
11+ }
12+ async fillPassword ( password : string ) {
13+ await this . page . fill ( 'input[name="password"]' , password ) ;
14+ }
15+ async loginButton ( ) {
16+ await this . page . click ( '#login-button' ) ;
17+ }
918}
Original file line number Diff line number Diff line change 1+ import { test , expect } from '@playwright/test' ;
2+ import { MainPage } from './pages/MainPage' ;
3+ import usersData from '../fixtures/usersData.json' ;
4+
5+ test . describe ( "Standard user tests" , ( ) => {
6+ test ( 'Standard user path' , async ( { page } ) => {
7+ const mainPage = new MainPage ( page ) ;
8+ const username = usersData . users [ 0 ] ;
9+ const password = usersData . password ;
10+
11+ await mainPage . visitMainPage ( ) ;
12+ await mainPage . fillUsername ( username ) ;
13+ await mainPage . fillPassword ( password ) ;
14+
15+ await expect ( page . locator ( 'input[name="user-name"]' ) ) . toHaveValue ( username ) ;
16+ await expect ( page . locator ( 'input[name="password"]' ) ) . toHaveValue ( password ) ;
17+
18+ await mainPage . loginButton ( ) ;
19+
20+ await page . waitForURL ( '/inventory.html' ) ;
21+
22+ } ) ;
23+
24+ } ) ;
You can’t perform that action at this time.
0 commit comments