Skip to content

Commit

Permalink
fix: publish and unpublish items test
Browse files Browse the repository at this point in the history
  • Loading branch information
caichi-t committed Nov 18, 2024
1 parent 2836d3f commit 5435393
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions web/e2e/project/content/content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,38 +48,52 @@ test("Item CRUD and searching has succeeded", async ({ page }) => {
await expect(page.getByRole("cell", { name: "new text" })).toBeHidden();
});

test("Publishing and Unpublishing item has succeeded", async ({ page }) => {
test("Publishing and Unpublishing item from edit page has succeeded", async ({ page }) => {
await page.locator("li").filter({ hasText: "Text" }).locator("div").first().click();
await handleFieldForm(page, "text");
await page.getByText("Settings").first().click();
await page.getByRole("row", { name: "Owner" }).getByRole("switch").click();
await page.getByRole("button", { name: "Save changes" }).last().click();
await closeNotification(page);
await page.getByText("Content").first().click();
await page.getByRole("button", { name: "plus New Item" }).click();
await page.getByLabel("text").click();
await page.getByLabel("text").fill("text");
await page.getByRole("button", { name: "Save" }).click();
await closeNotification(page);
await expect(page.getByText("DRAFT")).toBeVisible();
await page.getByRole("button", { name: "Publish" }).click();
await closeNotification(page);
await expect(page.getByText("PUBLIC")).toBeVisible();
await page.getByLabel("Back").click();
await expect(page.getByText("PUBLIC")).toBeVisible();
await page.getByLabel("", { exact: true }).check();
await page.getByRole("cell").getByLabel("edit").locator("svg").click();
await expect(page.getByText("PUBLIC")).toBeVisible();
await page.getByRole("button", { name: "ellipsis" }).click();
await page.getByText("Unpublish").click();
await closeNotification(page);
await expect(page.getByText("DRAFT")).toBeVisible();
await page.getByRole("cell").getByLabel("edit").locator("svg").click();
await page.getByLabel("Back").click();
await expect(page.getByText("DRAFT")).toBeVisible();
await page.getByRole("button", { name: "Publish" }).click();
});

test("Publishing and Unpublishing item from table has succeeded", async ({ page }) => {
await page.locator("li").filter({ hasText: "Text" }).locator("div").first().click();
await handleFieldForm(page, "text");
await page.getByText("Content").first().click();
await page.getByRole("button", { name: "plus New Item" }).click();
await page.getByLabel("text").click();
await page.getByLabel("text").fill("text");
await page.getByRole("button", { name: "Save" }).click();
await closeNotification(page);
await expect(page.getByText("DRAFT")).toBeVisible();
await page.getByLabel("Back").click();
await expect(page.getByText("DRAFT")).toBeVisible();
await page.getByLabel("", { exact: true }).check();
await page.getByText("Publish", { exact: true }).click();
await page.getByRole("button", { name: "Yes" }).click();
await closeNotification(page);
await expect(page.getByText("PUBLIC")).toBeVisible();
await page.getByRole("button", { name: "ellipsis" }).click();
await page.getByText("Unpublish").click();
await closeNotification(page);
await expect(page.getByText("DRAFT")).toBeVisible();
await page.getByLabel("Back").click();
await page.getByRole("cell").getByLabel("edit").locator("svg").click();
await expect(page.getByText("DRAFT")).toBeVisible();
});

Expand Down

0 comments on commit 5435393

Please sign in to comment.