Add test for start menu icons
Some checks failed
Tests / tests (push) Has been cancelled

This commit is contained in:
Dustin Brett 2024-12-01 23:47:46 -08:00
parent 371ccc7277
commit fdf4e4b529
3 changed files with 19 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import {
searchMenuIsHidden,
searchMenuIsVisible,
startMenuContextIsOpen,
startMenuEntryHasIcon,
startMenuEntryIsVisible,
startMenuIsHidden,
startMenuIsVisible,
@ -93,6 +94,8 @@ test.describe("has files", () => {
for (const label of START_MENU_APPS) {
// eslint-disable-next-line no-await-in-loop
await startMenuEntryIsVisible(label, { page });
// eslint-disable-next-line no-await-in-loop
await startMenuEntryHasIcon(label, { page });
}
});

View File

@ -203,6 +203,7 @@ export const START_MENU_APPS = [
/^DevTools$/,
/^IRC$/,
/^Marked$/,
/^Messenger$/,
/^Monaco Editor$/,
/^Paint$/,
/^PDF$/,
@ -259,7 +260,7 @@ export const BASE_APP_TITLE = "daedalOS";
export const BASE_APP_FAVICON = /^\/favicon.ico$/;
export const BASE_APP_FAVICON_TEXT = "/favicon.ico";
export const UNKNOWN_ICON_PATH = "/System/Icons/48x48/unknown.png";
export const UNKNOWN_ICON_PATH = "/System/Icons/48x48/unknown.webp";
const OG_REQUIRED_TAGS = ["title", "image", "url", "type"];

View File

@ -606,6 +606,15 @@ const entryIsVisible = async (
expect(page.locator(selector).getByLabel(label, EXACT)).toBeVisible()
).toPass();
const entryHasIcon = async (
selector: string,
label: RegExp | string,
page: Page
): Promise<void> =>
expect(
page.locator(selector).getByLabel(label, EXACT).locator("img")
).not.toHaveAttribute("src", UNKNOWN_ICON_PATH);
export const desktopEntryIsVisible = async (
label: RegExp,
{ page }: TestProps
@ -689,6 +698,11 @@ export const startMenuEntryIsVisible = async (
{ page }: TestProps
): Promise<void> => entryIsVisible(START_MENU_SELECTOR, label, page);
export const startMenuEntryHasIcon = async (
label: RegExp | string,
{ page }: TestProps
): Promise<void> => entryHasIcon(START_MENU_SELECTOR, label, page);
export const startMenuSidebarEntryIsVisible = async (
label: RegExp,
{ page }: TestProps