Extract fixture URL

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2022-12-16 15:06:05 +01:00
parent 0b6d9586ee
commit 836b0ccc09
7 changed files with 57 additions and 61 deletions
+14 -13
View File
@@ -1,4 +1,9 @@
import { test, expect, appConfigWithFixture } from "@tests/support/fixtures.js";
import {
test,
expect,
appConfigWithFixture,
projectFixtureUrl,
} from "@tests/support/fixtures.js";
import {
expectBackAndForwardNavigationWorks,
expectUrlPersistsReload,
@@ -18,7 +23,7 @@ test("navigate between landing and project page", async ({ page }) => {
await page.locator("text=source-browsing").click();
await expect(page).toHaveURL(
"/#/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/530aabdcc80397af254bc488b767169b92496e81",
`/#${projectFixtureUrl}/tree/530aabdcc80397af254bc488b767169b92496e81`,
);
await expectBackAndForwardNavigationWorks("/#/", page);
@@ -31,7 +36,7 @@ test("navigation between seed and project pages", async ({ page }) => {
const project = page.locator(".project");
await project.click();
await expect(page).toHaveURL(
"/#/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/530aabdcc80397af254bc488b767169b92496e81",
`/#${projectFixtureUrl}/tree/530aabdcc80397af254bc488b767169b92496e81`,
);
await expectBackAndForwardNavigationWorks("/#/seeds/radicle.local", page);
@@ -45,13 +50,12 @@ test.describe("project page navigation", () => {
test("navigation between commit history and single commit", async ({
page,
}) => {
const projectHistoryURL =
"/#/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/history/530aabdcc80397af254bc488b767169b92496e81";
const projectHistoryURL = `/#${projectFixtureUrl}/history/530aabdcc80397af254bc488b767169b92496e81`;
await page.goto(projectHistoryURL);
await page.locator("text=Add Markdown cheat sheet").click();
await expect(page).toHaveURL(
"/#/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/commits/530aabdcc80397af254bc488b767169b92496e81",
`/#${projectFixtureUrl}/commits/530aabdcc80397af254bc488b767169b92496e81`,
);
await expectBackAndForwardNavigationWorks(projectHistoryURL, page);
@@ -59,15 +63,14 @@ test.describe("project page navigation", () => {
});
test("navigate between tree and commit history", async ({ page }) => {
const projectTreeURL =
"/#/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/530aabdcc80397af254bc488b767169b92496e81";
const projectTreeURL = `/#${projectFixtureUrl}/tree/530aabdcc80397af254bc488b767169b92496e81`;
await page.goto(projectTreeURL);
await expect(page).toHaveURL(projectTreeURL);
await page.locator('role=button[name="Commit count"]').click();
await expect(page).toHaveURL(
"/#/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/history/530aabdcc80397af254bc488b767169b92496e81",
`/#${projectFixtureUrl}/history/530aabdcc80397af254bc488b767169b92496e81`,
);
await expectBackAndForwardNavigationWorks(projectTreeURL, page);
@@ -75,8 +78,7 @@ test.describe("project page navigation", () => {
});
test("navigate project paths", async ({ page }) => {
const projectTreeURL =
"/#/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/530aabdcc80397af254bc488b767169b92496e81";
const projectTreeURL = `/#${projectFixtureUrl}/tree/530aabdcc80397af254bc488b767169b92496e81`;
await page.goto(projectTreeURL);
await expect(page).toHaveURL(projectTreeURL);
@@ -96,8 +98,7 @@ test.describe("project page navigation", () => {
});
test("navigate project paths with a selected peer", async ({ page }) => {
const projectTreeURL =
"/#/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/tree";
const projectTreeURL = `/#${projectFixtureUrl}/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/tree`;
await page.goto(projectTreeURL);
await expect(page).toHaveURL(projectTreeURL);
+14 -13
View File
@@ -1,4 +1,9 @@
import { test, expect, appConfigWithFixture } from "@tests/support/fixtures.js";
import {
test,
expect,
appConfigWithFixture,
projectFixtureUrl,
} from "@tests/support/fixtures.js";
import {
expectBackAndForwardNavigationWorks,
expectUrlPersistsReload,
@@ -12,7 +17,7 @@ test("navigate between landing and project page", async ({ page }) => {
await page.locator("text=source-browsing").click();
await expect(page).toHaveURL(
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/530aabdcc80397af254bc488b767169b92496e81",
`${projectFixtureUrl}/tree/530aabdcc80397af254bc488b767169b92496e81`,
);
await expectBackAndForwardNavigationWorks("/", page);
@@ -25,7 +30,7 @@ test("navigation between seed and project pages", async ({ page }) => {
const project = page.locator(".project");
await project.click();
await expect(page).toHaveURL(
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/530aabdcc80397af254bc488b767169b92496e81",
`${projectFixtureUrl}/tree/530aabdcc80397af254bc488b767169b92496e81`,
);
await expectBackAndForwardNavigationWorks("/seeds/radicle.local", page);
@@ -39,13 +44,12 @@ test.describe("project page navigation", () => {
test("navigation between commit history and single commit", async ({
page,
}) => {
const projectHistoryURL =
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/history/530aabdcc80397af254bc488b767169b92496e81";
const projectHistoryURL = `${projectFixtureUrl}/history/530aabdcc80397af254bc488b767169b92496e81`;
await page.goto(projectHistoryURL);
await page.locator("text=Add Markdown cheat sheet").click();
await expect(page).toHaveURL(
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/commits/530aabdcc80397af254bc488b767169b92496e81",
`${projectFixtureUrl}/commits/530aabdcc80397af254bc488b767169b92496e81`,
);
await expectBackAndForwardNavigationWorks(projectHistoryURL, page);
@@ -53,15 +57,14 @@ test.describe("project page navigation", () => {
});
test("navigate between tree and commit history", async ({ page }) => {
const projectTreeURL =
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/530aabdcc80397af254bc488b767169b92496e81";
const projectTreeURL = `${projectFixtureUrl}/tree/530aabdcc80397af254bc488b767169b92496e81`;
await page.goto(projectTreeURL);
await expect(page).toHaveURL(projectTreeURL);
await page.locator('role=button[name="Commit count"]').click();
await expect(page).toHaveURL(
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/history/530aabdcc80397af254bc488b767169b92496e81",
`${projectFixtureUrl}/history/530aabdcc80397af254bc488b767169b92496e81`,
);
await expectBackAndForwardNavigationWorks(projectTreeURL, page);
@@ -69,8 +72,7 @@ test.describe("project page navigation", () => {
});
test("navigate project paths", async ({ page }) => {
const projectTreeURL =
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/530aabdcc80397af254bc488b767169b92496e81";
const projectTreeURL = `${projectFixtureUrl}/tree/530aabdcc80397af254bc488b767169b92496e81`;
await page.goto(projectTreeURL);
await expect(page).toHaveURL(projectTreeURL);
@@ -90,8 +92,7 @@ test.describe("project page navigation", () => {
});
test("navigate project paths with a selected peer", async ({ page }) => {
const projectTreeURL =
"seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/tree";
const projectTreeURL = `${projectFixtureUrl}/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/tree`;
await page.goto(projectTreeURL);
await expect(page).toHaveURL(projectTreeURL);
+13 -16
View File
@@ -1,10 +1,7 @@
import type { Page } from "@playwright/test";
import { test, expect } from "@tests/support/fixtures.js";
import { test, expect, projectFixtureUrl } from "@tests/support/fixtures.js";
import { expectUrlPersistsReload } from "@tests/support/router";
const sourceBrowsingFixture =
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o";
async function expectCounts(
params: { commits: number; contributors: number },
page: Page,
@@ -18,7 +15,7 @@ async function expectCounts(
}
test("navigate to project", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
// Header.
{
@@ -54,7 +51,7 @@ test("navigate to project", async ({ page }) => {
});
test("show source tree at specific revision", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.locator('role=button[name="Commit count"]').click();
await page
@@ -70,7 +67,7 @@ test("show source tree at specific revision", async ({ page }) => {
});
test("source file highlighting", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.getByText("src/").click();
await page.getByText("true.c").click();
@@ -82,7 +79,7 @@ test("source file highlighting", async ({ page }) => {
});
test("navigate line numbers", async ({ page }) => {
await page.goto(`${sourceBrowsingFixture}/tree/main/markdown/cheatsheet.md`);
await page.goto(`${projectFixtureUrl}/tree/main/markdown/cheatsheet.md`);
await page.locator('role=button[name="Raw"]').click();
await page.locator('[href="#L5"]').click();
@@ -108,7 +105,7 @@ test("navigate line numbers", async ({ page }) => {
});
test("navigate deep file hierarchies", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
const sourceTree = page.locator(".source-tree");
@@ -151,7 +148,7 @@ test("navigate deep file hierarchies", async ({ page }) => {
});
test("files with special characters in the filename", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
const sourceTree = page.locator(".source-tree");
await sourceTree.getByText("special/").click();
@@ -195,7 +192,7 @@ test("files with special characters in the filename", async ({ page }) => {
});
test("binary files", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.getByText("bin/").click();
await page.getByText("true").click();
@@ -204,7 +201,7 @@ test("binary files", async ({ page }) => {
});
test("hidden files", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.getByText(".hidden").click();
@@ -212,7 +209,7 @@ test("hidden files", async ({ page }) => {
});
test("markdown files", async ({ page }) => {
await page.goto(`${sourceBrowsingFixture}/tree/main/markdown/cheatsheet.md`);
await page.goto(`${projectFixtureUrl}/tree/main/markdown/cheatsheet.md`);
await expect(
page.locator("text=This is intended as a quick reference and showcase."),
@@ -240,7 +237,7 @@ test("markdown files", async ({ page }) => {
});
test("peer and branch switching", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
// Alice's peer.
{
@@ -319,7 +316,7 @@ test("peer and branch switching", async ({ page }) => {
});
test("clone modal", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.getByText("Clone").click();
await expect(
@@ -335,7 +332,7 @@ test("clone modal", async ({ page }) => {
});
test("only one modal can be open at a time", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.getByTitle("Change peer").click();
await page.locator("text=alice hyn1mj").click();
+7 -9
View File
@@ -1,11 +1,9 @@
import { test, expect } from "@tests/support/fixtures.js";
import { test, expect, projectFixtureUrl } from "@tests/support/fixtures.js";
const sourceBrowsingFixture =
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o";
const modifiedFileFixture = `${sourceBrowsingFixture}/remotes/hyy1k6ggg45pi7ip7ksyn1wt1ob4w5zh1awtg4qu3cxmbh5mws8pj1/commits/0be0f0302269b362be0bfe72aa4843eceaac5e3f`;
const modifiedFileFixture = `${projectFixtureUrl}/remotes/hyy1k6ggg45pi7ip7ksyn1wt1ob4w5zh1awtg4qu3cxmbh5mws8pj1/commits/0be0f0302269b362be0bfe72aa4843eceaac5e3f`;
test("navigation from commit list", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.getByTitle("Change peer").click();
await page.locator("text=bob hyy1k6").click();
await page.locator('role=button[name="Commit count"]').click();
@@ -55,7 +53,7 @@ test("modified file", async ({ page }) => {
test("created file", async ({ page }) => {
await page.goto(
`${sourceBrowsingFixture}/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/commits/d6318f7f3d9c15b8ac6dd52267c53220d00f0982`,
`${projectFixtureUrl}/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/commits/d6318f7f3d9c15b8ac6dd52267c53220d00f0982`,
);
await expect(
page.locator("text=1 file(s) created with 9 addition(s) and 0 deletion(s)"),
@@ -65,7 +63,7 @@ test("created file", async ({ page }) => {
test("deleted file", async ({ page }) => {
await page.goto(
`${sourceBrowsingFixture}/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/commits/cd13c2d9a8a930d64a82b6134b44d1b872e33662`,
`${projectFixtureUrl}/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/commits/cd13c2d9a8a930d64a82b6134b44d1b872e33662`,
);
await expect(
page.locator("text=1 file(s) deleted with 0 addition(s) and 1 deletion(s)"),
@@ -75,7 +73,7 @@ test("deleted file", async ({ page }) => {
test("navigation to source tree at specific revision", async ({ page }) => {
await page.goto(
`${sourceBrowsingFixture}/commits/0801aceeab500033f8d608778218657bd626ef73`,
`${projectFixtureUrl}/commits/0801aceeab500033f8d608778218657bd626ef73`,
);
// Go to source tree at this revision.
@@ -84,7 +82,7 @@ test("navigation to source tree at specific revision", async ({ page }) => {
page.locator("text=Add a deeply nested directory tree"),
).toBeVisible();
await expect(page).toHaveURL(
`${sourceBrowsingFixture}/tree/0801aceeab500033f8d608778218657bd626ef73/deep/directory/hierarchy/is/entirely/possible/in/git/repositories/.gitkeep`,
`${projectFixtureUrl}/tree/0801aceeab500033f8d608778218657bd626ef73/deep/directory/hierarchy/is/entirely/possible/in/git/repositories/.gitkeep`,
);
await expect(page.getByTitle("Current branch")).toContainText(
"0801aceeab500033f8d608778218657bd626ef73",
+4 -7
View File
@@ -1,10 +1,7 @@
import { test, expect } from "@tests/support/fixtures.js";
const sourceBrowsingFixture =
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o";
import { test, expect, projectFixtureUrl } from "@tests/support/fixtures.js";
test("peer and branch switching", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.locator('role=button[name="Commit count"]').click();
// Alice's peer.
@@ -79,7 +76,7 @@ test("peer and branch switching", async ({ page }) => {
});
test("verified badge", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.locator('role=button[name="Commit count"]').click();
await page.getByTitle("Change peer").click();
@@ -111,7 +108,7 @@ test("relative timestamps", async ({ page }) => {
};
});
await page.goto(sourceBrowsingFixture);
await page.goto(projectFixtureUrl);
await page.locator('role=button[name="Commit count"]').click();
await page.getByTitle("Change peer").click();
+2 -3
View File
@@ -1,7 +1,6 @@
import { test, expect } from "@tests/support/fixtures.js";
import { test, expect, projectFixtureUrl } from "@tests/support/fixtures.js";
const sourceBrowsingFixture =
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o/tree/main/src/true.c";
const sourceBrowsingFixture = `${projectFixtureUrl}/tree/main/src/true.c`;
test("default settings", async ({ page }) => {
await page.goto(sourceBrowsingFixture);
+3
View File
@@ -177,3 +177,6 @@ export function appConfigWithFixture() {
},
};
}
export const projectFixtureUrl =
"/seeds/0.0.0.0/rad:git:hnrkgd7sjt79k4j59ddh11ooxg18rk7soej8o";