Skip to content

Commit

Permalink
Update WebDriverManager reference to enable "MatchingBrowser" webDriv…
Browse files Browse the repository at this point in the history
…erVersion strategy (#194)

* Update WebDriverManager reference to enable "MatchingBrowser" webDriverVersion strategy

* Stabilize JS Focus test, replace obsolete property with State reference in tests

* Fix ParallelScope in LocalizationManagerTests
  • Loading branch information
mialeska authored Nov 11, 2020
1 parent efcffff commit 2847889
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Edge.SeleniumTools" Version="3.141.1" />
<PackageReference Include="Microsoft.Edge.SeleniumTools" Version="3.141.2" />
<PackageReference Include="Aquality.Selenium.Core" Version="1.2.2" />
<PackageReference Include="WebDriverManager" Version="2.9.1" />
<PackageReference Include="WebDriverManager" Version="2.11.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ private RemoteWebDriver GetDriver<T>(DriverService driverService, DriverOptions
private static void SetUpDriver(IDriverConfig driverConfig, IDriverSettings driverSettings)
{
var architecture = driverSettings.SystemArchitecture.Equals(Architecture.Auto) ? ArchitectureHelper.GetArchitecture() : driverSettings.SystemArchitecture;
var version = driverSettings.WebDriverVersion.Equals("Latest") ? driverConfig.GetLatestVersion() : driverSettings.WebDriverVersion;
var version = driverSettings.WebDriverVersion.Equals(VersionResolveStrategy.Latest) ? driverConfig.GetLatestVersion() : driverSettings.WebDriverVersion;
version = version.Equals(VersionResolveStrategy.MatchingBrowser) ? driverConfig.GetMatchingBrowserVersion() : version;
var url = UrlHelper.BuildUrl(architecture.Equals(Architecture.X32) ? driverConfig.GetUrl32() : driverConfig.GetUrl64(), version);
var binaryPath = FileHelper.GetBinDestination(driverConfig.GetName(), version, architecture, driverConfig.GetBinaryName());
if (!File.Exists(binaryPath) || !Environment.GetEnvironmentVariable("PATH").Contains(binaryPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

"driverSettings": {
"chrome": {
"webDriverVersion": "Latest",
"webDriverVersion": "MatchingBrowser",
"capabilities": {
"enableVNC": true,
"loggingPrefs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void Should_BePossibleTo_Click()
var welcomeForm = new WelcomeForm();
welcomeForm.Open();
welcomeForm.GetExampleLink(AvailableExample.Dropdown).JsActions.Click();
Assert.IsTrue(new DropdownForm().IsDisplayed, "Dropdown form should be displayed");
Assert.IsTrue(new DropdownForm().State.WaitForDisplayed(), "Dropdown form should be displayed");
}

[Test]
Expand All @@ -30,7 +30,7 @@ public void Should_BePossibleTo_ClickAndWait()
var welcomeForm = new WelcomeForm();
welcomeForm.Open();
welcomeForm.GetExampleLink(AvailableExample.Dropdown).JsActions.ClickAndWait();
Assert.IsTrue(new DropdownForm().IsDisplayed, "Dropdown form should be displayed");
Assert.IsTrue(new DropdownForm().State.WaitForDisplayed(), "Dropdown form should be displayed");
}

[Test]
Expand Down Expand Up @@ -69,6 +69,7 @@ public void Should_BePossibleTo_SetFocus()
var expectedText = currentText.Remove(currentText.Length - 1);
product.TxtQuantity.JsActions.SetFocus();
product.TxtQuantity.SendKeys(Keys.Delete);
product.TxtQuantity.SendKeys(Keys.Backspace);
Assert.AreEqual(expectedText, product.TxtQuantity.Value, $"One character should be removed from '{currentText}'");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void Should_BePossibleTo_Click()
var welcomeForm = new WelcomeForm();
welcomeForm.Open();
welcomeForm.GetExampleLink(AvailableExample.Dropdown).MouseActions.Click();
Assert.IsTrue(new DropdownForm().IsDisplayed, "Dropdown form should be displayed");
Assert.IsTrue(new DropdownForm().State.WaitForDisplayed(), "Dropdown form should be displayed");
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void Should_BePossibleTo_CheckElementIsClickableState()
[Test]
public void Should_BePossibleTo_WaitForElementEnabledState()
{
Assert.IsTrue(dynamicControlsForm.IsDisplayed, "Form 'Dynamic Controls' should be displayed");
Assert.IsTrue(dynamicControlsForm.State.WaitForDisplayed(), "Form 'Dynamic Controls' should be displayed");
dynamicControlsForm.ChangeInputStateButton.Click();
Assert.IsTrue(dynamicControlsForm.TextInputTextBox.State.WaitForEnabled(), "Text input should be enable after changing state");
dynamicControlsForm.ChangeInputStateButton.Click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public ProductListForm() : base(By.XPath(FormLocator), "Product list")
public void NavigateToLastProduct()
{
AqualityServices.Browser.GoTo(GetLastProduct().Href);
AqualityServices.Browser.WaitForPageToLoad();
}

public ILink GetLastProduct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ private static void SetUpDriver(IDriverConfig driverConfig, IDriverSettings driv
{
var architecture = driverSettings.SystemArchitecture.Equals(Architecture.Auto) ? ArchitectureHelper.GetArchitecture() : driverSettings.SystemArchitecture;
var version = driverSettings.WebDriverVersion.Equals("Latest") ? driverConfig.GetLatestVersion() : driverSettings.WebDriverVersion;
version = version.Equals(VersionResolveStrategy.MatchingBrowser) ? driverConfig.GetMatchingBrowserVersion() : version;
var url = UrlHelper.BuildUrl(architecture.Equals(Architecture.X32) ? driverConfig.GetUrl32() : driverConfig.GetUrl64(), version);
var binaryPath = FileHelper.GetBinDestination(driverConfig.GetName(), version, architecture, driverConfig.GetBinaryName());
if (!File.Exists(binaryPath) || !Environment.GetEnvironmentVariable("PATH").Contains(binaryPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void BeforeTest()
public void Should_BePossibleTo_PerformActions()
{
var sliderForm = new SliderForm();
Assert.IsTrue(sliderForm.IsDisplayed, "Slider Form is not opened");
Assert.IsTrue(sliderForm.State.WaitForDisplayed(), "Slider Form is not opened");

sliderForm.ClickNextButton();
sliderForm.ClickNextButton();
Expand All @@ -47,7 +47,7 @@ public void Should_BePossibleTo_PerformActions()

shoppingCardSummaryForm.ClickProceedToCheckoutButton();
var authForm = new AuthenticationForm();
Assert.IsTrue(authForm.IsDisplayed, "Authentication Form is not opened");
Assert.IsTrue(authForm.State.WaitForDisplayed(), "Authentication Form is not opened");

var cartMenuForm = new CartMenuForm();
cartMenuForm.OpenCartMenu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

"driverSettings": {
"chrome": {
"webDriverVersion": "83.0.4103.39",
"webDriverVersion": "MatchingBrowser",
"capabilities": {
"enableVNC": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

"driverSettings": {
"chrome": {
"webDriverVersion": "Latest",
"webDriverVersion": "MatchingBrowser",
"capabilities": {
"enableVNC": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Aquality.Selenium.Tests.Unit
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
[Parallelizable(ParallelScope.Children)]
internal class LocalizationManagerTests
{
private const string LocalizedNavigationMessage = "Navigate to url - 'test'";
Expand Down

0 comments on commit 2847889

Please sign in to comment.