mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-10 10:25:03 +00:00
* fix(app): show default usage windows when no windows are pinned * fix(app): show only percentages in sidebar usage summaries * fix(client): restore usage source logos for released hosts * fix(app): restore the labeled footer line below sidebar items * fix(app): use History's host filter to pick the usage and plugin host The Usage screen, the compact usage sheet and plugin screens used a separate HostSwitcher trigger. They now use HostFilter without "All hosts", as the label manager does, and hide it with one host, as History does. * fix(app): save the usage host pick and show it in the sidebar summary Picking a host on the Usage screen or usage sheet was view state: it reset when the view closed, and the sidebar summary never read it. The pick is now a device-local usage preference. The summary and the screen show the picked host while it is connected, else the active workspace's host, else the first host. The usage fixture answers by request, since the summary and the screen each load reports and only a card's Refresh forces one. * test(app): expect plugin footer rows above the footer bottom line Add project moved to the bottom line with the icons, so footer rows sit above it, spanning Add project to Settings. * test(app): expect the saved usage host in stored settings * test(app): let usage settings specs share reports with the sidebar summary The sidebar summary loads reports on app start, so the settings specs answer by request instead of by order and read percents from the settings card.
93 lines
3.0 KiB
TypeScript
93 lines
3.0 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;
|
|
}
|
|
|
|
async function openAddProjectFlowSurface(
|
|
page: Page,
|
|
expectedPage: "host" | "method",
|
|
): Promise<void> {
|
|
await page.locator('[data-testid="sidebar-add-project"]:visible').click();
|
|
await expect(addProjectFlow(page)).toBeVisible({ timeout: 30_000 });
|
|
await expectAddProjectPage(page, expectedPage);
|
|
}
|
|
|
|
export async function openAddProjectFlow(page: Page): Promise<void> {
|
|
await openAddProjectFlowSurface(page, "method");
|
|
}
|
|
|
|
export async function openAddProjectHostSelection(page: Page): Promise<void> {
|
|
await openAddProjectFlowSurface(page, "host");
|
|
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 },
|
|
);
|
|
}
|