From fdf4e4b529876370509db1a0df86b98d9ffc32f2 Mon Sep 17 00:00:00 2001 From: Dustin Brett Date: Sun, 1 Dec 2024 23:47:46 -0800 Subject: [PATCH] Add test for start menu icons --- e2e/components/system/StartMenu.spec.ts | 3 +++ e2e/constants.ts | 3 ++- e2e/functions.ts | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/e2e/components/system/StartMenu.spec.ts b/e2e/components/system/StartMenu.spec.ts index a5522ac136..762d889bc6 100644 --- a/e2e/components/system/StartMenu.spec.ts +++ b/e2e/components/system/StartMenu.spec.ts @@ -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 }); } }); diff --git a/e2e/constants.ts b/e2e/constants.ts index c465c78fbf..bfe16bfdc9 100644 --- a/e2e/constants.ts +++ b/e2e/constants.ts @@ -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"]; diff --git a/e2e/functions.ts b/e2e/functions.ts index 4ba4fd81ec..428910a918 100644 --- a/e2e/functions.ts +++ b/e2e/functions.ts @@ -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 => + 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 => entryIsVisible(START_MENU_SELECTOR, label, page); +export const startMenuEntryHasIcon = async ( + label: RegExp | string, + { page }: TestProps +): Promise => entryHasIcon(START_MENU_SELECTOR, label, page); + export const startMenuSidebarEntryIsVisible = async ( label: RegExp, { page }: TestProps