Skip to content

Commit a86e23c

Browse files
committed
add test flow, write 1st asertion
1 parent 0d807c1 commit a86e23c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/RS_ClientApp.spec.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ test('Browser check', async ({page})=>
44
{
55
const products = page.locator(".card-body");
66
const searchForProductName = 'ZARA COAT 3';
7+
const email = "[email protected]";
78

89
await page.goto("https://rahulshettyacademy.com/client");
9-
await page.locator("#userEmail").fill("[email protected]");
10+
await page.locator("#userEmail").fill(email);
1011
await page.locator("#userPassword").fill("Password1");
1112
await page.locator("[value='Login']").click();
1213
await page.locator(".card-body b").first().waitFor(); // products to loadup
@@ -37,6 +38,20 @@ test('Browser check', async ({page})=>
3738
// await page.pause();
3839

3940
//checkout page
40-
await page.locator("[placeholder*='Country']").fill("ind");
41+
await page.locator("[placeholder*='Country']").pressSequentially("ro", {delay:100}); // input field, shows results per input so pressing 1letter at a time
42+
const countryDropdown = page.locator(".ta-results");
43+
await countryDropdown.waitFor(); //wait until is shown
44+
const countryDropdownCount = await countryDropdown.locator("button").count();
45+
for(let i=0; i<countryDropdownCount; ++i){
46+
const text = await countryDropdown.locator("button").nth(i).textContent();
47+
if(text === " Romania"){ //could use trim to trim spaces, or can use the 'includes' option
48+
await countryDropdown.locator("button").nth(i).click();
49+
break;
50+
}
51+
}
52+
// await page.pause();
4153

54+
//asertions for the page
55+
expect(page.locator(".user__name [type='text']").first()).toHaveText(email);
56+
await page.locator(".action__submit").click(); // place order button
4257
})

0 commit comments

Comments
 (0)