Skip to content

Commit 97e0771

Browse files
committed
more fixes, remove all usage of clickElement
1 parent a895624 commit 97e0771

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

integration/form-test.ts

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ test.describe("Forms", () => {
345345
return (
346346
<>
347347
<Form method={formMethod}>
348-
<button>Submit</button>
348+
<button>Default Submit</button>
349349
<button formMethod={submitterFormMethod}>Submit with {submitterFormMethod}</button>
350350
</Form>
351351
{actionData ? <pre id="action-method">{actionData}</pre> : null}
@@ -532,15 +532,15 @@ test.describe("Forms", () => {
532532
}) => {
533533
let app = new PlaywrightFixture(appFixture, page);
534534
await app.goto("/get-submission");
535-
await app.clickElement(`#${FORM_WITH_ACTION_INPUT} button`);
536-
await page.waitForSelector(`pre:has-text("${EAT}")`);
535+
await page.locator(`#${FORM_WITH_ACTION_INPUT} button`).click();
536+
await page.locator(`pre:has-text("${EAT}")`).waitFor();
537537
});
538538

539539
test("posts to a loader with button data with click", async ({ page }) => {
540540
let app = new PlaywrightFixture(appFixture, page);
541541
await app.goto("/get-submission");
542-
await app.clickElement("#buttonWithValue");
543-
await page.waitForSelector(`pre:has-text("${LAKSA}")`);
542+
await page.locator("#buttonWithValue").click();
543+
await page.locator(`pre:has-text("${LAKSA}")`).waitFor();
544544
});
545545

546546
test("posts to a loader with button data with keyboard", async ({
@@ -560,16 +560,16 @@ test.describe("Forms", () => {
560560
test("posts with the correct checkbox data", async ({ page }) => {
561561
let app = new PlaywrightFixture(appFixture, page);
562562
await app.goto("/get-submission");
563-
await app.clickElement(`#${CHECKBOX_BUTTON}`);
564-
await page.waitForSelector(`pre:has-text("${LAKSA}")`);
565-
await page.waitForSelector(`pre:has-text("${CHEESESTEAK}")`);
563+
await page.locator(`#${CHECKBOX_BUTTON}`).click();
564+
await page.locator(`pre:has-text("${LAKSA}")`).waitFor();
565+
await page.locator(`pre:has-text("${CHEESESTEAK}")`).waitFor();
566566
});
567567

568568
test("posts button data from outside the form", async ({ page }) => {
569569
let app = new PlaywrightFixture(appFixture, page);
570570
await app.goto("/get-submission");
571-
await app.clickElement(`#${ORPHAN_BUTTON}`);
572-
await page.waitForSelector(`pre:has-text("${SQUID_INK_HOTDOG}")`);
571+
await page.locator(`#${ORPHAN_BUTTON}`).click();
572+
await page.locator(`pre:has-text("${SQUID_INK_HOTDOG}")`).waitFor();
573573
});
574574

575575
test(
@@ -1004,16 +1004,11 @@ test.describe("Forms", () => {
10041004

10051005
let app = new PlaywrightFixture(appFixture, page);
10061006
await app.goto(`/form-method?method=${method}`, true);
1007-
await app.clickElement(`text=Submit`);
1007+
await page.locator("text=Default Submit").click();
10081008
if (method !== "GET") {
1009-
await page.waitForSelector("#action-method");
1010-
expect(await app.getHtml("pre#action-method")).toBe(
1011-
`<pre id="action-method">${method}</pre>`
1012-
);
1009+
await expect(page.locator("#action-method")).toHaveText(method);
10131010
}
1014-
expect(await app.getHtml("pre#loader-method")).toBe(
1015-
`<pre id="loader-method">GET</pre>`
1016-
);
1011+
await expect(page.locator("#loader-method")).toHaveText("GET");
10171012
});
10181013
});
10191014
});
@@ -1087,8 +1082,8 @@ test.describe("Forms", () => {
10871082
await app.goto("/file-upload");
10881083
await app.uploadFile(`[name=filey]`, myFile);
10891084
await app.uploadFile(`[name=filey2]`, myFile, myFile);
1090-
await app.clickElement("button");
1091-
await page.waitForSelector("#formData");
1085+
await page.locator("button").click();
1086+
await page.locator("#formData").waitFor();
10921087

10931088
expect((await app.getElement("#formData")).val()).toBe(
10941089
"filey=myfile.txt&filey2=myfile.txt&filey2=myfile.txt&filey3="
@@ -1097,8 +1092,8 @@ test.describe("Forms", () => {
10971092
await app.goto("/file-upload?method=post");
10981093
await app.uploadFile(`[name=filey]`, myFile);
10991094
await app.uploadFile(`[name=filey2]`, myFile, myFile);
1100-
await app.clickElement("button");
1101-
await page.waitForSelector("#formData");
1095+
await page.locator("button").click();
1096+
await page.locator("#formData").waitFor();
11021097

11031098
expect((await app.getElement("#formData")).val()).toBe(
11041099
"filey=myfile.txt&filey2=myfile.txt&filey2=myfile.txt&filey3="

0 commit comments

Comments
 (0)