Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions
Jump to navigation
Jump to search
Udemy Playwright: Web Automation Testing From Zero to Hero (view source)
Revision as of 04:21, 27 May 2024
, 27 May→Web Tables
m (→Web Tables) |
m (→Web Tables) |
||
Line 497: | Line 497: | ||
=== Web Tables === | === Web Tables === | ||
<nowiki> | <nowiki> | ||
test("Web Table", async ({ page }) => { | test("Web Table", async ({ page }) => { | ||
Line 518: | Line 517: | ||
await page.locator(".nb-checkmark").click() | await page.locator(".nb-checkmark").click() | ||
await expect(targetRowById.locator('td').nth(5)).toHaveText('test@test.com') | await expect(targetRowById.locator('td').nth(5)).toHaveText('test@test.com') | ||
// 3 test filter of the table | |||
const ages = ["20", "30", "40", "200"] | |||
for (let age of ages) { | |||
await page.locator("input-filter").getByPlaceholder("Age").clear() | |||
await page.locator("input-filter").getByPlaceholder("Age").fill(age) | |||
await page.waitForTimeout(500) // it takes a moment to refresh the list | |||
const ageRows = page.locator("tbody tr") | |||
for (let row of await ageRows.all()) { | |||
const cellValue = await row.locator("td").last().textContent() | |||
if (age == "200") { | |||
expect(await page.getByRole("table").textContent()).toContain( | |||
"No data found" | |||
) | |||
} else { | |||
expect(cellValue).toEqual(age) | |||
} | |||
} | |||
} | |||
})</nowiki> | })</nowiki> | ||
Not sure I like how one scenario is testing multiple things, and particularly // 3 where the last filter scenario expects to find no data, compared to the first three that do have rows... | |||
=== Date Picker === | === Date Picker === | ||
=== Sliders === | === Sliders === | ||
=== Drag & Drop with iFrames === | === Drag & Drop with iFrames === |