diff --git a/scripts/create-seed-fixture b/scripts/create-seed-fixture index 376dd1b48..7a28f07cb 100755 --- a/scripts/create-seed-fixture +++ b/scripts/create-seed-fixture @@ -40,7 +40,7 @@ export RAD_HOME=$PALM_RAD_HOME export RAD_SEED=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee rad auth -radicle-node --listen 0.0.0.0:3446 --git-daemon 0.0.0.0:4446 & +radicle-node --listen 0.0.0.0:3446 --git-daemon 0.0.0.0:4446 --tracking-policy track --tracking-scope all & ### ALICE ### diff --git a/scripts/run-httpd-with-fixtures b/scripts/run-httpd-with-fixtures index c6804cf66..2e9500fb5 100755 --- a/scripts/run-httpd-with-fixtures +++ b/scripts/run-httpd-with-fixtures @@ -1,7 +1,7 @@ #!/bin/bash set -e -REV=f1de61ad8897a845f2be49e3e2b2951bc678b678 +REV=646376828d0520035246ccbbfcb82127160cd184 REPO_ROOT=$(git rev-parse --show-toplevel) FIXTURE=$REPO_ROOT/tests/fixtures/seeds/palm.tar.bz2 diff --git a/src/lib/api.ts b/src/lib/api.ts index 4ffc3ce89..f3ea0e8be 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -11,7 +11,7 @@ export class Request { constructor(path: string, api: Host) { this.port = api.port; - this.base = `${api.scheme}://${api.host}/api`; + this.base = `${api.scheme}://${api.host}/api/v1`; this.path = path.startsWith("/") ? path.slice(1) : path; } @@ -89,7 +89,7 @@ export class Request { // Creates a URL with an eventual query string and port. private createUrl(search?: string): string { - const baseUrl = this.path ? `${this.base}/v1/${this.path}` : this.base; + const baseUrl = this.path ? `${this.base}/${this.path}` : this.base; const url = new URL(search ? `${baseUrl}?${search}` : baseUrl); url.port = String(this.port); diff --git a/src/lib/project.ts b/src/lib/project.ts index 2a3889ae9..96bf0f454 100644 --- a/src/lib/project.ts +++ b/src/lib/project.ts @@ -77,7 +77,7 @@ export interface Person { export interface Peer { id: string; - person?: Person; + heads: Branches; delegate: boolean; } diff --git a/src/lib/utils.ts b/src/lib/utils.ts index ff026e4b9..ef9634996 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -107,7 +107,7 @@ export function formatRepositoryId(id: string): string { } export function truncateId(pubkey: string): string { - return `${pubkey.substring(0, 6) + "…" + pubkey.slice(-6)}`; + return `${pubkey.substring(0, 6)}…${pubkey.slice(-6)}`; } export function formatCommit(oid: string): string { diff --git a/src/views/projects/PeerSelector.svelte b/src/views/projects/PeerSelector.svelte index 0f6e5aae3..8fba1940c 100644 --- a/src/views/projects/PeerSelector.svelte +++ b/src/views/projects/PeerSelector.svelte @@ -94,7 +94,10 @@ {/if} {:else if peer} - {formatNodeId(peer)} + + did:key: + {truncateId(peer)} + {/if} diff --git a/tests/e2e/hashRouter.spec.ts b/tests/e2e/hashRouter.spec.ts index 4b1624b6a..3274e1ed6 100644 --- a/tests/e2e/hashRouter.spec.ts +++ b/tests/e2e/hashRouter.spec.ts @@ -94,7 +94,9 @@ test.describe("project page navigation", () => { }); test("navigate project paths with a selected peer", async ({ page }) => { - const projectTreeURL = `/#${projectFixtureUrl}/remotes/${aliceRemote}`; + const projectTreeURL = `/#${projectFixtureUrl}/remotes/${aliceRemote.substring( + 8, + )}`; await page.goto(projectTreeURL); await expect(page).toHaveURL(projectTreeURL); diff --git a/tests/e2e/historyRouter.spec.ts b/tests/e2e/historyRouter.spec.ts index 5f7336529..79a786b17 100644 --- a/tests/e2e/historyRouter.spec.ts +++ b/tests/e2e/historyRouter.spec.ts @@ -90,7 +90,9 @@ test.describe("project page navigation", () => { }); test("navigate project paths with a selected peer", async ({ page }) => { - const projectTreeURL = `${projectFixtureUrl}/remotes/${aliceRemote}`; + const projectTreeURL = `${projectFixtureUrl}/remotes/${aliceRemote.substring( + 8, + )}`; await page.goto(projectTreeURL); await expect(page).toHaveURL(projectTreeURL); diff --git a/tests/e2e/project.spec.ts b/tests/e2e/project.spec.ts index b2735b49f..e199934f9 100644 --- a/tests/e2e/project.spec.ts +++ b/tests/e2e/project.spec.ts @@ -256,16 +256,17 @@ test("peer and branch switching", async ({ page }) => { // Alice's peer. { await page.getByTitle("Change peer").click(); - await page.locator(`text=${aliceRemote.substring(0, 6)}`).click(); + await page.locator(`text=${aliceRemote}`).click(); await expect(page.getByTitle("Change peer")).toHaveText( - ` did:key: ${aliceRemote.substring(0, 6)}…${aliceRemote.slice(-6)} `, + ` did:key: ${aliceRemote + .substring(8) + .substring(0, 6)}…${aliceRemote.slice(-6)} `, ); await expect( page.locator( - `text=source-browsing / did:key:${aliceRemote.substring( - 0, - 6, - )}…${aliceRemote.slice(-6)}`, + `text=source-browsing / did:key:${aliceRemote + .substring(8) + .substring(0, 6)}…${aliceRemote.slice(-6)}`, ), ).toBeVisible(); @@ -320,9 +321,11 @@ test("peer and branch switching", async ({ page }) => { // Bob's peer. { await page.getByTitle("Change peer").click(); - await page.locator(`text=${bobRemote.substring(0, 6)}`).click(); + await page.locator(`text=${bobRemote}`).click(); await expect(page.getByTitle("Change peer")).toHaveText( - ` did:key: ${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)} `, + ` did:key: ${bobRemote.substring(8).substring(0, 6)}…${bobRemote.slice( + -6, + )} `, ); await expect(page.getByTitle("Change peer")).not.toHaveText("delegate"); @@ -341,7 +344,7 @@ test("only one modal can be open at a time", async ({ page }) => { await page.goto(projectFixtureUrl); await page.getByTitle("Change peer").click(); - await page.locator(`text=${aliceRemote.substring(0, 6)}`).click(); + await page.locator(`text=${aliceRemote}`).click(); await page.getByText("Clone").click(); await expect(page.locator("text=Code font")).not.toBeVisible(); @@ -358,7 +361,7 @@ test("only one modal can be open at a time", async ({ page }) => { await page.getByTitle("Change peer").click(); await expect(page.locator("text=Code font")).not.toBeVisible(); await expect(page.locator("text=Use the Radicle CLI")).not.toBeVisible(); - await expect(page.locator(`text=${bobRemote.substring(0, 6)}`)).toBeVisible(); + await expect(page.locator(`text=${bobRemote}`)).toBeVisible(); await expect(page.locator("text=feature/branch")).not.toBeVisible(); await page.locator('button[name="Settings"]').click(); diff --git a/tests/e2e/project/commit.spec.ts b/tests/e2e/project/commit.spec.ts index 6e288b91c..a7a7d9fcb 100644 --- a/tests/e2e/project/commit.spec.ts +++ b/tests/e2e/project/commit.spec.ts @@ -5,12 +5,14 @@ import { bobRemote, } from "@tests/support/fixtures.js"; -const modifiedFileFixture = `${projectFixtureUrl}/remotes/${bobRemote}/commits/${"1e0bb83a89b63da815f2fc24e7ae3c5ceb30e0eb"}`; +const modifiedFileFixture = `${projectFixtureUrl}/remotes/${bobRemote.substring( + 8, +)}/commits/1e0bb83a89b63da815f2fc24e7ae3c5ceb30e0eb`; test("navigation from commit list", async ({ page }) => { await page.goto(projectFixtureUrl); await page.getByTitle("Change peer").click(); - await page.locator(`text=${bobRemote.substring(0, 6)}`).click(); + await page.locator(`text=${bobRemote}`).click(); await page.locator('role=button[name="Commit count"]').click(); await page.locator("text=Update readme").click(); diff --git a/tests/e2e/project/commits.spec.ts b/tests/e2e/project/commits.spec.ts index b4ba30261..44c01bc97 100644 --- a/tests/e2e/project/commits.spec.ts +++ b/tests/e2e/project/commits.spec.ts @@ -13,9 +13,11 @@ test("peer and branch switching", async ({ page }) => { // Alice's peer. { await page.getByTitle("Change peer").click(); - await page.locator(`text=${aliceRemote.substring(0, 6)}`).click(); + await page.locator(`text=${aliceRemote}`).click(); await expect(page.getByTitle("Change peer")).toHaveText( - `did:key: ${aliceRemote.substring(0, 6)}…${aliceRemote.slice(-6)} `, + ` did:key: ${aliceRemote + .substring(8) + .substring(0, 6)}…${aliceRemote.slice(-6)} `, ); await expect(page.getByText("Thursday, November 17, 2022")).toBeVisible(); @@ -61,9 +63,11 @@ test("peer and branch switching", async ({ page }) => { // Bob's peer. { await page.getByTitle("Change peer").click(); - await page.locator(`text=${bobRemote.substring(0, 6)}`).click(); - await expect(page.getByTitle("Change peer")).toHaveText( - `did:key: ${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)} `, + await page.locator(`text=${bobRemote}`).click(); + await expect(page.getByTitle("Change peer")).toContainText( + ` did:key: ${bobRemote.substring(8).substring(0, 6)}…${bobRemote.slice( + -6, + )} `, ); await expect(page.getByText("Tuesday, December 20, 2022")).toBeVisible(); @@ -104,9 +108,11 @@ test("relative timestamps", async ({ page }) => { await page.locator('role=button[name="Commit count"]').click(); await page.getByTitle("Change peer").click(); - await page.locator(`text=${bobRemote.substring(0, 6)}`).click(); + await page.locator(`text=${bobRemote}`).click(); await expect(page.getByTitle("Change peer")).toHaveText( - `did:key: ${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)} `, + ` did:key: ${bobRemote.substring(8).substring(0, 6)}…${bobRemote.slice( + -6, + )} `, ); const latestCommit = page.locator(".commit-teaser").first(); await expect(latestCommit).toContainText("Bob Belcher committed now"); diff --git a/tests/fixtures/seeds/palm.tar.bz2 b/tests/fixtures/seeds/palm.tar.bz2 index e492b95ab..78c25d57f 100644 Binary files a/tests/fixtures/seeds/palm.tar.bz2 and b/tests/fixtures/seeds/palm.tar.bz2 differ diff --git a/tests/support/fixtures.ts b/tests/support/fixtures.ts index 293db3465..17e9dcf78 100644 --- a/tests/support/fixtures.ts +++ b/tests/support/fixtures.ts @@ -170,10 +170,12 @@ export function appConfigWithFixture() { } export const aliceMainHead = "fcc929424b82984b7cbff9c01d2e20d9b1249842"; -export const aliceRemote = "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"; -export const bobRemote = "z6MksMTThc1aDU2Ztc43jJUivuyBLNWiLsDf4X65rABe7HbA"; +export const aliceRemote = + "did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"; +export const bobRemote = + "did:key:z6MksMTThc1aDU2Ztc43jJUivuyBLNWiLsDf4X65rABe7HbA"; export const rid = "rad:zKtT7DmF9H34KkvcKj9PHW19WzjT"; export const projectFixtureUrl = `/seeds/0.0.0.0/${rid}`; export const seedPort = 8080; -export const seedVersion = "0.1.0"; +export const seedVersion = "0.1.0-6463768"; export const seedRemote = "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8"; diff --git a/tests/support/globalSetup.ts b/tests/support/globalSetup.ts index b47ebe3ac..e98a11485 100644 --- a/tests/support/globalSetup.ts +++ b/tests/support/globalSetup.ts @@ -16,7 +16,7 @@ async function assertHttpApiRunning(): Promise { let nodeId: string | undefined = undefined; try { - const response = await fetch(`http://0.0.0.0:${seedPort}/api`); + const response = await fetch(`http://0.0.0.0:${seedPort}/api/v1`); const data = await response.json(); nodeId = data.node.id; } catch (err) { diff --git a/tests/visual/project.spec.ts b/tests/visual/project.spec.ts index c889f824a..94d6109e6 100644 --- a/tests/visual/project.spec.ts +++ b/tests/visual/project.spec.ts @@ -21,9 +21,12 @@ test("commits page", async ({ page }) => { }; }); - await page.goto(`${projectFixtureUrl}/remotes/${aliceRemote}/history`, { - waitUntil: "networkidle", - }); + await page.goto( + `${projectFixtureUrl}/remotes/${aliceRemote.substring(8)}/history`, + { + waitUntil: "networkidle", + }, + ); await expect(page).toHaveScreenshot({ fullPage: true }); }); @@ -40,7 +43,9 @@ test("commit page", async ({ page }) => { }); await page.goto( - `${projectFixtureUrl}/remotes/${aliceRemote}/commits/d6318f7f3d9c15b8ac6dd52267c53220d00f0982`, + `${projectFixtureUrl}/remotes/${aliceRemote.substring( + 8, + )}/commits/d6318f7f3d9c15b8ac6dd52267c53220d00f0982`, ); await expect(page.locator("text=subconscious.txt added")).toBeVisible(); await expect(page).toHaveScreenshot({ fullPage: true });