Skip to content

Commit de8473d

Browse files
carlosthe19916mrrajan
authored andcommitted
tests: add not-found page tests (guacsec#925)
Signed-off-by: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com>
1 parent d56b99b commit de8473d

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// @ts-check
2+
3+
import { expect } from "@playwright/test";
4+
5+
import { test } from "../../fixtures";
6+
import { login } from "../../helpers/Auth";
7+
8+
const NON_EXISTENT_UUID = "urn:uuid:00000000-0000-0000-0000-000000000000";
9+
10+
const expectNotFound = async (page: import("@playwright/test").Page) => {
11+
await expect(
12+
page.getByRole("heading", { name: "404: That page does not exist" }),
13+
).toBeVisible();
14+
await expect(
15+
page.getByText("Another page might have the information you need."),
16+
).toBeVisible();
17+
};
18+
19+
test.describe("Not Found page", { tag: "@tier1" }, () => {
20+
test.beforeEach(async ({ page }) => {
21+
await login(page);
22+
});
23+
24+
test("Shows 404 page for undefined route", async ({ page }) => {
25+
await page.goto("/this-page-does-not-exist");
26+
await expectNotFound(page);
27+
});
28+
29+
test("Shows 404 page for non-existent advisory", async ({ page }) => {
30+
await page.goto(`/advisories/${NON_EXISTENT_UUID}`);
31+
await expectNotFound(page);
32+
});
33+
34+
test("Shows 404 page for non-existent SBOM", async ({ page }) => {
35+
await page.goto(`/sboms/${NON_EXISTENT_UUID}`);
36+
await expectNotFound(page);
37+
});
38+
39+
test("Shows 404 page for non-existent vulnerability", async ({ page }) => {
40+
await page.goto("/vulnerabilities/CVE-0000-00000");
41+
await expectNotFound(page);
42+
});
43+
44+
// Enable this test when https://issues.redhat.com/browse/TC-3626 is fixed
45+
test.skip("Shows 404 page for non-existent package", async ({ page }) => {
46+
await page.goto(`/packages/${NON_EXISTENT_UUID}`);
47+
await expectNotFound(page);
48+
});
49+
});

0 commit comments

Comments
 (0)