Add e2e tests for patch and issue counters

When creating a new patch or issue, we want the counters to reflect on
that on navigation.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2023-07-31 10:16:41 +02:00
committed by Rūdolfs Ošiņš
parent 1f5751dbcb
commit 99ec07e0a3
2 changed files with 69 additions and 0 deletions
+34
View File
@@ -19,6 +19,40 @@ test("navigate single issue", async ({ page }) => {
);
});
test("test issue counters", async ({ page, authenticatedPeer }) => {
const { rid, projectFolder } = await createProject(
authenticatedPeer,
"issue-counters",
);
await authenticatedPeer.rad(
[
"issue",
"open",
"--title",
"First issue to test counters",
"--description",
"Let's see",
],
{ cwd: projectFolder },
);
await page.goto(`${authenticatedPeer.uiUrl()}/${rid}/issues`);
await authenticatedPeer.rad(
[
"issue",
"open",
"--title",
"Second issue to test counters",
"--description",
"Let's see",
],
{ cwd: projectFolder },
);
await page.getByRole("button", { name: "1 open" }).click();
await expect(page.getByRole("button", { name: "2 issues" })).toBeVisible();
await expect(page.getByRole("button", { name: "2 open" })).toBeVisible();
await expect(page.locator(".issues-list .teaser")).toHaveCount(2);
});
test("test issue editing failing", async ({ page, authenticatedPeer }) => {
const { rid, projectFolder } = await createProject(
authenticatedPeer,
+35
View File
@@ -1,4 +1,5 @@
import { test, cobUrl, expect } from "@tests/support/fixtures.js";
import { createProject } from "@tests/support/project";
test("navigate listing", async ({ page }) => {
await page.goto(cobUrl);
@@ -37,6 +38,40 @@ test("navigate patch details", async ({ page }) => {
}
});
test("test patches counters", async ({ page, authenticatedPeer }) => {
const { rid, projectFolder, defaultBranch } = await createProject(
authenticatedPeer,
"patch-counters",
);
await authenticatedPeer.git(["switch", "-c", "feature-1"], {
cwd: projectFolder,
});
await authenticatedPeer.git(["commit", "--allow-empty", "-m", "1th"], {
cwd: projectFolder,
});
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
});
await page.goto(`${authenticatedPeer.uiUrl()}/${rid}/patches`);
await authenticatedPeer.git(["switch", defaultBranch], {
cwd: projectFolder,
});
await authenticatedPeer.git(["switch", "-c", "feature-2"], {
cwd: projectFolder,
});
await authenticatedPeer.git(["commit", "--allow-empty", "-m", "2nd"], {
cwd: projectFolder,
});
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
cwd: projectFolder,
});
await page.getByRole("button", { name: "1 open" }).click();
await expect(page.getByRole("button", { name: "2 patches" })).toBeVisible();
await expect(page.getByRole("button", { name: "2 open" })).toBeVisible();
await expect(page.locator(".patches-list .teaser")).toHaveCount(2);
});
test("use revision selector", async ({ page }) => {
await page.goto(`${cobUrl}/patches/0f3697fed2743549e3bf531e9fa81284a6de1466`);
await page.getByRole("link", { name: "Files" }).click();