@@ -345,7 +345,7 @@ test.describe("Forms", () => {
345
345
return (
346
346
<>
347
347
<Form method={formMethod}>
348
- <button>Default Submit</button>
348
+ <button>Submit</button>
349
349
<button formMethod={submitterFormMethod}>Submit with {submitterFormMethod}</button>
350
350
</Form>
351
351
{actionData ? <pre id="action-method">{actionData}</pre> : null}
@@ -1004,7 +1004,7 @@ test.describe("Forms", () => {
1004
1004
1005
1005
let app = new PlaywrightFixture ( appFixture , page ) ;
1006
1006
await app . goto ( `/form-method?method=${ method } ` , true ) ;
1007
- await page . locator ( "text=Default Submit") . click ( ) ;
1007
+ await page . getByText ( " Submit", { exact : true } ) . click ( ) ;
1008
1008
if ( method !== "GET" ) {
1009
1009
await expect ( page . locator ( "#action-method" ) ) . toHaveText ( method ) ;
1010
1010
}
@@ -1122,20 +1122,25 @@ test.describe("Forms", () => {
1122
1122
} ) => {
1123
1123
let app = new PlaywrightFixture ( appFixture , page ) ;
1124
1124
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" ) ;
1129
1125
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" ) ;
1132
1138
1133
- expect ( await app . getHtml ( ) ) . toMatch ( "Submitted - No" ) ;
1139
+ await expect ( page . getByText ( "Submitted - No" ) ) . toBeVisible ( ) ;
1134
1140
// This submission should ignore the index route and the pathless layout
1135
1141
// 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 ( ) ;
1139
1144
} ) ;
1140
1145
}
1141
1146
} ) ;
0 commit comments