Skip to content

Commit

Permalink
Add test for start menu icons
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinBrett committed Dec 2, 2024
1 parent 371ccc7 commit fdf4e4b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions e2e/components/system/StartMenu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
searchMenuIsHidden,
searchMenuIsVisible,
startMenuContextIsOpen,
startMenuEntryHasIcon,
startMenuEntryIsVisible,
startMenuIsHidden,
startMenuIsVisible,
Expand Down Expand Up @@ -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 });
}
});

Expand Down
3 changes: 2 additions & 1 deletion e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export const START_MENU_APPS = [
/^DevTools$/,
/^IRC$/,
/^Marked$/,
/^Messenger$/,
/^Monaco Editor$/,
/^Paint$/,
/^PDF$/,
Expand Down Expand Up @@ -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"];

Expand Down
14 changes: 14 additions & 0 deletions e2e/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fdf4e4b

Please sign in to comment.