Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix failing e2e tests
Sebastian Martinez committed 2 years ago
commit 851a444b5d3bd07e5a286ef65e7283f965427396
parent a9eefd16450aaa1ee203f5d718c9789ec9aa40ec
7 files changed +41 -49
modified src/views/projects/Cob/AssigneeInput.svelte
@@ -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" />
modified src/views/projects/Cob/LabelInput.svelte
@@ -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>
modified tests/e2e/project.spec.ts
@@ -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(
modified tests/e2e/project/assignees.spec.ts
@@ -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();
});
modified tests/e2e/project/issues.spec.ts
@@ -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();
});
modified tests/support/fixtures.ts
@@ -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);
  },
modified tests/support/project.ts
@@ -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) {