Fix not found and loading error screens

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2023-08-16 09:35:44 +02:00
parent 0e33915e9a
commit 5736083d50
15 changed files with 240 additions and 155 deletions
+22 -1
View File
@@ -4,7 +4,7 @@ test.use({
customAppConfig: true,
});
test("landing page", async ({ page }) => {
test("pinned projects", async ({ page }) => {
await page.addInitScript(() => {
window.initializeTestStubs = () => {
window.e2eTestStubs.FakeTimers.install({
@@ -19,3 +19,24 @@ test("landing page", async ({ page }) => {
await page.goto("/", { waitUntil: "networkidle" });
await expect(page).toHaveScreenshot();
});
test("load error", async ({ page }) => {
await page.addInitScript(() => {
window.initializeTestStubs = () => {
window.e2eTestStubs.FakeTimers.install({
now: new Date("November 24 2022 12:00:00").valueOf(),
shouldClearNativeTimers: true,
shouldAdvanceTime: false,
});
};
});
await page.route(
"**/api/v1/projects/rad:z4BwwjPCFNVP27FwVbDFgwVwkjcir",
route => route.fulfill({ status: 500 }),
);
await page.addInitScript(appConfigWithFixture);
await page.goto("/", { waitUntil: "networkidle" });
await expect(page).toHaveScreenshot();
});
@@ -14,3 +14,10 @@ test("node page", async ({ page }) => {
await page.goto("/nodes/radicle.local", { waitUntil: "networkidle" });
await expect(page).toHaveScreenshot();
});
test("node not found", async ({ page }) => {
await page.goto("/nodes/this.node.does.not.exist.xyz", {
waitUntil: "networkidle",
});
await expect(page).toHaveScreenshot();
});
+8
View File
@@ -0,0 +1,8 @@
import { expect, test } from "@tests/support/fixtures.js";
test("page not found", async ({ page }) => {
await page.goto("/this/page/does/not/exist", {
waitUntil: "networkidle",
});
await expect(page).toHaveScreenshot();
});
+48 -2
View File
@@ -6,12 +6,12 @@ import {
aliceRemote,
} from "@tests/support/fixtures.js";
test("source tree page", async ({ page }) => {
test("source page", async ({ page }) => {
await page.goto(sourceBrowsingUrl, { waitUntil: "networkidle" });
await expect(page).toHaveScreenshot();
});
test("commits page", async ({ page }) => {
test("history page", async ({ page }) => {
await page.addInitScript(() => {
window.initializeTestStubs = () => {
window.e2eTestStubs.FakeTimers.install({
@@ -68,3 +68,49 @@ test("diff selection", async ({ page }) => {
);
await expect(page).toHaveScreenshot({ fullPage: true });
});
test("project load error", async ({ page }) => {
await page.goto(
`${sourceBrowsingUrl}/remotes/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot();
});
test("project not found", async ({ page }) => {
await page.goto(`/nodes/127.0.0.1/rad:z4Vzzzzzzzzzzzzzzzzzzzzzzzzzz`, {
waitUntil: "networkidle",
});
await expect(page).toHaveScreenshot();
});
test("file not found", async ({ page }) => {
await page.goto(`${sourceBrowsingUrl}/tree/this.file.does.not.exist`, {
waitUntil: "networkidle",
});
await expect(page).toHaveScreenshot();
});
test("commit not found", async ({ page }) => {
await page.goto(
`${sourceBrowsingUrl}/commits/0000000000000000000000000000000000000000`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot();
});
test("issue not found", async ({ page }) => {
await page.goto(
`${sourceBrowsingUrl}/issues/0000000000000000000000000000000000000000`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot();
});
test("patch not found", async ({ page }) => {
await page.goto(
`${sourceBrowsingUrl}/patches/0000000000000000000000000000000000000000`,
{ waitUntil: "networkidle" },
);
await expect(page).toHaveScreenshot();
});