Add a new e2e test case for commit messages with double colons

This commit is contained in:
Sebastian Martinez
2024-06-03 20:31:50 +02:00
parent 655ccf1d0f
commit 29d340961b
6 changed files with 93 additions and 19 deletions
+25 -7
View File
@@ -1,8 +1,12 @@
import {
aliceMainCommitCount,
aliceMainCommitMessage,
aliceMainHead,
bobMainCommitCount,
cobUrl,
expect,
markdownUrl,
shortAliceHead,
shortBobHead,
sourceBrowsingRid,
sourceBrowsingUrl,
@@ -30,11 +34,15 @@ test("navigate to project", async ({ page }) => {
{
await expect(page.getByTitle("Change branch")).toBeVisible();
await expect(
page.getByRole("button", { name: "4a9f278 Add submodule" }).first(),
page
.getByRole("button", {
name: `${shortAliceHead} ${aliceMainCommitMessage}`,
})
.first(),
).toBeVisible();
await expect(
page.getByRole("link", {
name: "Commits 7",
name: `Commits ${aliceMainCommitCount}`,
}),
).toBeVisible();
}
@@ -54,7 +62,9 @@ test("navigate to project", async ({ page }) => {
test("show source tree at specific revision", async ({ page }) => {
await page.goto(sourceBrowsingUrl);
await page.getByRole("link", { name: "Commits 7" }).click();
await page
.getByRole("link", { name: `Commits ${aliceMainCommitCount}` })
.click();
await page
.locator(".teaser", { hasText: "335dd6d" })
@@ -290,11 +300,15 @@ test("peer and branch switching", async ({ page }) => {
{
await expect(page.getByTitle("Change branch")).toHaveText("main");
await expect(
page.getByRole("button", { name: "4a9f278 Add submodule" }).first(),
page
.getByRole("button", {
name: `${shortAliceHead} ${aliceMainCommitMessage}`,
})
.first(),
).toBeVisible();
await expect(
page.getByRole("link", {
name: "Commits 7",
name: `Commits ${aliceMainCommitCount}`,
}),
).toBeVisible();
}
@@ -347,7 +361,11 @@ test("peer and branch switching", async ({ page }) => {
await expect(page.getByTitle("Change branch")).toBeVisible();
await expect(
page.getByRole("button", { name: "4a9f278 Add submodule" }).first(),
page
.getByRole("button", {
name: `${shortAliceHead} ${aliceMainCommitMessage}`,
})
.first(),
).toBeVisible();
await expect(page.getByText("Git test repository")).toBeVisible();
}
@@ -369,7 +387,7 @@ test("peer and branch switching", async ({ page }) => {
).toBeVisible();
await expect(
page.getByRole("link", {
name: "Commits 8",
name: `Commits ${bobMainCommitCount}`,
}),
).toBeVisible();
await expect(
+4 -1
View File
@@ -1,6 +1,7 @@
import {
aliceRemote,
bobHead,
bobMainCommitCount,
expect,
shortBobHead,
sourceBrowsingUrl,
@@ -14,7 +15,9 @@ test("navigation from commit list", async ({ page }) => {
await page.goto(sourceBrowsingUrl);
await page.getByTitle("Change peer").click();
await page.getByRole("link", { name: "bob" }).click();
await page.getByRole("link", { name: "Commits 8" }).click();
await page
.getByRole("link", { name: `Commits ${bobMainCommitCount}` })
.click();
await page.getByText("Update readme").first().click();
await expect(page).toHaveURL(commitUrl);
+49 -7
View File
@@ -1,5 +1,8 @@
import {
aliceMainCommitCount,
aliceMainCommitMessage,
aliceMainHead,
bobMainCommitCount,
expect,
gitOptions,
shortBobHead,
@@ -11,7 +14,9 @@ import sinon from "sinon";
test("peer and branch switching", async ({ page }) => {
await page.goto(sourceBrowsingUrl);
await page.getByRole("link", { name: "Commits 7" }).click();
await page
.getByRole("link", { name: `Commits ${aliceMainCommitCount}` })
.click();
// Alice's peer.
{
@@ -25,10 +30,12 @@ test("peer and branch switching", async ({ page }) => {
await expect(page.getByTitle("Change peer")).toHaveText("alice Delegate");
await expect(page.getByText("Thursday, November 17, 2022")).toBeVisible();
await expect(page.locator(".list .teaser")).toHaveCount(7);
await expect(page.locator(".list .teaser")).toHaveCount(
aliceMainCommitCount,
);
const latestCommit = page.locator(".teaser").first();
await expect(latestCommit).toContainText("Add submodule");
await expect(latestCommit).toContainText(aliceMainCommitMessage);
await expect(latestCommit).toContainText(aliceMainHead.substring(0, 7));
const earliestCommit = page.locator(".teaser").last();
@@ -44,7 +51,7 @@ test("peer and branch switching", async ({ page }) => {
page.getByRole("button", { name: "feature/branch" }),
).toBeVisible();
await expect(page.getByText("Thursday, November 17, 2022")).toBeVisible();
await expect(page.locator(".list .teaser")).toHaveCount(9);
await expect(page.locator(".list .teaser")).toHaveCount(bobMainCommitCount);
await page.getByTitle("Change branch").click();
await page.getByText("orphaned-branch").click();
@@ -85,14 +92,47 @@ test("peer and branch switching", async ({ page }) => {
}
});
test("commit messages with double colon not converted into single colon", async ({
page,
}) => {
const commitMessage = "Verify that crate::DoubleColon::should_work()";
const shortCommit = "7babd25";
await page.goto(sourceBrowsingUrl);
await page
.getByRole("link", { name: `Commits ${aliceMainCommitCount}` })
.click();
await expect(
page.getByRole("button", {
name: `${shortCommit} ${commitMessage}`,
}),
).toBeVisible();
await expect(
page.getByRole("link", {
name: commitMessage,
exact: true,
}),
).toBeVisible();
await page
.getByRole("link", {
name: commitMessage,
exact: true,
})
.click();
await expect(page.getByText(commitMessage, { exact: true })).toBeVisible();
});
test("expand commit message", async ({ page }) => {
await page.goto(sourceBrowsingUrl);
await page.getByRole("link", { name: "Commits 7" }).click();
await page
.getByRole("link", { name: `Commits ${aliceMainCommitCount}` })
.click();
const commitToggle = page.getByRole("button", { name: "expand" }).first();
await commitToggle.click();
const expandedCommit = page.getByText(
"Signed-off-by: Alice Liddell <alice@radicle.xyz>",
"This shouldn't replace double colons with simple colons",
);
await expect(expandedCommit).toBeVisible();
@@ -111,7 +151,9 @@ test("relative timestamps", async ({ page }) => {
});
await page.goto(sourceBrowsingUrl);
await page.getByRole("link", { name: "Commits 7" }).click();
await page
.getByRole("link", { name: `Commits ${aliceMainCommitCount}` })
.click();
await page.getByTitle("Change peer").click();
await page.getByRole("link", { name: "bob" }).click();
+8 -2
View File
@@ -1,4 +1,5 @@
import {
aliceMainCommitCount,
aliceMainHead,
aliceRemote,
expect,
@@ -63,7 +64,10 @@ test.describe("project page navigation", () => {
.waitFor({ state: "hidden" });
await expect(page).toHaveURL(projectTreeURL);
await page.getByRole("link", { name: "Commits 7" }).click();
await page
.getByRole("link", { name: `Commits ${aliceMainCommitCount}` })
.click();
await expect(page).toHaveURL(
`${sourceBrowsingUrl}/history/${aliceMainHead}`,
);
@@ -86,7 +90,9 @@ test.describe("project page navigation", () => {
await page.getByText(".hidden").click();
await expect(page).toHaveURL(`${projectTreeURL}/tree/.hidden`);
await page.getByRole("link", { name: "Commits 7" }).click();
await page
.getByRole("link", { name: `Commits ${aliceMainCommitCount}` })
.click();
await expect(page).toHaveURL(`${sourceBrowsingUrl}/history`);
});
Binary file not shown.
+7 -2
View File
@@ -599,12 +599,17 @@ export async function createMarkdownFixture(peer: RadiclePeer) {
);
}
export const aliceMainHead = "4a9f278344b795afaef44c0d9effb35c4d794fba";
export const aliceMainHead = "7babd25a74eb3752ec24672b5edf0e7ecb4daf24";
export const aliceMainCommitMessage =
"Verify that crate::DoubleColon::should_work()";
export const aliceMainCommitCount = 8;
export const aliceRemote =
"did:key:z6MkqGC3nWZhYieEVTVDKW5v588CiGfsDSmRVG9ZwwWTvLSK";
export const shortAliceHead = formatCommit(aliceMainHead);
export const bobRemote =
"did:key:z6Mkg49NtQR2LyYRDCQFK4w1VVHqhypZSSRo7HsyuN7SV7v5";
export const bobHead = "79b0b2522c0d406d398cb5b7b381455294e1489f";
export const bobHead = "82f570ec909e77c7e1bb764f1429b1e01b1b4a90";
export const bobMainCommitCount = 9;
export const shortBobHead = formatCommit(bobHead);
export const sourceBrowsingRid = "rad:z4BwwjPCFNVP27FwVbDFgwVwkjcir";
export const cobRid = "rad:z3fpY7nttPPa6MBnAv2DccHzQJnqe";