File size: 1,400 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import { test, expect } from "@playwright/experimental-ct-react";
import Responsive from "./responsive.story";
test.use({ viewport: { width: 1200, height: 500 } });
async function activeSlidesCount(component) {
return await component.locator(".slick-slide.slick-active").count();
}
test("Responsive settings", async ({ mount, page }) => {
const component = await mount(<Responsive />);
await expect(await activeSlidesCount(component)).toEqual(4);
await page.setViewportSize({ width: 1000, height: 500 });
await page.waitForTimeout(10);
await expect(await activeSlidesCount(component)).toEqual(3);
await page.setViewportSize({ width: 600, height: 500 });
await page.waitForTimeout(10);
await expect(await activeSlidesCount(component)).toEqual(2);
await page.setViewportSize({ width: 400, height: 500 });
await page.waitForTimeout(10);
await expect(await activeSlidesCount(component)).toEqual(1);
await page.setViewportSize({ width: 600, height: 500 });
await page.waitForTimeout(10);
await expect(await activeSlidesCount(component)).toEqual(2);
await page.setViewportSize({ width: 1000, height: 500 });
await page.waitForTimeout(10);
await expect(await activeSlidesCount(component)).toEqual(3);
await page.setViewportSize({ width: 1500, height: 500 });
await page.waitForTimeout(10);
await expect(await activeSlidesCount(component)).toEqual(4);
});
|