@@ -191,38 +191,33 @@ public async Task BlazorServerTemplateWorks_IndividualAuth(BrowserKind browserKi
191
191
192
192
private async Task TestBasicNavigation ( IPage page )
193
193
{
194
- await page . QuerySelectorAsync ( "ul" ) ;
194
+ IWebSocket socket = null ;
195
+ await page . WaitForEventAsync ( PageEvent . WebSocket , s => ( socket = s . WebSocket ) != null ) ;
196
+ await socket . WaitForEventAsync ( WebSocketEvent . FrameReceived ) ;
197
+
198
+ await page . WaitForSelectorAsync ( "ul" ) ;
195
199
// <title> element gets project ID injected into it during template execution
196
200
Assert . Equal ( Project . ProjectName . Trim ( ) , ( await page . GetTitleAsync ( ) ) . Trim ( ) ) ;
197
201
198
202
// Initially displays the home page
199
- Assert . Equal ( " Hello, world!", await page . GetTextContentAsync ( "h1" ) ) ;
203
+ await page . WaitForSelectorAsync ( "h1 >> text= Hello, world!") ;
200
204
201
205
// Can navigate to the counter page
202
-
203
206
await Task . WhenAll (
204
207
page . WaitForNavigationAsync ( "**/counter" ) ,
205
- page . WaitForSelectorAsync ( "text=Current count: 0" ) ,
206
- page . ClickAsync ( "text=Counter" ) ) ;
207
-
208
- Assert . Equal ( "Counter" , await page . GetTextContentAsync ( "h1" ) ) ;
208
+ page . WaitForSelectorAsync ( "h1+p >> text=Current count: 0" ) ,
209
+ page . ClickAsync ( "a[href=counter] >> text=Counter" ) ) ;
209
210
210
211
// Clicking the counter button works
211
- Assert . Equal ( "Current count: 0" , await page . GetTextContentAsync ( "h1+p" ) ) ;
212
- await page . WaitForTimeoutAsync ( 1000 ) ;
213
212
await Task . WhenAll (
214
- page . WaitForSelectorAsync ( "text=Current count: 1" ) ,
215
- page . ClickAsync ( "p+button" ) ) ;
216
-
217
- Assert . Equal ( "Current count: 1" , await page . GetTextContentAsync ( "h1+p" ) ) ;
213
+ page . WaitForSelectorAsync ( "h1+p >> text=Current count: 1" ) ,
214
+ page . ClickAsync ( "p+button >> text=Click me" ) ) ;
218
215
219
216
// Can navigate to the 'fetch data' page
220
217
await Task . WhenAll (
221
218
page . WaitForNavigationAsync ( "**/fetchdata" ) ,
222
- page . WaitForSelectorAsync ( "text=Weather forecast" ) ,
223
- page . ClickAsync ( "text=Fetch data" ) ) ;
224
-
225
- Assert . Equal ( "Weather forecast" , await page . GetTextContentAsync ( "h1" ) ) ;
219
+ page . WaitForSelectorAsync ( "h1 >> text=Weather forecast" ) ,
220
+ page . ClickAsync ( "a[href=fetchdata] >> text=Fetch data" ) ) ;
226
221
227
222
// Asynchronously loads and displays the table of weather forecasts
228
223
await page . WaitForSelectorAsync ( "table>tbody>tr" ) ;
0 commit comments