mirror of
https://github.com/cstaelen/shazarr.git
synced 2026-10-19 01:31:11 -05:00
28 lines
756 B
TypeScript
28 lines
756 B
TypeScript
import { expect, Page } from "@playwright/test";
|
|
|
|
import historyFixtures from "../fixtures/history.json";
|
|
|
|
export async function gotoWithLocalStorage(url: string, page: Page) {
|
|
page.goto(url);
|
|
await expect(page.getByText("Shazarr")).toBeVisible();
|
|
|
|
const stringifiedData = JSON.stringify(historyFixtures);
|
|
await page.evaluate(
|
|
(stringifiedData) =>
|
|
window.localStorage.setItem(
|
|
"CapacitorStorage.com.shazarr.history",
|
|
stringifiedData,
|
|
),
|
|
stringifiedData,
|
|
);
|
|
// Reload page with
|
|
page.reload();
|
|
}
|
|
|
|
export async function waitForImgLoaded(page: Page) {
|
|
await page.waitForFunction(() => {
|
|
const images = Array.from(document.querySelectorAll("img"));
|
|
return images.every((img) => img.complete);
|
|
});
|
|
}
|