Skip to content

Commit

Permalink
UI test continuation, screenshot+trace update, E2E 1st test until che…
Browse files Browse the repository at this point in the history
…ckout
  • Loading branch information
Cristi-Fogel committed Mar 27, 2024
1 parent 33eecbf commit d7655b6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
5 changes: 4 additions & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ module.exports = defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
headless: false,
screenshot: 'off',
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
// // on - detail report for each step
// // on-first-retry - default
trace: 'off',
},

/* Configure projects for major browsers */
Expand Down
24 changes: 21 additions & 3 deletions tests/RS_ClientApp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();



})
4 changes: 2 additions & 2 deletions tests/UIBasicsTest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test("UI Controls test", async ({page})=>
// check blinking item on page
await expect(documentLink).toHaveAttribute("class", "blinkingText"); // if class element is found, then blinking will eventually work

await page.pause();
//await page.pause();
await signInButton.click();
});

Expand Down Expand Up @@ -110,6 +110,6 @@ test('Child windows handling', async ({browser})=>
//go back to main page
await page.locator("#username").fill(domainText);

await page.pause();
// await page.pause();
console.log(await page.locator("#username").textContent()); //prints content in element to logs
});

0 comments on commit d7655b6

Please sign in to comment.