Fix flaky visual tests

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2022-12-19 10:37:09 +01:00
parent 34cb75da12
commit e80fabbbdd
6 changed files with 31 additions and 6 deletions
+1
View File
@@ -14,6 +14,7 @@ public/twemoji/*.svg
# Integration Tests
tests/tmp/**/*
tests/artifacts/**/*
tests/visual/snapshots/**/*
# Mac OS
.DS_Store
+1 -1
View File
@@ -13,7 +13,7 @@ test("navigation from commit list", async ({ page }) => {
});
test("relative timestamps", async ({ page }) => {
page.addInitScript(() => {
await page.addInitScript(() => {
window.initializeTestStubs = () => {
window.e2eTestStubs.FakeTimers.install({
now: new Date("November 24 2022 12:00:00").valueOf(),
+1 -1
View File
@@ -98,7 +98,7 @@ test("verified badge", async ({ page }) => {
});
test("relative timestamps", async ({ page }) => {
page.addInitScript(() => {
await page.addInitScript(() => {
window.initializeTestStubs = () => {
window.e2eTestStubs.FakeTimers.install({
now: new Date("November 24 2022 12:00:00").valueOf(),
+1 -1
View File
@@ -6,6 +6,6 @@ test.use({
test("landing page", async ({ page }) => {
await page.addInitScript(appConfigWithFixture);
await page.goto("/");
await page.goto("/", { waitUntil: "networkidle" });
await expect(page).toHaveScreenshot();
});
+26 -2
View File
@@ -1,18 +1,40 @@
import { test, expect, projectFixtureUrl } from "@tests/support/fixtures.js";
test("source tree page", async ({ page }) => {
await page.goto(projectFixtureUrl);
await page.goto(projectFixtureUrl, { waitUntil: "networkidle" });
await expect(page).toHaveScreenshot();
});
test("commits 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(
`${projectFixtureUrl}/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/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(
`${projectFixtureUrl}/remotes/hyn1mjueopwzrmb18c3zmgg8ei8qunn5wpg76ouymytfqkfxqx7bun/commits/d6318f7f3d9c15b8ac6dd52267c53220d00f0982`,
);
@@ -20,6 +42,8 @@ test("commit page", async ({ page }) => {
});
test("markdown rendering", async ({ page }) => {
await page.goto(`${projectFixtureUrl}/tree/main/markdown/cheatsheet.md`);
await page.goto(`${projectFixtureUrl}/tree/main/markdown/cheatsheet.md`, {
waitUntil: "networkidle",
});
await expect(page).toHaveScreenshot({ fullPage: true });
});
+1 -1
View File
@@ -1,6 +1,6 @@
import { test, expect } from "@tests/support/fixtures.js";
test("seed page", async ({ page }) => {
await page.goto("/seeds/radicle.local");
await page.goto("/seeds/radicle.local", { waitUntil: "networkidle" });
await expect(page).toHaveScreenshot();
});