mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 03:40:37 +08:00
We use built in devices for testing instead of our own custom ones. Split up desktop and mobile visual tests for better separation.
125 lines
3.3 KiB
TypeScript
125 lines
3.3 KiB
TypeScript
import {
|
|
test,
|
|
expect,
|
|
cobUrl,
|
|
sourceBrowsingUrl,
|
|
aliceRemote,
|
|
markdownUrl,
|
|
} from "@tests/support/fixtures.js";
|
|
|
|
test("source page", async ({ page }) => {
|
|
await page.goto(sourceBrowsingUrl, { waitUntil: "networkidle" });
|
|
await expect(page).toHaveScreenshot();
|
|
});
|
|
|
|
test("history page", 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.goto(
|
|
`${sourceBrowsingUrl}/remotes/${aliceRemote.substring(8)}/history`,
|
|
{
|
|
waitUntil: "networkidle",
|
|
},
|
|
);
|
|
|
|
await expect(page).toHaveScreenshot({ fullPage: true });
|
|
});
|
|
|
|
test("commit page", 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.goto(
|
|
`${sourceBrowsingUrl}/remotes/${aliceRemote.substring(
|
|
8,
|
|
)}/commits/1aded56c3ad55299df9f06c326af50b802a05949`,
|
|
);
|
|
await expect(page.getByText("subconscious.txt added")).toBeVisible();
|
|
await expect(page).toHaveScreenshot({ fullPage: true });
|
|
});
|
|
|
|
test("diff selection", 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.goto(
|
|
`${cobUrl}/patches/a27a6b77246e6ada5e81bc8764b5f5c593be80a5?tab=changes#README.md:H0L0H0L3`,
|
|
);
|
|
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("readme not found", async ({ page }) => {
|
|
await page.goto(`${markdownUrl}/tree`, {
|
|
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();
|
|
});
|