* fix(ci): skip unrelated required checks cleanly Matrix jobs had to start no-op runners to preserve interpolated required-check names. Static named jobs let GitHub report genuine skipped conclusions while keeping those names stable. * fix(ci): gate changes to install patching script * fix(ci): route cross-package test contracts narrowly * fix(ci): keep routed contracts merge-blocking * fix(server): exclude nested test utilities from builds * fix(ci): cover app-owned native and browser domains * refactor(ci): align tests with runtime domains Own browser specs, desktop specs, and Electron-only app code by stable directories so PR routing does not depend on filename conventions. Keep desktop integration coverage inside the required desktop check. * fix(ci): keep routing and desktop suites isolated The routing regression must run before dependency installation, and desktop Vitest must not collect Playwright-owned specs. * fix(ci): isolate desktop e2e runtime * perf(test): isolate Playwright workers * perf(test): parallelize Playwright within specs * fix(test): keep Playwright file scheduling * fix(test): share dynamic Metro fixture * fix(test): preserve own-host restart fixtures * fix(ci): preserve routed contracts after rebase * Stabilize Playwright wheel-scroll assertions
85 lines
2.7 KiB
TypeScript
85 lines
2.7 KiB
TypeScript
import { expect, type Locator, type Page } from "@playwright/test";
|
|
|
|
export type AddProjectFlowPage =
|
|
| "host"
|
|
| "method"
|
|
| "directory-search"
|
|
| "github-search"
|
|
| "github-location"
|
|
| "new-directory-parent"
|
|
| "new-directory-name";
|
|
|
|
export type AddProjectMethod = "directory-search" | "browse" | "github" | "new-directory";
|
|
|
|
const METHOD_DESTINATIONS: Record<Exclude<AddProjectMethod, "browse">, AddProjectFlowPage> = {
|
|
"directory-search": "directory-search",
|
|
github: "github-search",
|
|
"new-directory": "new-directory-parent",
|
|
};
|
|
|
|
export function addProjectFlow(page: Page): Locator {
|
|
return page.getByTestId("add-project-flow");
|
|
}
|
|
|
|
export function addProjectFlowInput(page: Page): Locator {
|
|
return page.getByTestId("add-project-flow-input");
|
|
}
|
|
|
|
export function addProjectFlowBack(page: Page): Locator {
|
|
return page.getByTestId("add-project-flow-back");
|
|
}
|
|
|
|
export function addProjectFlowHost(page: Page, serverId: string): Locator {
|
|
return page.getByTestId(`add-project-flow-host-${serverId}`);
|
|
}
|
|
|
|
export function addProjectFlowMethod(page: Page, method: AddProjectMethod): Locator {
|
|
return page.getByTestId(`add-project-flow-method-${method}`);
|
|
}
|
|
|
|
export async function expectAddProjectPage(page: Page, kind: AddProjectFlowPage): Promise<Locator> {
|
|
const currentPage = page.getByTestId(`add-project-flow-page-${kind}`);
|
|
await expect(currentPage).toBeVisible({ timeout: 30_000 });
|
|
return currentPage;
|
|
}
|
|
|
|
export async function openAddProjectFlow(
|
|
page: Page,
|
|
expectedPage: "host" | "method" = "method",
|
|
): Promise<void> {
|
|
await page.getByTestId("sidebar-add-project").click();
|
|
await expect(addProjectFlow(page)).toBeVisible({ timeout: 30_000 });
|
|
await expectAddProjectPage(page, expectedPage);
|
|
await expect(addProjectFlowInput(page)).toBeFocused();
|
|
}
|
|
|
|
export async function chooseAddProjectMethod(page: Page, method: AddProjectMethod): Promise<void> {
|
|
const option = addProjectFlowMethod(page, method);
|
|
await expect(option).toBeVisible();
|
|
await option.click();
|
|
if (method !== "browse") {
|
|
await expectAddProjectPage(page, METHOD_DESTINATIONS[method]);
|
|
}
|
|
}
|
|
|
|
export async function expectNewWorkspaceForAddedProject(
|
|
page: Page,
|
|
input: {
|
|
serverId: string;
|
|
projectId: string;
|
|
projectName: string;
|
|
projectPath: string;
|
|
},
|
|
): Promise<void> {
|
|
await expect(page).toHaveURL(/\/new\?.*projectId=/u, { timeout: 30_000 });
|
|
const url = new URL(page.url());
|
|
expect(url.pathname).toBe("/new");
|
|
expect(url.searchParams.get("serverId")).toBe(input.serverId);
|
|
expect(url.searchParams.get("projectId")).toBe(input.projectId);
|
|
expect(url.searchParams.get("dir")).toBe(input.projectPath);
|
|
await expect(page.getByRole("button", { name: "Workspace project" })).toContainText(
|
|
input.projectName,
|
|
{ timeout: 30_000 },
|
|
);
|
|
}
|