-
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.
- Loading branch information
1 parent
0d807c1
commit a86e23c
Showing
1 changed file
with
17 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,10 @@ test('Browser check', async ({page})=> | |
{ | ||
const products = page.locator(".card-body"); | ||
const searchForProductName = 'ZARA COAT 3'; | ||
const email = "[email protected]"; | ||
|
||
await page.goto("https://rahulshettyacademy.com/client"); | ||
await page.locator("#userEmail").fill("[email protected]"); | ||
await page.locator("#userEmail").fill(email); | ||
await page.locator("#userPassword").fill("Password1"); | ||
await page.locator("[value='Login']").click(); | ||
await page.locator(".card-body b").first().waitFor(); // products to loadup | ||
|
@@ -37,6 +38,20 @@ test('Browser check', async ({page})=> | |
// await page.pause(); | ||
|
||
//checkout page | ||
await page.locator("[placeholder*='Country']").fill("ind"); | ||
await page.locator("[placeholder*='Country']").pressSequentially("ro", {delay:100}); // input field, shows results per input so pressing 1letter at a time | ||
const countryDropdown = page.locator(".ta-results"); | ||
await countryDropdown.waitFor(); //wait until is shown | ||
const countryDropdownCount = await countryDropdown.locator("button").count(); | ||
for(let i=0; i<countryDropdownCount; ++i){ | ||
const text = await countryDropdown.locator("button").nth(i).textContent(); | ||
if(text === " Romania"){ //could use trim to trim spaces, or can use the 'includes' option | ||
await countryDropdown.locator("button").nth(i).click(); | ||
break; | ||
} | ||
} | ||
// await page.pause(); | ||
|
||
//asertions for the page | ||
expect(page.locator(".user__name [type='text']").first()).toHaveText(email); | ||
await page.locator(".action__submit").click(); // place order button | ||
}) |