|
1 | 1 | using Aquality.Selenium.Core.Elements;
|
2 | 2 | using Aquality.Selenium.Core.Elements.Interfaces;
|
3 | 3 | using Aquality.Selenium.Core.Tests.Applications.WindowsApp.Elements;
|
| 4 | +using Aquality.Selenium.Core.Utilities; |
4 | 5 | using Aquality.Selenium.Core.Waitings;
|
5 | 6 | using Microsoft.Extensions.DependencyInjection;
|
6 | 7 | using NUnit.Framework;
|
@@ -137,14 +138,23 @@ public void Should_ReturnCorrectState_True_WhenWindowIsReopened([ValueSource(nam
|
137 | 138 | private void AssertStateConditionAfterReopen(Func<IElementStateProvider, bool> stateCondition, bool expectedValue)
|
138 | 139 | {
|
139 | 140 | Label testElement = null;
|
140 |
| - ConditionalWait.WaitForTrue(() => |
| 141 | + AqualityServices.ServiceProvider.GetRequiredService<IActionRetrier>().DoWithRetry(() => |
141 | 142 | {
|
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."); |
| 143 | + if (AqualityServices.IsApplicationStarted) |
| 144 | + { |
| 145 | + AqualityServices.Application.Quit(); |
| 146 | + } |
| 147 | + ConditionalWait.WaitForTrue(() => |
| 148 | + { |
| 149 | + OpenDynamicContent(); |
| 150 | + testElement = new Label(ContentLoc, "Example", ElementState.ExistsInAnyState); |
| 151 | + testElement.State.WaitForClickable(); |
| 152 | + StartLoading(); |
| 153 | + return testElement.Cache.IsStale; |
| 154 | + }, message: "Element should be stale after page is closed."); |
| 155 | + }, |
| 156 | + new[] { typeof(TimeoutException) }); |
| 157 | + |
148 | 158 | Assume.That(testElement, Is.Not.Null);
|
149 | 159 | OpenDynamicContent();
|
150 | 160 | Assert.AreEqual(expectedValue, stateCondition(testElement.State),
|
|
0 commit comments