mirror of
https://github.com/penpot/penpot.git
synced 2026-11-26 21:00:32 +00:00
Twelve specs of branches-library, merged-and-archived-branches, and pull-requests failed on iop-vc-preview before penpot#12780. They still asserted copy and flows that the branching UI work replaced on purpose: - The banner of a review now says "Reviewing the design review", and its cancel confirmation accepts with "Cancel design review". - The compare dialog is titled "Review changes". - A library's header says "Default branch". The popover adds the note "Read by library consumers" under the main row. - Restoring an archived branch asks for confirmation first. - A merge deletes its branch (penpot#12596), so neither the switcher nor the all-branches dialog lists merged branches. The specs now assert the current behaviour, including that no merged group or tab shows. AI-assisted-by: claude-opus-5-5
84 lines
2.9 KiB
JavaScript
84 lines
2.9 KiB
JavaScript
import { test, expect } from "@playwright/test";
|
|
import { WorkspacePage } from "../pages/WorkspacePage";
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await WorkspacePage.init(page);
|
|
await WorkspacePage.mockConfigFlags(page, ["enable-branching"]);
|
|
});
|
|
|
|
const setupBranching = async (workspacePage, rpcs) => {
|
|
await workspacePage.setupEmptyFile();
|
|
await workspacePage.mockRPCs({
|
|
"get-file-branch-info?file-id=*":
|
|
"pull-requests/get-file-branch-info-none.json",
|
|
"get-file-branches?file-id=*": "pull-requests/get-file-branches-empty.json",
|
|
"get-file-pull-requests?file-id=*":
|
|
"pull-requests/get-file-branches-empty.json",
|
|
...rpcs,
|
|
});
|
|
};
|
|
|
|
test("on a branch of a library, the header says consumers read main", async ({
|
|
page,
|
|
}) => {
|
|
const workspacePage = new WorkspacePage(page);
|
|
await setupBranching(workspacePage, {
|
|
"get-file-branch-info?file-id=*":
|
|
"pull-requests/get-file-branch-info-library-branch.json",
|
|
});
|
|
await workspacePage.goToWorkspace();
|
|
|
|
const chip = page.getByTitle(
|
|
"On branch checkout from main. Library consumers can adopt changes from main only.",
|
|
);
|
|
await expect(chip).toBeVisible();
|
|
|
|
// the popover says it under the main row
|
|
await chip.click();
|
|
await expect(page.getByText("Read by library consumers")).toBeVisible();
|
|
});
|
|
|
|
test("on a library, the create dialog says consumers read main", async ({
|
|
page,
|
|
}) => {
|
|
const workspacePage = new WorkspacePage(page);
|
|
await setupBranching(workspacePage, {
|
|
"get-file-branch-count?file-id=*":
|
|
"branches/get-file-branch-count-two.json",
|
|
"get-file-branches?file-id=*": "pull-requests/get-file-branches-one.json",
|
|
});
|
|
await workspacePage.mockGetFile("pull-requests/get-file-blank-shared.json");
|
|
await workspacePage.goToWorkspace();
|
|
|
|
await expect(page.getByText("Default branch", { exact: true })).toBeVisible();
|
|
|
|
// the header says only "Default branch": the popover adds the library note
|
|
await page.getByTitle("Switch branch").click();
|
|
await expect(page.getByText("Read by library consumers")).toBeVisible();
|
|
await page.getByText("New branch").click();
|
|
await expect(
|
|
page.getByText(
|
|
"files that use this library can adopt changes from main only",
|
|
),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("on an ordinary file, the create dialog keeps its note", async ({
|
|
page,
|
|
}) => {
|
|
const workspacePage = new WorkspacePage(page);
|
|
await setupBranching(workspacePage, {
|
|
"get-file-branch-count?file-id=*":
|
|
"branches/get-file-branch-count-two.json",
|
|
"get-file-branches?file-id=*": "pull-requests/get-file-branches-one.json",
|
|
});
|
|
await workspacePage.goToWorkspace();
|
|
|
|
await expect(page.getByText("Default branch", { exact: true })).toBeVisible();
|
|
|
|
await page.getByTitle("Switch branch").click();
|
|
await page.getByText("New branch").click();
|
|
await expect(page.getByText("isolated copy")).toBeVisible();
|
|
await expect(page.getByText("files that use this library")).toBeHidden();
|
|
});
|