Skip to content

Commit

Permalink
complete e2e test, lookup more validations and element-list itereations
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristi-Fogel committed Aug 21, 2024
1 parent 27896f9 commit db8e122
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
25 changes: 25 additions & 0 deletions tests/Calendar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const {test, expect} = require("@playwright/test");

test('Calendars validations', async ({page})=>
{
const monthNumber = "5";
const date = "14";
const year = "2027";
const expectedDate = [monthNumber, date, year];

await page.goto("https://rahulshettyacademy.com/seleniumPractise/#/offers");
await page.locator(".react-date-picker__inputGroup").click();
await page.locator(".react-calendar__navigation__label").click();
await page.locator(".react-calendar__navigation__label").click(); //second click to select year within calendar thingy
await page.getByText(year).click();
await page.locator(".react-calendar__year-view__months__month").nth(Number(monthNumber)-1).click(); //select all cells, can pass to click on nth() one
await page.locator("//abbr[text()='"+date+"']").click(); //pass the date within the locator

const inputs = await page.locator(".react-date-picker__inputGroup input");
for (let index = 0; index < inputs.length; index++) //go through all 3 datepicker elements
{
const value = inputs[index].getAttribute("value");
expect(value).toEqual(expectedDate[index]);
}
})

6 changes: 2 additions & 4 deletions tests/PlaywrigthSpecialLocators.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ test('Playwright locators check', async ({page})=>

await page.getByRole("link", {name: "Shop"}).click();
await page.locator("app-card").filter({hasText: 'Nokia Edge'}).getByRole("button").click(); //only one button in card, so no filtering needed here



})

})
14 changes: 14 additions & 0 deletions tests/moreValidations.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { test, expect } = require("@playwright/test");

test("Popup validations", async({page})=>
{
await page.goto("https://rahulshettyacademy.com/AutomationPractice")
// await page.goBack();
// await page.goForward();

await expect(page.locator("#displayed-text")).toBeVisible();
await page.locator("#hide-textbox").click();
await expect(page.locator("#displayed-text")).toBeHidden();


})

0 comments on commit db8e122

Please sign in to comment.