Update test suite to latest heartwood

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
Co-authored-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Sebastian Martinez
2023-11-03 15:34:16 +01:00
committed by Rūdolfs Ošiņš
co-authored by Rūdolfs Ošiņš
parent ca70f91d2b
commit 38fbddeb21
8 changed files with 62 additions and 52 deletions
+2 -2
View File
@@ -98,7 +98,7 @@ describe("project", () => {
test("#getIssueById(id, issueId)", async () => {
await api.project.getIssueById(
cobRid,
"9cedac832f0791bea5c9cf8fa32db8a68c592166",
"d72196335761c1d5fa7883f6620e7334b34e38f9",
);
});
@@ -210,7 +210,7 @@ describe("project", () => {
test("#getPatchById(id, patchId)", async () => {
await api.project.getPatchById(
cobRid,
"687c3268119d23c5da32055c0b44c03e0e4088b8",
"679b2c84a8e15ce1f73c4c231b55431b89b2559a",
);
});
+2 -2
View File
@@ -473,10 +473,10 @@ test("internal file markdown link", async ({ page }) => {
test("diff selection de-select", async ({ page }) => {
await page.goto(
`${cobUrl}/patches/e35c10c370de7fb94e95dbdf05ab93000132683f?tab=changes#README.md:H0L0H0L3`,
`${cobUrl}/patches/1cd7fe9598c0a877c32c516bddb3de70dfb53366?tab=changes#README.md:H0L0H0L3`,
);
await page.getByText("Add subtitle to README").click();
await expect(page).toHaveURL(
`${cobUrl}/patches/e35c10c370de7fb94e95dbdf05ab93000132683f?tab=changes`,
`${cobUrl}/patches/1cd7fe9598c0a877c32c516bddb3de70dfb53366?tab=changes`,
);
});
+4 -4
View File
@@ -17,7 +17,7 @@ test("navigate single issue", async ({ page }) => {
await page.getByText("This title has markdown").click();
await expect(page).toHaveURL(
`${cobUrl}/issues/9cedac832f0791bea5c9cf8fa32db8a68c592166`,
`${cobUrl}/issues/d72196335761c1d5fa7883f6620e7334b34e38f9`,
);
});
@@ -39,7 +39,7 @@ test("adding and removing reactions", async ({ page, authenticatedPeer }) => {
{ cwd: projectFolder },
);
await page.goto(
`${authenticatedPeer.uiUrl()}/${rid}/issues/48af7d329e5b44ee8d348eeb7e341370243db9ad`,
`${authenticatedPeer.uiUrl()}/${rid}/issues/a9d83773ac2fb8f5f654640477b9225a684cb53f`,
);
const commentReactionToggle = page
.getByTitle("toggle-reaction-popover")
@@ -126,7 +126,7 @@ test("test issue editing failing", async ({ page, authenticatedPeer }) => {
);
await page.route(
`**/v1/projects/${rid}/issues/ad9114fa910c67f09ce5d42d12c31038eb40fc86`,
`**/v1/projects/${rid}/issues/ecd5f103110b08b93bede17163d35de1e1068148`,
route => {
if (route.request().method() !== "PATCH") {
void route.fallback();
@@ -137,7 +137,7 @@ test("test issue editing failing", async ({ page, authenticatedPeer }) => {
);
await page.goto(
`${authenticatedPeer.uiUrl()}/${rid}/issues/ad9114fa910c67f09ce5d42d12c31038eb40fc86`,
`${authenticatedPeer.uiUrl()}/${rid}/issues/ecd5f103110b08b93bede17163d35de1e1068148`,
);
await page.getByRole("button", { name: "Leave your comment" }).click();
+42 -32
View File
@@ -1,6 +1,16 @@
import type { ExecaReturnValue } from "execa";
import { test, cobUrl, expect } from "@tests/support/fixtures.js";
import { createProject } from "@tests/support/project";
function extractPatchId(cmdOutput: ExecaReturnValue<string>) {
const match = cmdOutput.stderr.match(/[0-9a-f]{40}/);
if (match) {
return match[0];
} else {
throw new Error("Could not get patch id");
}
}
test("navigate patch listing", async ({ page }) => {
await page.goto(cobUrl);
await page.getByRole("link", { name: "2 patches" }).click();
@@ -18,7 +28,7 @@ test("navigate patch details", async ({ page }) => {
await page.goto(`${cobUrl}/patches`);
await page.getByText("Add subtitle to README").click();
await expect(page).toHaveURL(
`${cobUrl}/patches/e35c10c370de7fb94e95dbdf05ab93000132683f`,
`${cobUrl}/patches/1cd7fe9598c0a877c32c516bddb3de70dfb53366`,
);
await page.getByRole("link", { name: "Add subtitle to README" }).click();
await expect(page).toHaveURL(
@@ -28,7 +38,7 @@ test("navigate patch details", async ({ page }) => {
{
await page.getByRole("link", { name: "Changes" }).click();
await expect(page).toHaveURL(
`${cobUrl}/patches/e35c10c370de7fb94e95dbdf05ab93000132683f?tab=changes`,
`${cobUrl}/patches/1cd7fe9598c0a877c32c516bddb3de70dfb53366?tab=changes`,
);
}
});
@@ -47,12 +57,12 @@ test("edit a patch", async ({ page, authenticatedPeer }) => {
cwd: projectFolder,
},
);
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
});
await page.goto(
`${authenticatedPeer.uiUrl()}/${rid}/patches/d41fbd28b06a5fac51a2ba9e05ad9dc885676d71`,
const patchId = extractPatchId(
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
}),
);
await page.goto(`${authenticatedPeer.uiUrl()}/${rid}/patches/${patchId}`);
await expect(page.getByRole("button", { name: "1 patch" })).toBeVisible();
await expect(page.getByText("open", { exact: true })).toBeVisible();
@@ -83,12 +93,12 @@ test("leave a comment and reply", async ({ page, authenticatedPeer }) => {
cwd: projectFolder,
},
);
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
});
await page.goto(
`${authenticatedPeer.uiUrl()}/${rid}/patches/d41fbd28b06a5fac51a2ba9e05ad9dc885676d71`,
const patchId = extractPatchId(
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
}),
);
await page.goto(`${authenticatedPeer.uiUrl()}/${rid}/patches/${patchId}`);
await page.getByRole("button", { name: "Leave your comment" }).click();
await page.getByPlaceholder("Leave your comment").fill("This is a comment");
await page.getByRole("button", { name: "Comment" }).click();
@@ -114,12 +124,12 @@ test("add and remove reactions", async ({ page, authenticatedPeer }) => {
cwd: projectFolder,
},
);
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
});
await page.goto(
`${authenticatedPeer.uiUrl()}/${rid}/patches/af4099f53e96e28824d6df13136feeae10190679`,
const patchId = extractPatchId(
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
}),
);
await page.goto(`${authenticatedPeer.uiUrl()}/${rid}/patches/${patchId}`);
await page.getByRole("button", { name: "Leave your comment" }).click();
await page.getByPlaceholder("Leave your comment").fill("This is a comment");
await page.getByRole("button", { name: "Comment" }).click();
@@ -156,12 +166,12 @@ test("change patch state", async ({ page, authenticatedPeer }) => {
cwd: projectFolder,
},
);
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
});
await page.goto(
`${authenticatedPeer.uiUrl()}/${rid}/patches/be66e6ccf14f603e9fec63a30db9dd24cc7adf4c`,
const patchId = extractPatchId(
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
}),
);
await page.goto(`${authenticatedPeer.uiUrl()}/${rid}/patches/${patchId}`);
await page.getByRole("button", { name: "Archive patch" }).first().click();
await expect(page.getByText("archived", { exact: true })).toBeVisible();
await expect(page.getByRole("button", { name: "0 patches" })).toBeVisible();
@@ -210,7 +220,7 @@ test("patches counters", async ({ page, authenticatedPeer }) => {
});
test("use revision selector", async ({ page }) => {
await page.goto(`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8`);
await page.goto(`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a`);
await page.getByRole("link", { name: "Changes" }).click();
// Validating the latest revision state
@@ -233,9 +243,9 @@ test("use revision selector", async ({ page }) => {
await page.getByRole("link", { name: "Changes" }).click();
// Switching to the initial revision
await page.getByText("Revision 0535843").click();
await page.getByText("Revision 2c2f036").click();
await expect(page.locator(".dropdown")).toBeVisible();
await page.getByRole("link", { name: "Revision 687c326" }).click();
await page.getByRole("link", { name: "Revision 679b2c8" }).click();
await expect(page.locator(".dropdown")).toBeHidden();
await expect(
@@ -243,12 +253,12 @@ test("use revision selector", async ({ page }) => {
).toBeHidden();
await expect(page).toHaveURL(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8/687c3268119d23c5da32055c0b44c03e0e4088b8?tab=changes`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a/679b2c84a8e15ce1f73c4c231b55431b89b2559a?tab=changes`,
);
});
test("navigate through revision diffs", async ({ page }) => {
await page.goto(`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8`);
await page.goto(`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a`);
const firstRevision = page.locator(".revision").first();
const secondRevision = page.locator(".revision").nth(1);
@@ -266,7 +276,7 @@ test("navigate through revision diffs", async ({ page }) => {
page.getByRole("link", { name: "Compare 38c225..9898da" }),
).toBeVisible();
await expect(page).toHaveURL(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8?diff=38c225e2a0b47ba59def211f4e4825c31d9463ec..9898da6155467adad511f63bf0fb5aa4156b92ef`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a?diff=38c225e2a0b47ba59def211f4e4825c31d9463ec..9898da6155467adad511f63bf0fb5aa4156b92ef`,
);
await page.goBack();
await secondRevision
@@ -274,14 +284,14 @@ test("navigate through revision diffs", async ({ page }) => {
.first()
.click();
await secondRevision
.getByRole("link", { name: "Compare to previous revision: 687c326" })
.getByRole("link", { name: "Compare to previous revision: 679b2c8" })
.click();
await expect(
page.getByRole("link", { name: "Compare 0dc373..9898da" }),
).toBeVisible();
await expect(page).toHaveURL(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8?diff=0dc373db601ccbcffa80dec932e4006516709ca6..9898da6155467adad511f63bf0fb5aa4156b92ef`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a?diff=0dc373db601ccbcffa80dec932e4006516709ca6..9898da6155467adad511f63bf0fb5aa4156b92ef`,
);
await page.goBack();
@@ -306,13 +316,13 @@ test("navigate through revision diffs", async ({ page }) => {
page.getByRole("link", { name: "Compare 38c225..0dc373" }),
).toBeVisible();
await expect(page).toHaveURL(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8?diff=38c225e2a0b47ba59def211f4e4825c31d9463ec..0dc373db601ccbcffa80dec932e4006516709ca6`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a?diff=38c225e2a0b47ba59def211f4e4825c31d9463ec..0dc373db601ccbcffa80dec932e4006516709ca6`,
);
}
});
test("view file navigation from changes tab", async ({ page }) => {
await page.goto(`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8`);
await page.goto(`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a`);
await page.getByRole("button", { name: "Changes" }).click();
await page.getByRole("button", { name: "View file" }).click();
await expect(page).toHaveURL(
+1 -1
View File
@@ -1 +1 @@
2011f2b06e7207498aa084a25583c3c96c782c2d
342b05f88d0ab9e81b03db9427b1d641cc5cb749
+6 -6
View File
@@ -23,7 +23,7 @@ test("issues page", async ({ page }) => {
});
test("issue page", async ({ page }) => {
await page.goto(`${cobUrl}/issues/9cedac832f0791bea5c9cf8fa32db8a68c592166`, {
await page.goto(`${cobUrl}/issues/d72196335761c1d5fa7883f6620e7334b34e38f9`, {
waitUntil: "networkidle",
});
await expect(page).toHaveScreenshot({ fullPage: true });
@@ -59,7 +59,7 @@ test("patches page", async ({ page }) => {
test("patch page", async ({ page }) => {
// Draft patch
await page.goto(
`${cobUrl}/patches/416d2f95f32a5fdee958172b724c8439ce5334e2`,
`${cobUrl}/patches/dc9d006aa7131b62c14d570d79e079bb130ed2ea`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot({ fullPage: true });
@@ -77,18 +77,18 @@ test("patch page", async ({ page }) => {
await expect(page).toHaveScreenshot({ fullPage: true });
// Open patch "Add subtitle to README"
await page.goto(
`${cobUrl}/patches/e35c10c370de7fb94e95dbdf05ab93000132683f`,
`${cobUrl}/patches/1cd7fe9598c0a877c32c516bddb3de70dfb53366`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot({ fullPage: true });
// Open patch "Taking another stab at the README"
await page.goto(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot({ fullPage: true });
await page.goto(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8?tab=changes`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a?tab=changes`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot({ fullPage: true });
@@ -100,6 +100,6 @@ test("failed diff loading for a specific revision", async ({ page }) => {
route => route.fulfill({ status: 500 }),
);
await page.goto(`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8`);
await page.goto(`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a`);
await expect(page).toHaveScreenshot({ fullPage: true });
});
+4 -4
View File
@@ -30,7 +30,7 @@ test("issues page", async ({ page }) => {
});
test("issue page", async ({ page }) => {
await page.goto(`${cobUrl}/issues/9cedac832f0791bea5c9cf8fa32db8a68c592166`, {
await page.goto(`${cobUrl}/issues/d72196335761c1d5fa7883f6620e7334b34e38f9`, {
waitUntil: "networkidle",
});
await expect(page).toHaveScreenshot({ fullPage: true });
@@ -66,7 +66,7 @@ test("patches page", async ({ page }) => {
test("patch page", async ({ page }) => {
// Draft patch
await page.goto(
`${cobUrl}/patches/416d2f95f32a5fdee958172b724c8439ce5334e2`,
`${cobUrl}/patches/dc9d006aa7131b62c14d570d79e079bb130ed2ea`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot({ fullPage: true });
@@ -84,12 +84,12 @@ test("patch page", async ({ page }) => {
await expect(page).toHaveScreenshot({ fullPage: true });
// Open patch
await page.goto(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot({ fullPage: true });
await page.goto(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8?tab=changes`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a?tab=changes`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot({ fullPage: true });
+1 -1
View File
@@ -64,7 +64,7 @@ test("diff selection", async ({ page }) => {
});
await page.goto(
`${cobUrl}/patches/687c3268119d23c5da32055c0b44c03e0e4088b8?tab=changes#README.md:H0L0H0L3`,
`${cobUrl}/patches/679b2c84a8e15ce1f73c4c231b55431b89b2559a?tab=changes#README.md:H0L0H0L3`,
);
await expect(page).toHaveScreenshot({ fullPage: true });
});