File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // URL'S
2+ export const URLs = {
3+ URL :'https://the-internet.herokuapp.com/' ,
4+ ADD_REMOVE_ELEMENTS : '/add_remove_elements' ,
5+ BASIC_AUTH : '/basic_auth'
6+
7+ } ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export default defineConfig({
2626 /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2727 use : {
2828 /* Base URL to use in actions like `await page.goto('/')`. */
29- // baseURL: 'http ://localhost:3000 ',
29+ baseURL : 'https ://the-internet.herokuapp.com/ ' ,
3030
3131 /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3232 screenshot : 'only-on-failure' ,
Original file line number Diff line number Diff line change 1+ import { test , expect } from '@playwright/test' ;
2+ import { URLs } from '../constants/configuration' ;
3+
4+ test ( 'has title' , async ( { page } ) => {
5+ await page . goto ( '/' ) ;
6+ await expect ( page ) . toHaveTitle ( / T h e I n t e r n e t / ) ;
7+ } ) ;
8+
9+ test ( 'Test Add/Remove Elements' , async ( { page } ) => {
10+ await page . goto ( '/' ) ;
11+ await page . locator ( "a:has-text('Add/Remove Elements')" ) . click ( ) ;
12+ await expect ( page ) . toHaveURL ( URLs . ADD_REMOVE_ELEMENTS ) ;
13+
14+ await expect ( page . locator ( ".example button:has-text('Add Element')" ) ) . toBeVisible ( ) ;
15+ await page . locator ( ".example button:has-text('Add Element')" ) . waitFor ( { state : 'visible' } ) ;
16+ await page . locator ( ".example button:has-text('Add Element')" ) . click ( ) ;
17+ await page . locator ( "#elements button:has-text('Delete')" ) . click ( ) ;
18+ await expect ( await page . locator ( ".added-manually" ) . count ( ) ) . toBeGreaterThanOrEqual ( 0 ) ;
19+ } ) ;
20+
21+ test ( 'Test Basic Auth' , async ( { page } ) => {
22+ await page . goto ( '/' ) ;
23+ await page . locator ( "a:has-text('Basic Auth')" ) . click ( ) ;
24+ await expect ( page ) . toHaveURL ( URLs . BASIC_AUTH ) ;
25+
26+ await expect ( page . locator ( ".example button:has-text('Add Element')" ) ) . toBeVisible ( ) ;
27+ await page . locator ( ".example button:has-text('Add Element')" ) . waitFor ( { state : 'visible' } ) ;
28+ await page . locator ( ".example button:has-text('Add Element')" ) . click ( ) ;
29+ await page . locator ( "#elements button:has-text('Delete')" ) . click ( ) ;
30+ await expect ( await page . locator ( ".added-manually" ) . count ( ) ) . toBeGreaterThanOrEqual ( 0 ) ;
31+ } ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "baseUrl" : " src" ,
4+ "paths" : {
5+ "constants/*" : [" constants/*" ]
6+ }
7+ }
8+ }
9+
You can’t perform that action at this time.
0 commit comments