Skip to content

Commit

Permalink
add test flow, write 1st asertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristi-Fogel committed Aug 14, 2024
1 parent 0d807c1 commit a86e23c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/RS_ClientApp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
})

0 comments on commit a86e23c

Please sign in to comment.