Skip to content

Commit a500fc8

Browse files
chore: add E2E test for attach modal visibility
1 parent a27ee62 commit a500fc8

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

tests/e2e/specs/attach-modal.spec.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* WordPress dependencies
33
*/
44
import { test, expect } from "@wordpress/e2e-test-utils-playwright";
5-
import { createSimpleGroupField } from "../utils";
5+
import { addNewField, createSimpleGroupField, fillFieldNameAndId, pickFieldTypeInModal, saveFieldInModal, saveFields } from "../utils";
66

77
test.describe("Attach Modal", () => {
88
/**
@@ -82,4 +82,32 @@ test.describe("Attach Modal", () => {
8282
expect(count ).toBeGreaterThan(0);
8383
}
8484
});
85+
86+
/**
87+
* Attach Modal should be visible only for existing PPOM fields.
88+
*/
89+
test("attach modal visibility on Group Edit page", async ({ page, admin }) => {
90+
await admin.visitAdminPage("admin.php?page=ppom");
91+
92+
await page.getByRole("link", { name: "Add New Group" }).click();
93+
await page.getByRole("textbox").fill("Test Attach Modal visibility");
94+
95+
await expect( page.locator('[data-formmodal-id="ppom-product-modal"]') ).toBeHidden();
96+
97+
await addNewField(page);
98+
await pickFieldTypeInModal(page, "text");
99+
await fillFieldNameAndId(
100+
page,
101+
1,
102+
`Test`,
103+
`test`,
104+
);
105+
await saveFieldInModal(page, 1);
106+
await saveFields(page);
107+
108+
await page.waitForLoadState("networkidle");
109+
await page.reload();
110+
111+
await expect( page.locator('[data-formmodal-id="ppom-product-modal"]') ).toBeVisible();
112+
});
85113
});

0 commit comments

Comments
 (0)