diff --git a/src/components/Id.svelte b/src/components/Id.svelte index c768a7c4b..42a2fbfe6 100644 --- a/src/components/Id.svelte +++ b/src/components/Id.svelte @@ -9,7 +9,6 @@ import Icon from "./Icon.svelte"; export let id: string; - export let clipboard: string = id; export let shorten: boolean = true; export let style: "oid" | "commit" | "none" = "oid"; export let ariaLabel: string | undefined = undefined; @@ -26,7 +25,7 @@ }, 1000); async function copy() { - await toClipboard(clipboard); + await toClipboard(id); icon = "checkmark"; tooltip = "Copied to clipboard"; restoreIcon(); diff --git a/src/views/nodes/NodeAddress.svelte b/src/views/nodes/NodeAddress.svelte index 164b04ed2..604409380 100644 --- a/src/views/nodes/NodeAddress.svelte +++ b/src/views/nodes/NodeAddress.svelte @@ -13,7 +13,7 @@
- + {#if node.config?.externalAddresses.length} {truncateId(node.id)}@{node.config?.externalAddresses[0]} {:else} diff --git a/src/views/nodes/UserAgent.svelte b/src/views/nodes/UserAgent.svelte index 9123bd47c..462fdfca7 100644 --- a/src/views/nodes/UserAgent.svelte +++ b/src/views/nodes/UserAgent.svelte @@ -30,12 +30,7 @@
User Agent
- +
{agent}
diff --git a/tests/e2e/clipboard.spec.ts b/tests/e2e/clipboard.spec.ts index aa0ffa06a..b36e11d69 100644 --- a/tests/e2e/clipboard.spec.ts +++ b/tests/e2e/clipboard.spec.ts @@ -1,19 +1,11 @@ -import type { Page } from "@playwright/test"; - import { expect, sourceBrowsingUrl, sourceBrowsingRid, test, + cobUrl, } from "@tests/support/fixtures.js"; -async function expectClipboard(content: string, page: Page) { - const clipboardContent = await page.evaluate( - "navigator.clipboard.readText()", - ); - expect(clipboardContent).toBe(content); -} - // We explicitly run all clipboard tests withing the context of a single test // so that we don't run into race conditions, because there is no way to isolate // the clipboard in Playwright yet. @@ -25,6 +17,13 @@ test("copy to clipboard", async ({ page, browserName, context }) => { test.skip(); } + async function expectClipboard(content: string) { + const clipboardContent = await page.evaluate( + "navigator.clipboard.readText()", + ); + expect(clipboardContent).toBe(content); + } + await page.goto(sourceBrowsingUrl); // Reset system clipboard to a known state. @@ -33,17 +32,14 @@ test("copy to clipboard", async ({ page, browserName, context }) => { // Repo ID. { await page.getByLabel("repo-id").click(); - const clipboardContent = await page.evaluate( - "navigator.clipboard.readText()", - ); - expect(clipboardContent).toBe(sourceBrowsingRid); + await expectClipboard(sourceBrowsingRid); } // `rad clone` URL. { await page.getByRole("button", { name: "Clone" }).first().click(); await page.getByText("rad clone").locator(".clipboard").first().click(); - await expectClipboard(`rad clone ${sourceBrowsingRid}`, page); + await expectClipboard(`rad clone ${sourceBrowsingRid}`); } // `git clone` URL. @@ -55,10 +51,21 @@ test("copy to clipboard", async ({ page, browserName, context }) => { "rad:", "", )}.git source-browsing`, - page, ); } + // After switching the patch or issue listing the `` components should return new COB ids. + { + await page.goto(`${cobUrl}/patches`); + await page.getByRole("button", { name: "59a0821", exact: true }).click(); + await expectClipboard("59a0821edc73630bce540596cffc7854da557365"); + + await page.getByLabel("filter-dropdown").click(); + await page.getByRole("button", { name: "Draft" }).click(); + await page.getByRole("button", { name: "783d33c", exact: true }).click(); + await expectClipboard("783d33c5b14e13234d4d7affa98bd0b52d1b1ea3"); + } + // Clear the system clipboard contents so developers don't wonder why there's // random stuff in their clipboard after running tests. await page.evaluate("navigator.clipboard.writeText('')");