mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 10:10:30 +08:00
Update heartwood fixture and re-enable tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
This commit is contained in:
+42
-24
@@ -2,6 +2,7 @@ import type { Page } from "@playwright/test";
|
||||
import {
|
||||
aliceMainHead,
|
||||
aliceRemote,
|
||||
bobRemote,
|
||||
expect,
|
||||
projectFixtureUrl,
|
||||
rid,
|
||||
@@ -251,17 +252,20 @@ test("clone modal", async ({ page }) => {
|
||||
});
|
||||
|
||||
test("peer and branch switching", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.goto(projectFixtureUrl);
|
||||
|
||||
// Alice's peer.
|
||||
{
|
||||
await page.getByTitle("Change peer").click();
|
||||
await page.locator("text=alice").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("alice delegate");
|
||||
if (process.env.HEARTWOOD) {
|
||||
await page.locator(`text=${aliceRemote}`).click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText(
|
||||
`${aliceRemote.substring(0, 6)}…${aliceRemote.slice(-6)}`,
|
||||
);
|
||||
} else {
|
||||
await page.locator("text=alice").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("alice delegate");
|
||||
}
|
||||
await expect(
|
||||
page.locator(
|
||||
`text=source-browsing / ${aliceRemote.substring(
|
||||
@@ -322,31 +326,45 @@ test("peer and branch switching", async ({ page }) => {
|
||||
// Bob's peer.
|
||||
{
|
||||
await page.getByTitle("Change peer").click();
|
||||
await page.locator("text=bob").click();
|
||||
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("bob");
|
||||
if (process.env.HEARTWOOD) {
|
||||
await page.locator(`text=${bobRemote}`).click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText(
|
||||
`${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)}`,
|
||||
);
|
||||
} else {
|
||||
await page.locator("text=bob").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("bob");
|
||||
}
|
||||
await expect(page.getByTitle("Change peer")).not.toHaveText("delegate");
|
||||
|
||||
// Default `main` branch.
|
||||
{
|
||||
await expect(page.getByTitle("Current branch")).toContainText(
|
||||
"main 2b32f6f",
|
||||
);
|
||||
await expectCounts({ commits: 9, contributors: 2 }, page);
|
||||
await expect(page.locator("text=2b32f6f Update readme")).toBeVisible();
|
||||
if (process.env.HEARTWOOD) {
|
||||
await expect(page.getByTitle("Current branch")).toContainText(
|
||||
"main 1e0bb83",
|
||||
);
|
||||
await expectCounts({ commits: 9, contributors: 2 }, page);
|
||||
await expect(page.locator("text=1e0bb83 Update readme")).toBeVisible();
|
||||
} else {
|
||||
await expect(page.getByTitle("Current branch")).toContainText(
|
||||
"main 2b32f6f",
|
||||
);
|
||||
await expectCounts({ commits: 9, contributors: 2 }, page);
|
||||
await expect(page.locator("text=2b32f6f Update readme")).toBeVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("only one modal can be open at a time", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.goto(projectFixtureUrl);
|
||||
|
||||
await page.getByTitle("Change peer").click();
|
||||
await page.locator(`text=alice ${aliceRemote.substring(0, 6)}`).click();
|
||||
if (process.env.HEARTWOOD) {
|
||||
await page.locator(`text=${aliceRemote.substring(0, 6)}`).click();
|
||||
} else {
|
||||
await page.locator(`text=alice ${aliceRemote.substring(0, 6)}`).click();
|
||||
}
|
||||
|
||||
await page.getByText("Clone").click();
|
||||
await expect(page.locator("text=Code font")).not.toBeVisible();
|
||||
@@ -363,7 +381,11 @@ 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=bob hyyzz9")).toBeVisible();
|
||||
if (process.env.HEARTWOOD) {
|
||||
await expect(page.locator(`text=${bobRemote}`)).toBeVisible();
|
||||
} else {
|
||||
await expect(page.locator("text=bob hyyzz9")).toBeVisible();
|
||||
}
|
||||
await expect(page.locator("text=feature/branch")).not.toBeVisible();
|
||||
|
||||
page.locator('button[name="Settings"]').click();
|
||||
@@ -374,10 +396,6 @@ test("only one modal can be open at a time", async ({ page }) => {
|
||||
});
|
||||
|
||||
test.describe("browser error handling", () => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
test("error appears when folder can't be loaded", async ({ page }) => {
|
||||
await page.route(
|
||||
`**/v1/projects/${ridPrefix}${rid}/tree/${aliceMainHead}/markdown/`,
|
||||
|
||||
@@ -5,16 +5,18 @@ import {
|
||||
bobRemote,
|
||||
} from "@tests/support/fixtures.js";
|
||||
|
||||
const modifiedFileFixture = `${projectFixtureUrl}/remotes/${bobRemote}/commits/2b32f6fe50090ebdb4cd7441e943330da3e6ff04`;
|
||||
const modifiedFileFixture = `${projectFixtureUrl}/remotes/${bobRemote}/commits/${
|
||||
process.env.HEARTWOOD
|
||||
? "1e0bb83a89b63da815f2fc24e7ae3c5ceb30e0eb"
|
||||
: "2b32f6fe50090ebdb4cd7441e943330da3e6ff04"
|
||||
}`;
|
||||
|
||||
test("navigation from commit list", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.goto(projectFixtureUrl);
|
||||
await page.getByTitle("Change peer").click();
|
||||
await page.locator("text=bob hyyzz9").click();
|
||||
await page
|
||||
.locator(process.env.HEARTWOOD ? `text=${bobRemote}` : "text=bob hyyzz9")
|
||||
.click();
|
||||
await page.locator('role=button[name="Commit count"]').click();
|
||||
|
||||
await page.locator("text=Update readme").click();
|
||||
@@ -22,10 +24,6 @@ test("navigation from commit list", async ({ page }) => {
|
||||
});
|
||||
|
||||
test("relative timestamps", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.addInitScript(() => {
|
||||
window.initializeTestStubs = () => {
|
||||
window.e2eTestStubs.FakeTimers.install({
|
||||
@@ -37,25 +35,33 @@ test("relative timestamps", async ({ page }) => {
|
||||
});
|
||||
await page.goto(modifiedFileFixture);
|
||||
await expect(
|
||||
page.locator(".commit header >> text=bob committed 22 hours ago"),
|
||||
page.locator(
|
||||
`.commit header >> text=${
|
||||
process.env.HEARTWOOD
|
||||
? "Bob Belcher committed now"
|
||||
: "bob committed 22 hours ago"
|
||||
}`,
|
||||
),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("modified file", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.goto(modifiedFileFixture);
|
||||
|
||||
// Commit header.
|
||||
{
|
||||
const header = page.locator(".commit header");
|
||||
await expect(header.locator("text=Update readme")).toBeVisible();
|
||||
await expect(header.locator("text=Verified")).toBeVisible();
|
||||
await expect(
|
||||
header.locator("text=2b32f6fe50090ebdb4cd7441e943330da3e6ff04"),
|
||||
).toBeVisible();
|
||||
if (!process.env.HEARTWOOD) {
|
||||
await expect(header.locator("text=Verified")).toBeVisible();
|
||||
await expect(
|
||||
header.locator("text=2b32f6fe50090ebdb4cd7441e943330da3e6ff04"),
|
||||
).toBeVisible();
|
||||
} else {
|
||||
await expect(
|
||||
header.locator("text=1e0bb83a89b63da815f2fc24e7ae3c5ceb30e0eb"),
|
||||
).toBeVisible();
|
||||
}
|
||||
}
|
||||
|
||||
// Diff header.
|
||||
@@ -71,10 +77,6 @@ test("modified file", async ({ page }) => {
|
||||
});
|
||||
|
||||
test("created file", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.goto(
|
||||
`${projectFixtureUrl}/remotes/${bobRemote}/commits/d6318f7f3d9c15b8ac6dd52267c53220d00f0982`,
|
||||
);
|
||||
@@ -85,10 +87,6 @@ test("created file", async ({ page }) => {
|
||||
});
|
||||
|
||||
test("deleted file", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.goto(
|
||||
`${projectFixtureUrl}/remotes/${bobRemote}/commits/cd13c2d9a8a930d64a82b6134b44d1b872e33662`,
|
||||
);
|
||||
|
||||
@@ -3,21 +3,25 @@ import {
|
||||
expect,
|
||||
projectFixtureUrl,
|
||||
bobRemote,
|
||||
aliceRemote,
|
||||
} from "@tests/support/fixtures.js";
|
||||
|
||||
test("peer and branch switching", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.goto(projectFixtureUrl);
|
||||
await page.locator('role=button[name="Commit count"]').click();
|
||||
|
||||
// Alice's peer.
|
||||
{
|
||||
await page.getByTitle("Change peer").click();
|
||||
await page.locator("text=alice hybg18").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("alice delegate");
|
||||
if (process.env.HEARTWOOD) {
|
||||
await page.locator(`text=${aliceRemote}`).click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText(
|
||||
`${aliceRemote.substring(0, 6)}…${aliceRemote.slice(-6)}`,
|
||||
);
|
||||
} else {
|
||||
await page.locator("text=alice hybg18").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("alice delegate");
|
||||
}
|
||||
|
||||
await expect(page.getByText("Thursday, November 17, 2022")).toBeVisible();
|
||||
await expect(
|
||||
@@ -60,13 +64,20 @@ test("peer and branch switching", async ({ page }) => {
|
||||
// Bob's peer.
|
||||
{
|
||||
await page.getByTitle("Change peer").click();
|
||||
await page.locator("text=bob hyyzz9").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("bob");
|
||||
if (process.env.HEARTWOOD) {
|
||||
await page.locator(`text=${bobRemote}`).click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText(
|
||||
`${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)}`,
|
||||
);
|
||||
} else {
|
||||
await page.locator("text=bob hyyzz9").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("bob");
|
||||
}
|
||||
|
||||
await expect(page.getByText("Tuesday, December 20, 2022")).toBeVisible();
|
||||
await expect(
|
||||
page.locator(".commit-group-headers").first().locator(".commit-teaser"),
|
||||
).toHaveCount(3);
|
||||
).toHaveCount(process.env.HEARTWOOD ? 1 : 3);
|
||||
|
||||
await expect(page.getByText("Thursday, November 17, 2022")).toBeVisible();
|
||||
await expect(
|
||||
@@ -75,8 +86,13 @@ test("peer and branch switching", async ({ page }) => {
|
||||
|
||||
await page.pause();
|
||||
const latestCommit = page.locator(".commit-teaser").first();
|
||||
await expect(latestCommit).toContainText("Update readme");
|
||||
await expect(latestCommit).toContainText("2b32f6f");
|
||||
if (process.env.HEARTWOOD) {
|
||||
await expect(latestCommit).toContainText("Update readme");
|
||||
await expect(latestCommit).toContainText("1e0bb83");
|
||||
} else {
|
||||
await expect(latestCommit).toContainText("Update readme");
|
||||
await expect(latestCommit).toContainText("2b32f6f");
|
||||
}
|
||||
|
||||
const earliestCommit = page.locator(".commit-teaser").last();
|
||||
await expect(earliestCommit).toContainText(
|
||||
@@ -87,32 +103,30 @@ test("peer and branch switching", async ({ page }) => {
|
||||
});
|
||||
|
||||
test("verified badge", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.goto(projectFixtureUrl);
|
||||
await page.locator('role=button[name="Commit count"]').click();
|
||||
|
||||
await page.getByTitle("Change peer").click();
|
||||
await page.locator("text=bob hyyzz9").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("bob");
|
||||
|
||||
await page.locator("text=Verified").hover();
|
||||
|
||||
await expect(
|
||||
page.locator(
|
||||
"text=This commit was signed with the committer's radicle key.",
|
||||
),
|
||||
).toBeVisible();
|
||||
await expect(page.locator(`text=bob committed ${bobRemote}`)).toBeVisible();
|
||||
if (process.env.HEARTWOOD) {
|
||||
await page.locator(`text=${bobRemote}`).click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText(
|
||||
`${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)}`,
|
||||
);
|
||||
} else {
|
||||
await page.locator("text=bob hyyzz9").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("bob");
|
||||
// not applicable to heartwood?
|
||||
await page.locator("text=Verified").hover();
|
||||
await expect(
|
||||
page.locator(
|
||||
"text=This commit was signed with the committer's radicle key.",
|
||||
),
|
||||
).toBeVisible();
|
||||
await expect(page.locator(`text=bob committed ${bobRemote}`)).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("relative timestamps", async ({ page }) => {
|
||||
if (process.env.HEARTWOOD) {
|
||||
test.skip();
|
||||
}
|
||||
|
||||
await page.addInitScript(() => {
|
||||
window.initializeTestStubs = () => {
|
||||
window.e2eTestStubs.FakeTimers.install({
|
||||
@@ -127,12 +141,21 @@ test("relative timestamps", async ({ page }) => {
|
||||
await page.locator('role=button[name="Commit count"]').click();
|
||||
|
||||
await page.getByTitle("Change peer").click();
|
||||
await page.locator("text=bob hyyzz9").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("bob");
|
||||
|
||||
const latestCommit = page.locator(".commit-teaser").first();
|
||||
await expect(latestCommit).toContainText("bob committed 22 hours ago");
|
||||
await expect(latestCommit).toContainText("2b32f6f");
|
||||
if (process.env.HEARTWOOD) {
|
||||
await page.locator(`text=${bobRemote}`).click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText(
|
||||
`${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)}`,
|
||||
);
|
||||
const latestCommit = page.locator(".commit-teaser").first();
|
||||
await expect(latestCommit).toContainText("Bob Belcher committed now");
|
||||
await expect(latestCommit).toContainText("1e0bb83");
|
||||
} else {
|
||||
await page.locator("text=bob hyyzz9").click();
|
||||
await expect(page.getByTitle("Change peer")).toHaveText("bob");
|
||||
const latestCommit = page.locator(".commit-teaser").first();
|
||||
await expect(latestCommit).toContainText("bob committed 22 hours ago");
|
||||
await expect(latestCommit).toContainText("2b32f6f");
|
||||
}
|
||||
|
||||
const earliestCommit = page.locator(".commit").last();
|
||||
await expect(earliestCommit).toContainText(
|
||||
|
||||
BIN
Binary file not shown.
@@ -168,9 +168,9 @@ export const aliceMainHead = "fcc929424b82984b7cbff9c01d2e20d9b1249842";
|
||||
export const aliceRemote = process.env.HEARTWOOD
|
||||
? "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"
|
||||
: "hybg18bc4cu8z9xtj44skxperfdpxpp1wp8zygyzti5kfiggdizfxy";
|
||||
|
||||
export const bobRemote =
|
||||
"hyyzz9w4ffg16zftjki3enajm4mkqkayb5ch1p6ns3f83np1hqkrp6";
|
||||
export const bobRemote = process.env.HEARTWOOD
|
||||
? "z6MksMTThc1aDU2Ztc43jJUivuyBLNWiLsDf4X65rABe7HbA"
|
||||
: "hyyzz9w4ffg16zftjki3enajm4mkqkayb5ch1p6ns3f83np1hqkrp6";
|
||||
export const rid = process.env.HEARTWOOD
|
||||
? "zKtT7DmF9H34KkvcKj9PHW19WzjT"
|
||||
: "hnrkdi8be7n4hhqoz9rpzrgd68u9dr3zsxgmy";
|
||||
@@ -179,5 +179,5 @@ export const projectFixtureUrl = `/seeds/0.0.0.0/${ridPrefix}${rid}`;
|
||||
export const seedPort = process.env.HEARTWOOD ? 8080 : "8777";
|
||||
export const seedVersion = process.env.HEARTWOOD ? "0.1.0" : "0.2.0";
|
||||
export const seedRemote = process.env.HEARTWOOD
|
||||
? "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"
|
||||
? "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8"
|
||||
: "hybuytx44z9cfsm5739wecia9j4b7expgc15qkazph59szp57m4d3o";
|
||||
|
||||
Reference in New Issue
Block a user