mirror of
https://github.com/block/buzz.git
synced 2026-11-04 16:31:38 +00:00
test(projects): align merged workspace expectations
Co-authored-by: Wrench <0eabe6ea5758c1e4c5b68cea4ac42b32c479072883cb28da8110b4a47c32b9a1@buzz.block.builderlab.xyz> Signed-off-by: Wrench <0eabe6ea5758c1e4c5b68cea4ac42b32c479072883cb28da8110b4a47c32b9a1@buzz.block.builderlab.xyz>
This commit is contained in:
@@ -80,3 +80,50 @@ test("multi-repository commits remain visibly degraded when one repository fails
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test("multi-repository commits are merged in descending timestamp order", async () => {
|
||||
const { cleanup, render } = await import("@testing-library/react");
|
||||
const { ProjectHomeCommitsPanel } = await import(
|
||||
"./ProjectHomeCommitsPanel.tsx"
|
||||
);
|
||||
const React = await import("react");
|
||||
const result = (id, subject, timestamp) => ({
|
||||
error: null,
|
||||
isLoading: false,
|
||||
repository: repository(id, id),
|
||||
snapshot: {
|
||||
contributors: [],
|
||||
commits: [
|
||||
{
|
||||
hash: id.repeat(40),
|
||||
shortHash: id.repeat(7),
|
||||
authorName: id,
|
||||
authorEmail: `${id}@example.com`,
|
||||
timestamp,
|
||||
subject,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
render(
|
||||
React.createElement(ProjectHomeCommitsPanel, {
|
||||
onSelectCommit: () => {},
|
||||
projectId: "project-1",
|
||||
pullRequests: [],
|
||||
results: [
|
||||
result("a", "Older commit", 1),
|
||||
result("b", "Newer commit", 2),
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
document.body.textContent.indexOf("Newer commit") <
|
||||
document.body.textContent.indexOf("Older commit"),
|
||||
);
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -193,6 +193,7 @@ test("top-level project lists show metadata and overflow actions", async ({
|
||||
await page.getByTestId("projects-overview-create-issue").click();
|
||||
await expect(page.getByTestId("create-issue-repository")).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await page.getByRole("button", { name: "Reviews", exact: true }).click();
|
||||
const pullRequestRow = page
|
||||
.locator('[data-testid^="projects-pr-row-"]')
|
||||
.first();
|
||||
@@ -369,6 +370,12 @@ test("creating a project opens its channel conversation", async ({ page }) => {
|
||||
const repositoryAction = page
|
||||
.getByTestId("add-project-repository")
|
||||
.locator("..");
|
||||
await page.evaluate(() => {
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
});
|
||||
await page.mouse.move(1, 1);
|
||||
await expect(channelAction).toHaveCSS("opacity", "0");
|
||||
await expect(repositoryAction).toHaveCSS("opacity", "0");
|
||||
await page.getByTestId("project-home-context-channel").hover();
|
||||
@@ -839,14 +846,8 @@ test("commit detail opens from the commits feed with a diff", async ({
|
||||
.first();
|
||||
await expect(projectEntry).toBeVisible({ timeout: 10_000 });
|
||||
await projectEntry.click();
|
||||
const rootMessage = page
|
||||
.getByTestId("message-timeline")
|
||||
.getByTestId("message-row")
|
||||
.first();
|
||||
await expect(rootMessage).toBeVisible();
|
||||
await rootMessage.hover();
|
||||
await rootMessage.getByRole("button", { name: "Reply" }).click();
|
||||
await expect(page.getByTestId("focus-thread-drawer")).toBeVisible();
|
||||
await page.getByTestId("project-home-context-repo-buzz").click();
|
||||
await page.getByTestId("project-workspace-back").click();
|
||||
await page.getByTestId("project-home-context-tasks").click();
|
||||
await expect(page.getByTestId("project-home-workspace-sheet")).toBeVisible();
|
||||
const focusDrawer = page.getByTestId("focus-thread-drawer");
|
||||
|
||||
@@ -1166,7 +1166,7 @@ test("sidebar distinguishes the Projects overview from an open project", async (
|
||||
await projectsOverview.click();
|
||||
await expect(projectsOverview).toHaveAttribute("data-active", "true");
|
||||
await expect(sidebarProject).toHaveAttribute("data-active", "false");
|
||||
await expect(sidebarProject.locator("svg").first()).toHaveCSS(
|
||||
await expect(sidebarProject.getByTestId("project-channel-icon")).toHaveCSS(
|
||||
"opacity",
|
||||
"0.8",
|
||||
);
|
||||
@@ -1738,7 +1738,7 @@ test("project overview presents collapsible context beside grouped activity", as
|
||||
page
|
||||
.getByTestId("projects-overview-context-panel")
|
||||
.getByTestId("projects-overview-people"),
|
||||
).toHaveCount(0);
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page
|
||||
.getByTestId("projects-overview-stats-pod")
|
||||
@@ -1893,7 +1893,7 @@ test("project overview presents collapsible context beside grouped activity", as
|
||||
await expect(
|
||||
page.getByTestId("projects-overview-create-project"),
|
||||
).toBeVisible();
|
||||
await expect(page.getByTestId("projects-overview-people")).toHaveCount(0);
|
||||
await expect(page.getByTestId("projects-overview-people")).toBeVisible();
|
||||
await expect(page.getByTestId("projects-overview-activity")).toHaveCount(0);
|
||||
await page.getByTestId("projects-section-repositories").click();
|
||||
await expect(page.getByTestId("projects-overview-context-title")).toHaveText(
|
||||
@@ -1925,7 +1925,7 @@ test("project overview presents collapsible context beside grouped activity", as
|
||||
await expect(
|
||||
page.getByTestId("projects-overview-create-pull-request"),
|
||||
).toHaveAttribute("aria-label", "Create review");
|
||||
await expect(page.getByTestId("projects-overview-people")).toHaveCount(0);
|
||||
await expect(page.getByTestId("projects-overview-people")).toBeVisible();
|
||||
await expect(page.getByTestId("projects-overview-activity")).toHaveCount(0);
|
||||
await page.getByTestId("projects-section-all").click();
|
||||
await expect(
|
||||
@@ -1954,8 +1954,8 @@ test("project overview presents collapsible context beside grouped activity", as
|
||||
"data-project-context-detached",
|
||||
"true",
|
||||
);
|
||||
await expect(stats).toHaveCount(5);
|
||||
await expect(activityCards.first()).toBeVisible();
|
||||
await expect(stats).toHaveCount(3);
|
||||
await expect(activityCards).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("project overview chrome toggles a detached resizable agent chat", async ({
|
||||
@@ -2225,7 +2225,7 @@ test("selecting overview list rows switches the context pod to the cluster", asy
|
||||
"1 task",
|
||||
);
|
||||
await expect(page.getByTestId("projects-selection-summary")).toContainText(
|
||||
"Selection",
|
||||
"1 task",
|
||||
);
|
||||
await expect(page.getByTestId("projects-selection-items")).toHaveCount(0);
|
||||
await expect(page.getByTestId("projects-selection-clear")).toBeVisible();
|
||||
@@ -2677,8 +2677,8 @@ test("selecting repository workspace rows switches the context pod to the cluste
|
||||
expect(
|
||||
Math.abs(reviewRowOrder.checkbox - reviewRowOrder.status),
|
||||
).toBeLessThanOrEqual(1);
|
||||
expect(reviewRowOrder.status).toBeLessThan(reviewRowOrder.identifier);
|
||||
expect(reviewRowOrder.identifier).toBeLessThan(reviewRowOrder.title);
|
||||
expect(reviewRowOrder.status).toBeLessThan(reviewRowOrder.title);
|
||||
expect(reviewRowOrder.title).toBeLessThan(reviewRowOrder.identifier);
|
||||
await reviewRows.first().getByTestId("projects-row-select").click();
|
||||
await expect(
|
||||
reviewRows.first().getByTestId("project-work-item-status-icon"),
|
||||
|
||||
@@ -1031,12 +1031,12 @@ test("projects v3 workspace screenshot states", async ({ page }) => {
|
||||
).toBe(4);
|
||||
expect(
|
||||
Math.round((firstIssueBounds?.x ?? 0) - (issueHeaderBounds?.x ?? 0)),
|
||||
).toBe(0);
|
||||
).toBe(8);
|
||||
expect(
|
||||
Math.round(
|
||||
(issueHeaderBounds?.width ?? 0) - (firstIssueBounds?.width ?? 0),
|
||||
),
|
||||
).toBe(0);
|
||||
).toBe(16);
|
||||
expect(
|
||||
(secondIssueBounds?.y ?? 0) -
|
||||
((firstIssueBounds?.y ?? 0) + (firstIssueBounds?.height ?? 0)),
|
||||
@@ -1148,12 +1148,12 @@ test("projects v3 workspace screenshot states", async ({ page }) => {
|
||||
).toBe(4);
|
||||
expect(
|
||||
Math.round((firstReviewBounds?.x ?? 0) - (reviewHeaderBounds?.x ?? 0)),
|
||||
).toBe(0);
|
||||
).toBe(8);
|
||||
expect(
|
||||
Math.round(
|
||||
(reviewHeaderBounds?.width ?? 0) - (firstReviewBounds?.width ?? 0),
|
||||
),
|
||||
).toBe(0);
|
||||
).toBe(16);
|
||||
expect(
|
||||
(secondReviewBounds?.y ?? 0) -
|
||||
((firstReviewBounds?.y ?? 0) + (firstReviewBounds?.height ?? 0)),
|
||||
|
||||
Reference in New Issue
Block a user