Add error handling for issue creation and commenting

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2023-07-04 14:14:29 +02:00
parent 3e797a2d08
commit 0cd42908e5
4 changed files with 191 additions and 28 deletions
+38
View File
@@ -1,4 +1,5 @@
import { test, cobUrl, expect } from "@tests/support/fixtures.js";
import { createProject } from "@tests/support/project";
test("navigate issue listing", async ({ page }) => {
await page.goto(cobUrl);
@@ -17,3 +18,40 @@ test("navigate single issue", async ({ page }) => {
`${cobUrl}/issues/4fc727e722d3979fd2073d9b56b2751658a4ae79`,
);
});
test("test issue editing failing", async ({ page, authenticatedPeer }) => {
const { rid, projectFolder } = await createProject(
authenticatedPeer,
"issue-editing",
);
await authenticatedPeer.rad(
[
"issue",
"open",
"--title",
"This issue is going to fail",
"--description",
"Let's see",
],
{ cwd: projectFolder },
);
await page.route(
`**/v1/projects/${rid}/issues/d316f7a90a40dacbfb8728044bad50c9f71d44ba`,
route => {
if (route.request().method() !== "PATCH") {
void route.fallback();
return;
}
void route.fulfill({ status: 500 });
},
);
await page.goto(
`/seeds/127.0.0.1:8070/${rid}/issues/d316f7a90a40dacbfb8728044bad50c9f71d44ba`,
);
await page.getByPlaceholder("Leave your comment").fill("This is a comment");
await page.getByRole("button", { name: "Comment" }).click();
await expect(page.getByText("Issue editing failed")).toBeVisible();
});
+30
View File
@@ -32,6 +32,7 @@ export const test = base.extend<{
customAppConfig: boolean;
stateDir: string;
peerManager: PeerManager;
authenticatedPeer: RadiclePeer;
outputLog: Stream.Writable;
}>({
customAppConfig: [false, { option: true }],
@@ -145,6 +146,35 @@ export const test = base.extend<{
await use(peerManager);
},
authenticatedPeer: async ({ page, peerManager }, use) => {
const peer = await peerManager.startPeer({
name: "httpd",
gitOptions: gitOptions["bob"],
});
await peer.startHttpd(8070);
await peer.startNode();
await page.goto("/");
await page.getByRole("button", { name: "radicle.local" }).click();
await page.locator('input[name="port"]').fill("8070");
await page.locator('input[name="port"]').press("Enter");
const { stdout } = await peer.rad([
"web",
"--frontend",
"http://localhost:3000",
"--backend",
"http://127.0.0.1:8070",
]);
const match = stdout.trim().match(/(http:\/\/localhost:3000\/.*)$/);
if (!match) {
throw Error("Not able to parse auth url");
}
await page.goto(match[0]);
await page.getByRole("button", { name: "Close" }).click();
await use(peer);
},
// eslint-disable-next-line no-empty-pattern
stateDir: async ({}, use, testInfo) => {
const stateDir = testInfo.outputDir;