File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Aquality.Selenium.Core/tests/Aquality.Selenium.Core.Tests/Applications/Browser Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,16 @@ public void Should_ReturnCorrectState_True_WhenWindowIsReopened([ValueSource(nam
136
136
137
137
private void AssertStateConditionAfterReopen ( Func < IElementStateProvider , bool > stateCondition , bool expectedValue )
138
138
{
139
- OpenDynamicContent ( ) ;
140
- var testElement = new Label ( ContentLoc , "Example" , ElementState . ExistsInAnyState ) ;
141
- testElement . State . WaitForClickable ( ) ;
142
- AqualityServices . Application . Quit ( ) ;
143
- StartLoading ( ) ;
144
- ConditionalWait . WaitForTrue ( ( ) => testElement . Cache . IsStale , message : "Element should be stale after page is closed." ) ;
139
+ Label testElement = null ;
140
+ ConditionalWait . WaitForTrue ( ( ) =>
141
+ {
142
+ OpenDynamicContent ( ) ;
143
+ testElement = new Label ( ContentLoc , "Example" , ElementState . ExistsInAnyState ) ;
144
+ testElement . State . WaitForClickable ( ) ;
145
+ StartLoading ( ) ;
146
+ return testElement . Cache . IsStale ;
147
+ } , message : "Element should be stale after page is closed." ) ;
148
+ Assume . That ( testElement , Is . Not . Null ) ;
145
149
OpenDynamicContent ( ) ;
146
150
Assert . AreEqual ( expectedValue , stateCondition ( testElement . State ) ,
147
151
"Element state condition is not expected after reopening the window" ) ;
You can’t perform that action at this time.
0 commit comments