mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 00:14:54 +00:00
An item stayed mounted across a project switch, and its Combobox kept the previous project's results (same query key, cached data) selectable until the next search returned, so an issue from the old project could set the branch and metadata on the new one. A Combobox cannot detect that its inline search now means another project, so the item host keys the items by host and project id. Items and their search results start fresh for the new target, and a mount effect sets up again after the model clears the branch and metadata.
111 lines
3.8 KiB
TypeScript
111 lines
3.8 KiB
TypeScript
import { expect, test } from "../support/fixtures";
|
|
import { withNewWorkspaceIssuesExample } from "../support/helpers/plugin-new-workspace-items";
|
|
|
|
for (const layout of [
|
|
{ name: "desktop", compact: false },
|
|
{ name: "compact", compact: true },
|
|
]) {
|
|
test(`a plugin's New workspace item sets the branch and metadata on ${layout.name}`, async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(page, { compact: layout.compact }, async (screen) => {
|
|
await screen.chooseWorktree();
|
|
await screen.chooseIssue("PAS-102 Crash on resume");
|
|
const created = await screen.createWorkspace();
|
|
expect(created.branch).toBe("pas-102-crash-on-resume");
|
|
expect(created.metadata).toEqual({ "new-workspace-issues.issue": "PAS-102" });
|
|
});
|
|
});
|
|
}
|
|
|
|
test("a branch chosen while Local applies once the user switches to a new worktree", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(page, { compact: false }, async (screen) => {
|
|
await screen.chooseIssue("PAS-101 Slow sidebar");
|
|
await screen.chooseWorktree();
|
|
const created = await screen.createWorkspace({ prompt: "" });
|
|
expect(created.branch).toBe("pas-101-slow-sidebar");
|
|
expect(created.metadata).toEqual({ "new-workspace-issues.issue": "PAS-101" });
|
|
});
|
|
});
|
|
|
|
test("a plugin's branch applies when the project has no default base to branch off", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(
|
|
page,
|
|
{ compact: false, detachedHead: true },
|
|
async (screen) => {
|
|
await screen.chooseWorktree();
|
|
await screen.chooseIssue("PAS-101 Slow sidebar");
|
|
const created = await screen.createWorkspace();
|
|
expect(created.branch).toBe("pas-101-slow-sidebar");
|
|
},
|
|
);
|
|
});
|
|
|
|
test("a branch and metadata chosen for one project are not sent for another", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(
|
|
page,
|
|
{ compact: false, otherProject: true },
|
|
async (screen) => {
|
|
await screen.chooseWorktree();
|
|
await screen.chooseIssue("PAS-101 Slow sidebar");
|
|
await screen.switchToOtherProject();
|
|
const created = await screen.createWorkspace();
|
|
expect(created.branch).not.toBe("pas-101-slow-sidebar");
|
|
expect(created.metadata ?? {}).toEqual({});
|
|
},
|
|
);
|
|
});
|
|
|
|
test("an item's Issue list does not keep the previous project's results after a project switch", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(
|
|
page,
|
|
{ compact: false, otherProject: true, searchesByProject: true },
|
|
async (screen) => {
|
|
await screen.openIssueList();
|
|
await screen.expectIssueListText(`Issue of ${screen.firstProjectName}`, true);
|
|
await screen.closeIssueList();
|
|
await screen.switchToOtherProject();
|
|
await screen.openIssueList();
|
|
await screen.expectIssueListText(`Issue of ${screen.firstProjectName}`, false);
|
|
},
|
|
);
|
|
});
|
|
|
|
test("an isolation set from a mount effect is remembered like a pick", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(
|
|
page,
|
|
{ compact: false, setsOnMount: true },
|
|
async (screen) => {
|
|
await screen.expectIsolation("worktree");
|
|
await screen.reopenWithoutPlugin();
|
|
await screen.expectIsolation("worktree");
|
|
},
|
|
);
|
|
});
|
|
|
|
test("an item can set the branch and metadata from its mount effect", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(
|
|
page,
|
|
{ compact: false, setsOnMount: true },
|
|
async (screen) => {
|
|
await screen.expectIsolation("worktree");
|
|
const created = await screen.createWorkspace();
|
|
expect(created.branch).toBe("set-on-mount");
|
|
expect(created.metadata).toEqual({ "new-workspace-issues.issue": "ON-MOUNT" });
|
|
},
|
|
);
|
|
});
|