mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2026-01-15 12:15:02 +00:00
Fix test loading
This commit is contained in:
@@ -80,7 +80,7 @@ import { UNKNOWN_ICON } from "components/system/Files/FileManager/icons";
|
||||
|
||||
test.beforeEach(captureConsoleLogs());
|
||||
test.beforeEach(disableWallpaper);
|
||||
test.beforeEach(async ({ page }) => loadApp({ page }, { app: "FileExplorer" }));
|
||||
test.beforeEach(async ({ page }) => loadApp({ app: "FileExplorer" })({ page }));
|
||||
test.beforeEach(windowsAreVisible);
|
||||
test.beforeEach(fileExplorerEntriesAreVisible);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
|
||||
test.beforeEach(captureConsoleLogs());
|
||||
test.beforeEach(disableWallpaper);
|
||||
test.beforeEach(async ({ page }) => loadApp({ page }, { app: "Terminal" }));
|
||||
test.beforeEach(async ({ page }) => loadApp({ app: "Terminal" })({ page }));
|
||||
test.beforeEach(windowsAreVisible);
|
||||
test.beforeEach(terminalHasRows);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ test.describe("can open app", () => {
|
||||
|
||||
if (url) queryParams.url = url;
|
||||
|
||||
await loadApp({ page }, queryParams);
|
||||
await loadApp(queryParams)({ page });
|
||||
|
||||
// NOTE: Some apps fully load AFTER the window has transitioned
|
||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
|
||||
test.beforeEach(captureConsoleLogs());
|
||||
test.beforeEach(disableWallpaper);
|
||||
test.beforeEach(loadApp);
|
||||
test.beforeEach(loadApp());
|
||||
test.beforeEach(desktopIsVisible);
|
||||
|
||||
test("has file entry", desktopEntriesAreVisible);
|
||||
|
||||
@@ -4,7 +4,7 @@ import desktopIcons from "public/.index/desktopIcons.json";
|
||||
import { OG_TAGS } from "e2e/constants";
|
||||
import { loadApp } from "e2e/functions";
|
||||
|
||||
test.beforeEach(loadApp);
|
||||
test.beforeEach(loadApp());
|
||||
|
||||
test.describe("has correct tags", () => {
|
||||
test("has link preloads", async ({ page }) => {
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
|
||||
test.beforeEach(captureConsoleLogs());
|
||||
test.beforeEach(disableWallpaper);
|
||||
test.beforeEach(loadApp);
|
||||
test.beforeEach(loadApp());
|
||||
test.beforeEach(async ({ page }) => clickSearchButton({ page }));
|
||||
test.beforeEach(searchMenuIsVisible);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
|
||||
test.beforeEach(captureConsoleLogs());
|
||||
test.beforeEach(disableWallpaper);
|
||||
test.beforeEach(loadApp);
|
||||
test.beforeEach(loadApp());
|
||||
test.beforeEach(async ({ page }) => clickStartButton({ page }));
|
||||
test.beforeEach(startMenuIsVisible);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ test.beforeEach(captureConsoleLogs());
|
||||
test.beforeEach(disableWallpaper);
|
||||
|
||||
test.describe("elements", () => {
|
||||
test.beforeEach(loadApp);
|
||||
test.beforeEach(loadApp());
|
||||
test.beforeEach(taskbarIsVisible);
|
||||
|
||||
test.describe("has start button", () => {
|
||||
|
||||
@@ -49,7 +49,7 @@ test("can change background", async ({ headless, browserName, page }) => {
|
||||
test.describe("can set background", () => {
|
||||
test.beforeEach(disableWallpaper);
|
||||
test.beforeEach(async ({ page }) =>
|
||||
loadApp({ page }, { url: "/System/Icons/48x48" })
|
||||
loadApp({ url: "/System/Icons/48x48" })({ page })
|
||||
);
|
||||
test.beforeEach(windowsAreVisible);
|
||||
test.beforeEach(fileExplorerEntriesAreVisible);
|
||||
|
||||
@@ -32,6 +32,10 @@ export const EXCLUDED_CONSOLE_LOGS = (
|
||||
"Error while parsing the 'sandbox' attribute: 'allow-presentation' is an invalid sandbox flag.",
|
||||
'Viewport argument key "interactive-widget" not recognized and ignored.'
|
||||
);
|
||||
} else if (browserName === "firefox") {
|
||||
excludedConsoleLogs.push(
|
||||
"Found a sectioned h1 element with no specified font-size or margin properties."
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env.CI) {
|
||||
|
||||
@@ -985,33 +985,32 @@ export const selectArea = async ({
|
||||
};
|
||||
|
||||
// loaders
|
||||
export const loadApp = async (
|
||||
{ page }: TestProps,
|
||||
queryParams?: Record<string, string>
|
||||
): Promise<Response | null> => {
|
||||
await page.addInitScript((session) => {
|
||||
window.DEBUG_DEFAULT_SESSION = session;
|
||||
}, DEFAULT_SESSION);
|
||||
export const loadApp =
|
||||
(queryParams?: Record<string, string>) =>
|
||||
async ({ page }: TestProps): Promise<Response | null> => {
|
||||
await page.addInitScript((session) => {
|
||||
window.DEBUG_DEFAULT_SESSION = session;
|
||||
}, DEFAULT_SESSION);
|
||||
|
||||
return page.goto(
|
||||
queryParams ? `/?${new URLSearchParams(queryParams).toString()}` : "/"
|
||||
);
|
||||
};
|
||||
return page.goto(
|
||||
queryParams ? `/?${new URLSearchParams(queryParams).toString()}` : "/"
|
||||
);
|
||||
};
|
||||
|
||||
export const loadTestApp = async ({
|
||||
page,
|
||||
}: TestProps): Promise<Response | null> => loadApp({ page }, { app: TEST_APP });
|
||||
}: TestProps): Promise<Response | null> => loadApp({ app: TEST_APP })({ page });
|
||||
|
||||
export const loadContainerTestApp = async ({
|
||||
page,
|
||||
}: TestProps): Promise<Response | null> =>
|
||||
loadApp({ page }, { app: TEST_APP_CONTAINER_APP });
|
||||
loadApp({ app: TEST_APP_CONTAINER_APP })({ page });
|
||||
|
||||
export const loadAppWithCanvas = async ({
|
||||
headless,
|
||||
browserName,
|
||||
page,
|
||||
}: TestProps): Promise<void> => {
|
||||
await loadApp({ page });
|
||||
await loadApp()({ page });
|
||||
await backgroundCanvasMaybeIsVisible({ browserName, headless, page });
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "e2e/functions";
|
||||
|
||||
test.beforeEach(captureConsoleLogs());
|
||||
test.beforeEach(loadApp);
|
||||
test.beforeEach(loadApp());
|
||||
test.beforeEach(desktopEntriesAreVisible);
|
||||
test.beforeEach(taskbarIsVisible);
|
||||
test.beforeEach(startButtonIsVisible);
|
||||
|
||||
Reference in New Issue
Block a user