Skip to content

Commit 1161cbd

Browse files
committed
more fixes
1 parent 97e0771 commit 1161cbd

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

integration/form-test.ts

Lines changed: 17 additions & 12 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>Default Submit</button>
348+
<button>Submit</button>
349349
<button formMethod={submitterFormMethod}>Submit with {submitterFormMethod}</button>
350350
</Form>
351351
{actionData ? <pre id="action-method">{actionData}</pre> : null}
@@ -1004,7 +1004,7 @@ test.describe("Forms", () => {
10041004

10051005
let app = new PlaywrightFixture(appFixture, page);
10061006
await app.goto(`/form-method?method=${method}`, true);
1007-
await page.locator("text=Default Submit").click();
1007+
await page.getByText("Submit", { exact: true }).click();
10081008
if (method !== "GET") {
10091009
await expect(page.locator("#action-method")).toHaveText(method);
10101010
}
@@ -1122,20 +1122,25 @@ test.describe("Forms", () => {
11221122
}) => {
11231123
let app = new PlaywrightFixture(appFixture, page);
11241124
await app.goto("/pathless-layout-parent/nested");
1125-
let html = await app.getHtml();
1126-
expect(html).toMatch("Pathless Layout Parent");
1127-
expect(html).toMatch("Pathless Layout ");
1128-
expect(html).toMatch("Pathless Layout Index");
11291125

1130-
let el = getElement(html, `form`);
1131-
expect(el.attr("action")).toBe("/pathless-layout-parent");
1126+
await expect(
1127+
page.getByText("Pathless Layout Parent", { exact: true })
1128+
).toBeVisible();
1129+
await expect(
1130+
page.getByText("Pathless Layout", { exact: true })
1131+
).toBeVisible();
1132+
await expect(
1133+
page.getByText("Pathless Layout Index", { exact: true })
1134+
).toBeVisible();
1135+
1136+
const form = page.locator("form");
1137+
await expect(form).toHaveAttribute("action", "/pathless-layout-parent");
11321138

1133-
expect(await app.getHtml()).toMatch("Submitted - No");
1139+
await expect(page.getByText("Submitted - No")).toBeVisible();
11341140
// This submission should ignore the index route and the pathless layout
11351141
// route above it and hit the action in routes/pathless-layout-parent.jsx
1136-
await app.clickSubmitButton("/pathless-layout-parent");
1137-
await page.waitForSelector("text=Submitted - Yes");
1138-
expect(await app.getHtml()).toMatch("Submitted - Yes");
1142+
await page.getByRole("button").click();
1143+
await expect(page.getByText("Submitted - Yes")).toBeVisible();
11391144
});
11401145
}
11411146
});

0 commit comments

Comments
 (0)