@@ -36,10 +36,11 @@ public void ReconnectUI()
36
36
var javascript = ( IJavaScriptExecutor ) Browser ;
37
37
javascript . ExecuteScript ( "Blazor._internal.forceCloseConnection()" ) ;
38
38
39
- // We should see the 'reconnecting' UI appear
40
- Browser . Equal ( "block" , ( ) => Browser . Exists ( By . Id ( "components-reconnect-modal" ) ) . GetCssValue ( "display" ) ) ;
39
+ // Circuit should immediately try to reconnect itself
40
+ AssertLogContains ( "Connection disconnected." ) ;
41
+ AssertLogContains ( "WebSocket connected" ) ;
41
42
42
- // Then it should disappear
43
+ // And we should not see a reconnection dialog
43
44
Browser . Equal ( "none" , ( ) => Browser . Exists ( By . Id ( "components-reconnect-modal" ) ) . GetCssValue ( "display" ) ) ;
44
45
45
46
Browser . Exists ( By . Id ( "increment" ) ) . Click ( ) ;
@@ -59,26 +60,36 @@ public void RendersContinueAfterReconnect()
59
60
var javascript = ( IJavaScriptExecutor ) Browser ;
60
61
javascript . ExecuteScript ( "Blazor._internal.forceCloseConnection()" ) ;
61
62
62
- // We should see the 'reconnecting' UI appear
63
- Browser . Equal ( "block" , ( ) => Browser . Exists ( By . Id ( "components-reconnect-modal" ) ) . GetCssValue ( "display" ) ) ;
63
+ // Circuit should immediately try to reconnect itself
64
+ AssertLogContains ( "Connection disconnected." ) ;
65
+ AssertLogContains ( "WebSocket connected" ) ;
64
66
65
- // Then it should disappear
67
+ // And we should not see a reconnection dialog
66
68
Browser . Equal ( "none" , ( ) => Browser . Exists ( By . Id ( "components-reconnect-modal" ) ) . GetCssValue ( "display" ) ) ;
67
69
68
70
// We should receive a render that occurred while disconnected
71
+ Thread . Sleep ( 2000 ) ;
69
72
var currentValue = Browser . Exists ( selector ) . Text ;
70
73
Assert . NotEqual ( initialValue , currentValue ) ;
71
74
72
75
// Verify it continues to tick
73
- Thread . Sleep ( 5 ) ;
76
+ Thread . Sleep ( 2000 ) ;
74
77
Browser . False ( ( ) => Browser . Exists ( selector ) . Text == currentValue ) ;
75
78
}
76
79
77
80
[ Fact ]
78
81
public void ErrorsStopTheRenderingProcess ( )
79
82
{
80
83
Browser . Exists ( By . Id ( "cause-error" ) ) . Click ( ) ;
81
- Browser . True ( ( ) => Browser . Manage ( ) . Logs . GetLog ( LogType . Browser )
82
- . Any ( l => l . Level == LogLevel . Info && l . Message . Contains ( "Connection disconnected." ) ) ) ;
84
+ AssertLogContains ( "Connection disconnected." ) ;
85
+ }
86
+
87
+ void AssertLogContains ( params string [ ] messages )
88
+ {
89
+ var log = Browser . Manage ( ) . Logs . GetLog ( LogType . Browser ) ;
90
+ foreach ( var message in messages )
91
+ {
92
+ Assert . Contains ( log , entry => entry . Message . Contains ( message ) ) ;
93
+ }
83
94
}
84
95
}
0 commit comments