mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
104 lines
3.2 KiB
TypeScript
104 lines
3.2 KiB
TypeScript
import {
|
|
test,
|
|
expect,
|
|
projectFixtureUrl,
|
|
bobRemote,
|
|
bobHead,
|
|
} from "@tests/support/fixtures.js";
|
|
|
|
const modifiedFileFixture = `${projectFixtureUrl}/remotes/${bobRemote.substring(
|
|
8,
|
|
)}/commits/${bobHead}`;
|
|
|
|
test("navigation from commit list", async ({ page }) => {
|
|
await page.goto(projectFixtureUrl);
|
|
await page.getByTitle("Change peer").click();
|
|
await page.locator(`text=${bobRemote}`).click();
|
|
await page.locator('role=link[name="9 commits"]').click();
|
|
|
|
await page.locator("text=Update readme").click();
|
|
await expect(page).toHaveURL(modifiedFileFixture);
|
|
});
|
|
|
|
test("relative timestamps", async ({ page }) => {
|
|
await page.addInitScript(() => {
|
|
window.initializeTestStubs = () => {
|
|
window.e2eTestStubs.FakeTimers.install({
|
|
now: new Date("December 21 2022 12:00:00").valueOf(),
|
|
shouldClearNativeTimers: true,
|
|
shouldAdvanceTime: false,
|
|
});
|
|
};
|
|
});
|
|
await page.goto(modifiedFileFixture);
|
|
await expect(
|
|
page.locator(`.commit .header >> text=${"Bob Belcher committed now"}`),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("modified file", async ({ page }) => {
|
|
await page.goto(modifiedFileFixture);
|
|
|
|
// Commit header.
|
|
{
|
|
const header = page.locator(".commit .header");
|
|
await expect(header.locator("text=Update readme")).toBeVisible();
|
|
await expect(
|
|
header.locator("text=ec5eb0b5efb73da17a2d25454cc47eea3967f328"),
|
|
).toBeVisible();
|
|
}
|
|
|
|
// Diff header.
|
|
await expect(
|
|
page.locator("text=1 file changed with 1 insertion and 4 deletions"),
|
|
).toBeVisible();
|
|
|
|
// Diff.
|
|
await expect(page.locator("text=- # Git test repository")).toBeVisible();
|
|
await expect(page.locator("text=+ Updated readme")).toBeVisible();
|
|
});
|
|
|
|
test("created file", async ({ page }) => {
|
|
await page.goto(
|
|
`${projectFixtureUrl}/remotes/${bobRemote}/commits/d6318f7f3d9c15b8ac6dd52267c53220d00f0982`,
|
|
);
|
|
await expect(
|
|
page.locator("text=1 file added with 9 insertions and 0 deletions"),
|
|
).toBeVisible();
|
|
await expect(page.locator("text=subconscious.txt added")).toBeVisible();
|
|
});
|
|
|
|
test("deleted file", async ({ page }) => {
|
|
await page.goto(
|
|
`${projectFixtureUrl}/remotes/${bobRemote}/commits/cd13c2d9a8a930d64a82b6134b44d1b872e33662`,
|
|
);
|
|
await expect(
|
|
page.locator("text=1 file deleted with 0 insertions and 1 deletion"),
|
|
).toBeVisible();
|
|
await expect(page.locator("text=.hidden deleted")).toBeVisible();
|
|
});
|
|
|
|
test("navigation to source tree at specific revision", async ({ page }) => {
|
|
await page.goto(
|
|
`${projectFixtureUrl}/commits/0801aceeab500033f8d608778218657bd626ef73`,
|
|
);
|
|
|
|
// Go to source tree at this revision.
|
|
await page.getByTitle("View file").click();
|
|
await expect(
|
|
page.locator("text=Add a deeply nested directory tree"),
|
|
).toBeVisible();
|
|
await expect(page).toHaveURL(
|
|
`${projectFixtureUrl}/tree/0801aceeab500033f8d608778218657bd626ef73/deep/directory/hierarchy/is/entirely/possible/in/git/repositories/.gitkeep`,
|
|
);
|
|
await expect(page.getByTitle("Current branch")).toContainText(
|
|
"0801aceeab500033f8d608778218657bd626ef73",
|
|
);
|
|
await expect(page.locator(".source-tree >> text=.gitkeep")).toBeVisible();
|
|
await expect(
|
|
page.locator(
|
|
"text=deep/directory/hierarchy/is/entirely/possible/in/git/repositories/",
|
|
),
|
|
).toBeVisible();
|
|
});
|