Skip to content

Commit

Permalink
chore: add E2E test for attach modal visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Oct 17, 2024
1 parent a27ee62 commit a500fc8
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/e2e/specs/attach-modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* WordPress dependencies
*/
import { test, expect } from "@wordpress/e2e-test-utils-playwright";
import { createSimpleGroupField } from "../utils";
import { addNewField, createSimpleGroupField, fillFieldNameAndId, pickFieldTypeInModal, saveFieldInModal, saveFields } from "../utils";

test.describe("Attach Modal", () => {
/**
Expand Down Expand Up @@ -82,4 +82,32 @@ test.describe("Attach Modal", () => {
expect(count ).toBeGreaterThan(0);
}
});

/**
* Attach Modal should be visible only for existing PPOM fields.
*/
test("attach modal visibility on Group Edit page", async ({ page, admin }) => {
await admin.visitAdminPage("admin.php?page=ppom");

await page.getByRole("link", { name: "Add New Group" }).click();
await page.getByRole("textbox").fill("Test Attach Modal visibility");

await expect( page.locator('[data-formmodal-id="ppom-product-modal"]') ).toBeHidden();

await addNewField(page);
await pickFieldTypeInModal(page, "text");
await fillFieldNameAndId(
page,
1,
`Test`,
`test`,
);
await saveFieldInModal(page, 1);
await saveFields(page);

await page.waitForLoadState("networkidle");
await page.reload();

await expect( page.locator('[data-formmodal-id="ppom-product-modal"]') ).toBeVisible();
});
});

0 comments on commit a500fc8

Please sign in to comment.