mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2026-01-15 12:15:02 +00:00
Test searching
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import { test } from "@playwright/test";
|
||||
import { TEST_SEARCH, TEST_SEARCH_RESULT_TITLE } from "e2e/constants";
|
||||
import {
|
||||
clickSearchButton,
|
||||
disableWallpaper,
|
||||
loadApp,
|
||||
searchMenuIsHidden,
|
||||
searchMenuIsVisible,
|
||||
searchResultEntryIsVisible,
|
||||
typeInTaskbarSearchBar,
|
||||
} from "e2e/functions";
|
||||
|
||||
test.beforeEach(disableWallpaper);
|
||||
@@ -18,3 +21,10 @@ test.describe("can close", () => {
|
||||
await searchMenuIsHidden({ page });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("can search", () => {
|
||||
test("via 'All' tab", async ({ page }) => {
|
||||
await typeInTaskbarSearchBar(TEST_SEARCH, { page });
|
||||
await searchResultEntryIsVisible(TEST_SEARCH_RESULT_TITLE, { page });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -79,6 +79,8 @@ export const TASKBAR_ENTRY_SELECTOR = `${TASKBAR_ENTRIES_SELECTOR}>li`;
|
||||
export const TASKBAR_ENTRY_PEEK_SELECTOR = `${TASKBAR_ENTRY_SELECTOR}>div:not([title])`;
|
||||
export const TASKBAR_ENTRY_PEEK_IMAGE_SELECTOR = `${TASKBAR_ENTRY_PEEK_SELECTOR}>img`;
|
||||
export const SEARCH_MENU_SELECTOR = `${DESKTOP_SELECTOR}>nav[style]:not(:has(>ol))`;
|
||||
export const SEARCH_MENU_INPUT_SELECTOR = `${SEARCH_MENU_SELECTOR} input[placeholder='Type here to search']`;
|
||||
export const SEARCH_MENU_RESULTS_SELECTOR = `${SEARCH_MENU_SELECTOR}>div>.content>div>.list>figure>ol`;
|
||||
export const SEARCH_BUTTON_SELECTOR = `${TASKBAR_SELECTOR}>[title='Type here to search']`;
|
||||
export const START_BUTTON_SELECTOR = `${TASKBAR_SELECTOR}>[title=Start]`;
|
||||
export const START_MENU_SELECTOR = `${DESKTOP_SELECTOR}>nav[style]:has(>ol)`;
|
||||
@@ -226,6 +228,7 @@ export const TEST_ROOT_FILE_TOOLTIP =
|
||||
|
||||
export const TEST_SEARCH = "CREDITS";
|
||||
export const TEST_SEARCH_RESULT = /^CREDITS.md$/;
|
||||
export const TEST_SEARCH_RESULT_TITLE = /^\/CREDITS.md/;
|
||||
|
||||
export const NEW_FOLDER_LABEL = /^New folder$/;
|
||||
export const NEW_FILE_LABEL = /^New Text Document.txt$/;
|
||||
|
||||
@@ -47,6 +47,8 @@ import {
|
||||
WINDOW_SELECTOR,
|
||||
WINDOW_TITLEBAR_ICON_SELECTOR,
|
||||
WINDOW_TITLEBAR_SELECTOR,
|
||||
SEARCH_MENU_INPUT_SELECTOR,
|
||||
SEARCH_MENU_RESULTS_SELECTOR,
|
||||
} from "e2e/constants";
|
||||
|
||||
type TestProps = {
|
||||
@@ -387,6 +389,14 @@ export const typeInFileExplorerSearchBox = async (
|
||||
.getByLabel(FILE_EXPLORER_SEARCH_BOX_LABEL)
|
||||
.pressSequentially(text, { delay: TYPE_DELAY });
|
||||
|
||||
export const typeInTaskbarSearchBar = async (
|
||||
text: string,
|
||||
{ page }: TestProps
|
||||
): Promise<void> =>
|
||||
page
|
||||
.locator(SEARCH_MENU_INPUT_SELECTOR)
|
||||
.pressSequentially(text, { delay: TYPE_DELAY });
|
||||
|
||||
// expect->toHave
|
||||
export const pageHasTitle = async (
|
||||
title: string,
|
||||
@@ -601,6 +611,14 @@ export const fileExplorerNavButtonIsVisible = async (
|
||||
page.locator(FILE_EXPLORER_NAV_SELECTOR).getByLabel(label, EXACT)
|
||||
).toBeVisible();
|
||||
|
||||
export const searchResultEntryIsVisible = async (
|
||||
label: RegExp | string,
|
||||
{ page }: TestProps
|
||||
): Promise<void> =>
|
||||
expect(
|
||||
page.locator(SEARCH_MENU_RESULTS_SELECTOR).getByTitle(label)
|
||||
).toBeVisible();
|
||||
|
||||
export const taskbarEntryIsHidden = async (
|
||||
label: RegExp | string,
|
||||
{ page }: TestProps
|
||||
|
||||
Reference in New Issue
Block a user