Fix failing e2e tests

We had e2e tests failing for the new Assignee and LabelInput components,
and due to the changes to the SeedButton.
This commit is contained in:
Sebastian Martinez
2023-12-21 14:25:15 +01:00
parent a9eefd1645
commit 851a444b5d
7 changed files with 41 additions and 49 deletions
+3 -1
View File
@@ -115,13 +115,14 @@
placeholder="Add assignee"
on:submit={addAssignee} />
<IconButton
title="discard assignee"
on:click={() => {
inputValue = "";
showInput = false;
}}>
<IconSmall name="cross" />
</IconButton>
<IconButton on:click={addAssignee}>
<IconButton title="save assignee" on:click={addAssignee}>
<IconSmall name="checkmark" />
</IconButton>
</div>
@@ -129,6 +130,7 @@
<Badge
variant="outline"
size="small"
title="add assignee"
round
on:click={() => (showInput = true)}>
<IconSmall name="plus" />
+4 -2
View File
@@ -80,7 +80,7 @@
size="small"
style="cursor: pointer;"
on:click={() => (removeToggles[label] = !removeToggles[label])}>
<div aria-label="chip" class="label">{label}</div>
<div class="label">{label}</div>
{#if removeToggles[label]}
<IconButton title="remove label">
<IconSmall name="cross" on:click={() => removeLabel(label)} />
@@ -100,13 +100,14 @@
bind:value={inputValue}
on:submit={addLabel} />
<IconButton
title="discard label"
on:click={() => {
inputValue = "";
showInput = false;
}}>
<IconSmall name="cross" />
</IconButton>
<IconButton on:click={addLabel}>
<IconButton title="save label" on:click={addLabel}>
<IconSmall name="checkmark" />
</IconButton>
</div>
@@ -114,6 +115,7 @@
<Badge
variant="outline"
size="small"
title="add labels"
round
on:click={() => (showInput = true)}>
<IconSmall name="plus"></IconSmall>
+3 -3
View File
@@ -66,7 +66,7 @@ test("navigate to project", async ({ page }) => {
await expect(page.getByText("Git test repository")).toBeVisible();
// Number of nodes seeding this project.
await expect(page.getByText("Seeding 3")).toBeVisible();
await expect(page.getByText("Seed 3")).toBeVisible();
});
test("show source tree at specific revision", async ({ page }) => {
@@ -411,7 +411,7 @@ test.describe("browser error handling", () => {
const sourceTree = page.locator(".source-tree");
await sourceTree.getByText("src").click();
await expect(page.getByText("File not found")).toBeVisible();
await expect(page.getByText("No README found.")).toBeVisible();
});
test("error appears when file can't be loaded", async ({ page }) => {
await page.route(
@@ -431,7 +431,7 @@ test.describe("browser error handling", () => {
);
await page.goto(sourceBrowsingUrl);
await expect(page.getByText("File not found")).toBeVisible();
await expect(page.getByText("No README found.")).toBeVisible();
});
test("error appears when navigating to missing file", async ({ page }) => {
await page.route(
+11 -20
View File
@@ -24,21 +24,18 @@ test("add and remove assignees", async ({ page, authenticatedPeer }) => {
})
.click();
await expect(page.getByText("No assignees")).toBeVisible();
await page.getByRole("button", { name: "edit assignees" }).click();
await page.getByRole("button", { name: "add assignee" }).click();
await page
.getByPlaceholder("Add assignee")
.fill("z6MktULudTtAsAhRegYPiZ6631RV3viv12qd4GQF8z1xB22S");
await page.getByRole("button", { name: "dismiss changes" }).click();
await expect(page.getByText("No assignees")).toBeVisible();
await page.getByRole("button", { name: "edit assignees" }).click();
await expect(page.getByPlaceholder("Add assignee")).toHaveValue("");
await page.getByRole("button", { name: "discard assignee" }).click();
await page.getByRole("button", { name: "add assignee" }).click();
await page
.getByPlaceholder("Add assignee")
.fill("z6MktULudTtAsAhRegYPiZ6631RV3viv12qd4GQF8z1xB22S");
await page.keyboard.press("Enter");
await page.getByRole("button", { name: "add assignee" }).click();
await page
.getByPlaceholder("Add assignee")
.fill("z6MktULudTtAsAhRegYPiZ6631RV3viv12qd4GQF8z1xB22S");
@@ -50,10 +47,6 @@ test("add and remove assignees", async ({ page, authenticatedPeer }) => {
.getByPlaceholder("Add assignee")
.fill("z6MkkfM3tPXNPrPevKr3uSiQtHPuwnNhu2yUVjgd2jXVsVz5");
await page.keyboard.press("Enter");
await page.getByRole("button", { name: "save assignees" }).click();
await expect(
page.getByRole("button", { name: "save assignees" }),
).toBeHidden();
await expect(
page.getByRole("button", { name: "avatar did:key:z6MktU…1xB22S" }),
).toBeVisible();
@@ -61,18 +54,16 @@ test("add and remove assignees", async ({ page, authenticatedPeer }) => {
page.getByRole("button", { name: "avatar did:key:z6Mkkf…XVsVz5" }),
).toBeVisible();
await page.getByRole("button", { name: "edit assignees" }).click();
await page
.getByRole("button", {
name: "avatar did:key:z6MktU…1xB22S remove assignee",
})
.getByTitle("remove assignee")
.getByRole("button", { name: "avatar did:key:z6MktU…1xB22S" })
.click();
await page
.getByRole("button", { name: "remove assignee", exact: true })
.click();
await page.getByRole("button", { name: "save assignees" }).click();
await expect(
page.getByRole("button", { name: "save assignees" }),
).toBeHidden();
await expect(
page.getByRole("button", { name: "avatar did:key:z6Mkkf…XVsVz5" }),
).toBeVisible();
await expect(
page.getByRole("button", { name: "avatar did:key:z6MktU…1xB22S" }),
).toBeHidden();
});
+10 -5
View File
@@ -68,13 +68,18 @@ test("create a new issue", async ({ page, authenticatedPeer }) => {
.getByPlaceholder("Write a description")
.fill("This is a description");
await page.getByRole("button", { name: "add assignee" }).click();
await page.getByPlaceholder("Add assignee").fill(authenticatedPeer.nodeId);
await page.getByPlaceholder("Add assignee").press("Enter");
await page.keyboard.press("Enter");
await page.getByRole("button", { name: "add label" }).click();
await page.getByPlaceholder("Add label").fill("bug");
await page.getByPlaceholder("Add label").press("Enter");
await page.keyboard.press("Enter");
await page.getByRole("button", { name: "add label" }).click();
await page.getByPlaceholder("Add label").fill("documentation");
await page.getByPlaceholder("Add label").press("Enter");
await page.keyboard.press("Enter");
await page.getByRole("button", { name: "Submit" }).click();
await expect(page.getByText("This is a title")).toBeVisible();
@@ -88,7 +93,7 @@ test("create a new issue", async ({ page, authenticatedPeer }) => {
),
).toBeVisible();
await expect(
page.locator(".badge").filter({ hasText: "documentation" }),
page.getByRole("button", { name: "documentation" }),
).toBeVisible();
await expect(page.locator(".badge").filter({ hasText: "bug" })).toBeVisible();
await expect(page.getByRole("button", { name: "bug" })).toBeVisible();
});
+1 -1
View File
@@ -168,7 +168,7 @@ export const test = base.extend<{
`Failed to get authentication URL from: ${stdout}`,
);
await page.goto(match[1]);
await page.getByText("Successfully authenticated").waitFor();
await page.getByRole("button", { name: "avatar httpd" }).waitFor();
await use(peer);
},
+9 -17
View File
@@ -92,17 +92,14 @@ export async function expectThreadCommentingToWork(page: Page) {
}
export async function expectLabelEditingToWork(page: Page) {
await expect(page.getByText("No labels")).toBeVisible();
await page.getByRole("button", { name: "edit labels" }).click();
await page.getByRole("button", { name: "add labels" }).click();
await page.getByPlaceholder("Add label").fill("bug");
await page.getByRole("button", { name: "dismiss changes" }).click();
await expect(page.getByText("No labels")).toBeVisible();
await page.getByRole("button", { name: "edit labels" }).click();
await expect(page.getByPlaceholder("Add label")).toHaveValue("");
await page.getByRole("button", { name: "discard label" }).click();
await page.getByRole("button", { name: "add labels" }).click();
await page.getByPlaceholder("Add label").fill("bug");
await page.keyboard.press("Enter");
await page.getByRole("button", { name: "add labels" }).click();
await page.getByPlaceholder("Add label").fill("bug");
await expect(page.getByText("This label is already added")).toBeVisible();
await page.getByPlaceholder("Add label").clear();
@@ -110,22 +107,17 @@ export async function expectLabelEditingToWork(page: Page) {
await page.getByPlaceholder("Add label").fill("documentation");
await page.keyboard.press("Enter");
await page.getByRole("button", { name: "save labels" }).click();
await expect(page.getByRole("button", { name: "save labels" })).toBeHidden();
await expect(page.getByRole("button", { name: "bug" })).toBeVisible();
await expect(
page.getByRole("button", { name: "documentation" }),
).toBeVisible();
await page.getByRole("button", { name: "edit labels" }).click();
await page
.locator("span")
.filter({ hasText: "documentation" })
.getByTitle("remove label")
.click();
await page.getByRole("button", { name: "save labels" }).click();
await expect(page.getByRole("button", { name: "save labels" })).toBeHidden();
await page.getByRole("button", { name: "documentation" }).click();
await page.getByRole("button", { name: "remove label", exact: true }).click();
await expect(page.getByRole("button", { name: "bug" })).toBeVisible();
await expect(
page.getByRole("button", { name: "documentation" }),
).toBeHidden();
}
export async function expectReactionsToWork(page: Page) {