mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 03:40:37 +08:00
We where using `sinon` in the `playwright` tests to simulate a different time, which since `playwright@1.45.0` can be done with the Clock API calling `page.clock.setFixedTime`. And to test the mutex executor we can use the vitest utils spy function `vi.fn()` instead of `sinon.spy()`
35 lines
982 B
TypeScript
35 lines
982 B
TypeScript
import {
|
|
aliceRemote,
|
|
expect,
|
|
sourceBrowsingUrl,
|
|
test,
|
|
} from "@tests/support/fixtures.js";
|
|
|
|
test("source tree page", async ({ page }) => {
|
|
await page.goto(sourceBrowsingUrl, { waitUntil: "networkidle" });
|
|
await expect(page).toHaveScreenshot();
|
|
});
|
|
|
|
test("commits page", async ({ page }) => {
|
|
await page.clock.setFixedTime(new Date("November 24 2022 12:00:00"));
|
|
await page.goto(
|
|
`${sourceBrowsingUrl}/remotes/${aliceRemote.substring(8)}/history`,
|
|
{
|
|
waitUntil: "networkidle",
|
|
},
|
|
);
|
|
|
|
await expect(page).toHaveScreenshot({ fullPage: true });
|
|
});
|
|
|
|
test("commit page", async ({ page }) => {
|
|
await page.clock.setFixedTime(new Date("November 24 2022 12:00:00"));
|
|
await page.goto(
|
|
`${sourceBrowsingUrl}/remotes/${aliceRemote.substring(
|
|
8,
|
|
)}/commits/1aded56c3ad55299df9f06c326af50b802a05949`,
|
|
);
|
|
await expect(page.getByText("subconscious.txt added")).toBeVisible();
|
|
await expect(page).toHaveScreenshot({ fullPage: true });
|
|
});
|