-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI test continuation, screenshot+trace update, E2E 1st test until che…
…ckout
- Loading branch information
1 parent
33eecbf
commit d7655b6
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,30 @@ const {test, expect} = require('@playwright/test'); | |
|
||
test('Browser check', async ({page})=> | ||
{ | ||
const products = page.locator(".card-body"); | ||
const searchForProductName = 'ZARA COAT 3'; | ||
|
||
await page.goto("https://rahulshettyacademy.com/client"); | ||
await page.locator("#userEmail").fill("[email protected]"); | ||
await page.locator("#userPassword").fill("Password1"); | ||
await page.locator("[value='Login']").click(); | ||
await page.locator("[value='Login']").click(); | ||
|
||
|
||
const titles = await page.locator(".card-body b").allTextContents(); | ||
console.log(titles); | ||
console.log(titles); | ||
//hunt for product 'Zara Coat 4' to click on it | ||
const countProducts = await products.count(); | ||
for (let i=0; i< countProducts; ++i) | ||
{ | ||
if(await products.nth(i).locator("b").textContent() === searchForProductName) | ||
{ | ||
//logic to add product to cart, since we've identified the one we search for | ||
await products.nth(i).locator("text= Add To Cart").click(); | ||
break; //found it, no need to continue loop | ||
} | ||
} | ||
|
||
await page.locator("[routerlink*='cart'").click(); | ||
|
||
|
||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters