-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from maciekpazola/Develop
Refactor and code cleanup
- Loading branch information
Showing
33 changed files
with
233 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace TestUtilities.UITesting.Helpers | ||
namespace UIAutomationTests.Helpers | ||
{ | ||
public static class Locator | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,47 @@ | ||
using TestUtilities.UITesting.Drivers; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Support.UI; | ||
using UIAutomationTests.Drivers; | ||
|
||
namespace TestUtilities.UITesting.Helpers | ||
namespace UIAutomationTests.Helpers | ||
{ | ||
public class Waits | ||
{ | ||
private readonly ScenarioContext _scenarioContext; | ||
public Waits(ScenarioContext scenarioContext) => _scenarioContext = scenarioContext; | ||
|
||
public Waits(ScenarioContext scenarioContext) | ||
{ | ||
_scenarioContext = scenarioContext; | ||
} | ||
|
||
public DefaultWait<IWebDriver> GetWebDriverWait(int timeoutInSeconds = 5) | ||
{ | ||
DefaultWait<IWebDriver> wait = new(Driver.GetDriver(_scenarioContext.Get<string>("BrowserName"))); | ||
DefaultWait<IWebDriver> wait = new(Driver.GetDriver(_scenarioContext)); | ||
wait.Timeout = TimeSpan.FromSeconds(timeoutInSeconds); | ||
|
||
return wait; | ||
} | ||
public DefaultWait<IWebDriver> GetFluentWait(int timeoutInSeconds = 3, int pollingIntervalInMilliseconds = 100) | ||
|
||
public bool WaitUntil(Func<bool> condition, int timeoutInSeconds = 5) | ||
{ | ||
DefaultWait<IWebDriver> fluentWait = new(Driver.GetDriver(_scenarioContext.Get<string>("BrowserName"))); | ||
fluentWait.Timeout = TimeSpan.FromSeconds(timeoutInSeconds); | ||
fluentWait.PollingInterval = TimeSpan.FromMilliseconds(pollingIntervalInMilliseconds); | ||
DateTime startTime = DateTime.Now; | ||
|
||
while ((DateTime.Now - startTime).TotalSeconds < timeoutInSeconds) | ||
{ | ||
try | ||
{ | ||
if (condition()) | ||
{ | ||
return true; | ||
} | ||
} | ||
catch | ||
{ | ||
} | ||
|
||
Thread.Sleep(500); | ||
} | ||
|
||
return fluentWait; | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.