mirror of
https://github.com/getpaseo/paseo.git
synced 2026-08-14 20:32:46 +00:00
Replace 21 raw page.locator/getByTestId/getByText calls in the spec body with named DSL operations in helpers/settings.ts. Each test body now reads as prose: open settings, navigate to section, expect content. New helpers: openCompactSettings, expectCompactSettingsList, expectSettingsSidebarVisible/Hidden/Sections, goBackInSettings, expectSettingsBackButton, clickSettingsBackToWorkspace, verifyLegacyHostSettingsRedirect, openCompactSettingsHost, expectHostSettingsUrl, expectAddHostMethodOptions, fillDirectHostUri, expectDirectHostFormValues, expectDirectHostSslEnabled, expectDirectHostUriValue/Hidden, expectDiagnosticsContent, expectAboutContent, expectGeneralContent. Export requireServerId from sidebar.ts so helpers encapsulate serverId logic — spec has no direct env reads. Also fix pre-existing typecheck error in use-keyboard-shortcuts.ts: cast action.route to the expo-router Href type at call sites.
22 lines
785 B
TypeScript
22 lines
785 B
TypeScript
import { expect, type Page } from "@playwright/test";
|
|
|
|
export function requireServerId(): string {
|
|
const serverId = process.env.E2E_SERVER_ID;
|
|
if (!serverId) {
|
|
throw new Error("E2E_SERVER_ID is not set (expected from Playwright globalSetup).");
|
|
}
|
|
return serverId;
|
|
}
|
|
|
|
export async function selectWorkspaceInSidebar(page: Page, workspaceId: string): Promise<void> {
|
|
const row = page.getByTestId(`sidebar-workspace-row-${requireServerId()}:${workspaceId}`);
|
|
await expect(row).toBeVisible({ timeout: 30_000 });
|
|
await row.click();
|
|
}
|
|
|
|
export async function expectWorkspaceListed(page: Page, name: string): Promise<void> {
|
|
await expect(
|
|
page.locator('[data-testid^="sidebar-workspace-row-"]').filter({ hasText: name }).first(),
|
|
).toBeVisible({ timeout: 30_000 });
|
|
}
|