Skip to content

Commit

Permalink
Modifying tests for the mobile screen
Browse files Browse the repository at this point in the history
  • Loading branch information
amankumarrr committed Mar 25, 2024
1 parent 42c3b6f commit 71d537b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions ui-tests/images.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test, { expect } from "@playwright/test";

test("Images load successfully on index", async ({ page }) => {
test("Images load successfully on index", async ({ page, browser }) => {
await page.on("response", (response) => {
if (response.request().resourceType() === "image") {
expect(response.status() < 400).toBeTruthy();
Expand All @@ -19,12 +19,19 @@ test("Images load successfully on index", async ({ page }) => {
});

for (let i = 0; i < sizes.pageHeight; i += sizes.browserHeight) {
await page.mouse.wheel(0, i);
if (browser.browserType().name() === "webkit") {
await page.touchscreen.tap(0, i);
} else {
await page.mouse.wheel(0, i);
}
await page.waitForTimeout(100);
}
});

test("Images load successfully on consulting page", async ({ page }) => {
test("Images load successfully on consulting page", async ({
page,
browser,
}) => {
await page.on("response", (response) => {
if (response.request().resourceType() === "image") {
expect(response.status() < 400).toBeTruthy();
Expand All @@ -45,7 +52,11 @@ test("Images load successfully on consulting page", async ({ page }) => {
});

for (let i = 0; i < sizes.pageHeight; i += sizes.browserHeight) {
await page.mouse.wheel(0, i);
if (browser.browserType().name() === "webkit") {
await page.touchscreen.tap(0, i);
} else {
await page.mouse.wheel(0, i);
}
await page.waitForTimeout(100);
}
});

0 comments on commit 71d537b

Please sign in to comment.