mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Remove tests relying on rad-web
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { test, cobUrl, expect } from "@tests/support/fixtures.js";
|
||||
import { createProject, extractPatchId } from "@tests/support/project";
|
||||
|
||||
test("navigate patch details", async ({ page }) => {
|
||||
await page.goto(`${cobUrl}/patches`);
|
||||
@@ -118,147 +117,3 @@ test("view file navigation from changes tab", async ({ page }) => {
|
||||
`${cobUrl}/tree/8c900d6cb38811e099efb3cbbdbfaba817bcf970/README.md`,
|
||||
);
|
||||
});
|
||||
|
||||
test("change patch state", async ({ page, authenticatedPeer }) => {
|
||||
const { rid, projectFolder } = await createProject(authenticatedPeer, {
|
||||
name: "lifecycle",
|
||||
});
|
||||
await authenticatedPeer.git(["switch", "-c", "feature-1"], {
|
||||
cwd: projectFolder,
|
||||
});
|
||||
await authenticatedPeer.git(
|
||||
["commit", "--allow-empty", "-m", "Some patch title"],
|
||||
{
|
||||
cwd: projectFolder,
|
||||
},
|
||||
);
|
||||
const patchId = extractPatchId(
|
||||
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
|
||||
cwd: projectFolder,
|
||||
}),
|
||||
);
|
||||
await page.goto(`${authenticatedPeer.uiUrl()}/${rid}/patches/${patchId}`);
|
||||
await page.getByRole("button", { name: "Archive patch" }).first().click();
|
||||
await expect(page.getByText("Archived", { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: "Patches 0" })).toBeVisible();
|
||||
|
||||
await page.getByLabel("stateToggle").first().click();
|
||||
await page.getByText("Convert to draft").click();
|
||||
await page.getByText("Convert to draft").click();
|
||||
await expect(page.getByText("Draft", { exact: true })).toBeVisible();
|
||||
await expect(page.getByRole("button", { name: "Patches 0" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("edit patch", async ({ page, authenticatedPeer }) => {
|
||||
const { rid, projectFolder } = await createProject(authenticatedPeer, {
|
||||
name: "edit-patch",
|
||||
});
|
||||
await authenticatedPeer.git(["switch", "-c", "edit-patch"], {
|
||||
cwd: projectFolder,
|
||||
});
|
||||
await authenticatedPeer.git(
|
||||
[
|
||||
"commit",
|
||||
"--allow-empty",
|
||||
"-m",
|
||||
"Some patch title",
|
||||
"-m",
|
||||
"This should be a description",
|
||||
],
|
||||
{
|
||||
cwd: projectFolder,
|
||||
},
|
||||
);
|
||||
const patchId = extractPatchId(
|
||||
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
|
||||
cwd: projectFolder,
|
||||
}),
|
||||
);
|
||||
await page.goto(`${authenticatedPeer.uiUrl()}/${rid}/patches/${patchId}`);
|
||||
|
||||
const titleLocator = page.getByText("Some patch title").first();
|
||||
const descriptionLocator = page.getByText("This should be a description");
|
||||
await expect(titleLocator).toBeVisible();
|
||||
await expect(descriptionLocator).toBeVisible();
|
||||
await expect(page.getByPlaceholder("Title")).toBeHidden();
|
||||
await expect(page.getByPlaceholder("Leave a description")).toBeHidden();
|
||||
|
||||
await page.getByRole("button", { name: "Edit", exact: true }).click();
|
||||
await page
|
||||
.getByPlaceholder("Title")
|
||||
.fill("This is a modified patch title to be dismissed");
|
||||
await page
|
||||
.getByPlaceholder("Leave a description")
|
||||
.fill("This is a modified patch description to be dismissed");
|
||||
await page.getByRole("button", { name: "Cancel" }).click();
|
||||
await expect(titleLocator).toBeVisible();
|
||||
await expect(descriptionLocator).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Edit", exact: true }).click();
|
||||
await page.getByPlaceholder("Title").fill("This is a modified patch title");
|
||||
await page
|
||||
.getByPlaceholder("Leave a description")
|
||||
.fill("This is a modified patch description");
|
||||
await page.getByRole("button", { name: "Save" }).click();
|
||||
await expect(page.getByRole("button", { name: "Save" })).toBeHidden();
|
||||
await expect(page.getByText("This is a modified patch title")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText("This is a modified patch description"),
|
||||
).toBeVisible();
|
||||
await page.reload();
|
||||
await expect(page.getByText("This is a modified patch title")).toBeVisible();
|
||||
await expect(
|
||||
page.getByText("This is a modified patch description"),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("edit revision", async ({ page, authenticatedPeer }) => {
|
||||
const { rid, projectFolder } = await createProject(authenticatedPeer, {
|
||||
name: "edit-revision",
|
||||
});
|
||||
await authenticatedPeer.git(["switch", "-c", "edit-revision"], {
|
||||
cwd: projectFolder,
|
||||
});
|
||||
await authenticatedPeer.git(
|
||||
[
|
||||
"commit",
|
||||
"--allow-empty",
|
||||
"-m",
|
||||
"Some patch title",
|
||||
"-m",
|
||||
"This should be a description",
|
||||
],
|
||||
{
|
||||
cwd: projectFolder,
|
||||
},
|
||||
);
|
||||
const patchId = extractPatchId(
|
||||
await authenticatedPeer.git(["push", "rad", "HEAD:refs/patches"], {
|
||||
cwd: projectFolder,
|
||||
}),
|
||||
);
|
||||
await authenticatedPeer.git(
|
||||
[
|
||||
"commit",
|
||||
"--allow-empty",
|
||||
"-m",
|
||||
"Let's create a new revision",
|
||||
"-m",
|
||||
"More descriptions",
|
||||
],
|
||||
{
|
||||
cwd: projectFolder,
|
||||
},
|
||||
);
|
||||
await authenticatedPeer.git(["push", "rad"], { cwd: projectFolder });
|
||||
|
||||
await page.goto(`${authenticatedPeer.ridUrl(rid)}/patches/${patchId}`);
|
||||
await page.getByRole("button", { name: "edit revision" }).click();
|
||||
await page
|
||||
.getByPlaceholder("Leave a description")
|
||||
.fill("This is an edited second revision");
|
||||
await page.getByRole("button", { name: "Save" }).click();
|
||||
await expect(
|
||||
page.getByText("This is an edited second revision"),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user