Skip to content

Commit

Permalink
Update Selenium version to 4.23.0 (#259)
Browse files Browse the repository at this point in the history
* Update Selenium version to 4.23.0 +semver:feature
- Add async methods to BrowserNavigation proxy

* Update the pipeline, add missed BackAsync implementation
  • Loading branch information
mialeska authored Jul 29, 2024
1 parent 77f9255 commit 3dce554
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aquality.Selenium.Core" Version="3.0.9" />
<PackageReference Include="Aquality.Selenium.Core" Version="3.0.12" />
<PackageReference Include="OpenCvSharp4.runtime.osx_arm64" Version="4.8.1-rc" />
<PackageReference Include="WebDriverManager" Version="2.17.4" />
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20240616" />
Expand Down
28 changes: 27 additions & 1 deletion Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Aquality.Selenium.Core.Localization;
using OpenQA.Selenium;
using System;
using System.Threading.Tasks;

namespace Aquality.Selenium.Browsers
{
Expand Down Expand Up @@ -28,6 +29,16 @@ public void Back()
driver.Navigate().Back();
}

/// <summary>
/// Move back a single entry in the browser's history as an asynchronous task.
/// </summary>
/// <returns>A task object representing the asynchronous operation.</returns>
public Task BackAsync()
{
Logger.Info("loc.browser.back");
return driver.Navigate().BackAsync();
}

/// <summary>
/// Navigates forward.
/// </summary>
Expand All @@ -37,6 +48,16 @@ public void Forward()
driver.Navigate().Forward();
}

/// <summary>
/// Move a single "item" forward in the browser's history as an asynchronous task.
/// </summary>
/// <returns>A task object representing the asynchronous operation.</returns>
public Task ForwardAsync()
{
Logger.Info("loc.browser.forward");
return driver.Navigate().ForwardAsync();
}

/// <summary>
/// Navigates to desired url.
/// </summary>
Expand Down Expand Up @@ -77,6 +98,28 @@ public void GoToUrl(Uri url)
}
}

/// <summary>
/// Navigate to a url as an asynchronous task.
/// </summary>
/// <param name="url">String representation of where you want the browser to go.</param>
/// <returns>A task object representing the asynchronous operation.</returns>
public Task GoToUrlAsync(string url)
{
InfoLocNavigate(url);
return driver.Navigate().GoToUrlAsync(url);
}

/// <summary>
/// Navigate to a url as an asynchronous task.
/// </summary>
/// <param name="url">Uri object of where you want the browser to go.</param>
/// <returns>A task object representing the asynchronous operation.</returns>
public Task GoToUrlAsync(Uri url)
{
InfoLocNavigate(url.ToString());
return driver.Navigate().GoToUrlAsync(url);
}

/// <summary>
/// Refreshes current page.
/// </summary>
Expand All @@ -86,6 +129,16 @@ public void Refresh()
driver.Navigate().Refresh();
}

/// <summary>
/// Reload the current page as an asynchronous task.
/// </summary>
/// <returns>A task object representing the asynchronous operation.</returns>
public Task RefreshAsync()
{
Logger.Info("loc.browser.refresh");
return driver.Navigate().RefreshAsync();
}

private void InfoLocNavigate(string url)
{
Logger.Info("loc.browser.navigate", url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Aquality.Selenium.Browsers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public FirefoxSettings(ISettingsFile settingsFile) : base(settingsFile)

protected override IDictionary<string, Action<DriverOptions, object>> KnownCapabilitySetters => new Dictionary<string, Action<DriverOptions, object>>
{
{ "binary", (options, value) => ((FirefoxOptions) options).BrowserExecutableLocation = value.ToString() },
{ "firefox_binary", (options, value) => ((FirefoxOptions) options).BrowserExecutableLocation = value.ToString() },
{ "binary", (options, value) => ((FirefoxOptions) options).BinaryLocation = value.ToString() },
{ "firefox_binary", (options, value) => ((FirefoxOptions) options).BinaryLocation = value.ToString() },
{ "firefox_profile", (options, value) => ((FirefoxOptions) options).Profile = new FirefoxProfileManager().GetProfile(value.ToString()) },
{ "log", (options, value) => ((FirefoxOptions) options).LogLevel = value.ToEnum<FirefoxDriverLogLevel>() }
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void DoubleClick()
}

/// <summary>
/// Perfroms right click on element.
/// Performs right click on element.
/// </summary>
public void RightClick()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using ICoreElementFactory = Aquality.Selenium.Core.Elements.Interfaces.IElementFactory;
using ICoreElementFinder = Aquality.Selenium.Core.Elements.Interfaces.IElementFinder;
using ICoreElementStateProvider = Aquality.Selenium.Core.Elements.Interfaces.IElementStateProvider;
using System.Collections.Generic;

namespace Aquality.Selenium.Elements
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<ItemGroup>
<PackageReference Include="nunit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0">
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public void Should_BePossibleTo_SetAndClearDeviceMetricsOverride_WithVersionSpec
{
void setAction(long width, long height, bool isMobile, double scaleFactor)
{
var parameters = new OpenQA.Selenium.DevTools.V125.Emulation.SetDeviceMetricsOverrideCommandSettings
var parameters = new OpenQA.Selenium.DevTools.V127.Emulation.SetDeviceMetricsOverrideCommandSettings
{
DisplayFeature = new OpenQA.Selenium.DevTools.V125.Emulation.DisplayFeature
DisplayFeature = new OpenQA.Selenium.DevTools.V127.Emulation.DisplayFeature
{
Orientation = OpenQA.Selenium.DevTools.V125.Emulation.DisplayFeatureOrientationValues.Horizontal
Orientation = OpenQA.Selenium.DevTools.V127.Emulation.DisplayFeatureOrientationValues.Horizontal
},
Width = width,
Height = height,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using NUnit.Framework;
using OpenQA.Selenium;
using System;
using System.Collections.Generic;

namespace Aquality.Selenium.Tests.Integration.Usecases
{
Expand Down
11 changes: 8 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ stages:
displayName: Analyse code with SonarQube

steps:
- task: SonarCloudPrepare@1
- task: SonarCloudPrepare@2
displayName: 'Prepare SonarCloud analysis'
inputs:
SonarCloud: 'SonarCloud'
organization: 'aqualityautomation'
scannerMode: 'MSBuild'
projectKey: 'aquality-automation_aquality-selenium-dotnet'
projectName: 'aquality-selenium-dotnet'
projectVersion: '$(Build.BuildNumber)'
Expand All @@ -35,12 +36,16 @@ stages:
projects: Aquality.Selenium/Aquality.Selenium.sln
arguments: -c $(buildConfiguration)

- task: SonarCloudAnalyze@1
- task: SonarCloudAnalyze@2
displayName: 'Run SonarCloud code analysis'
continueOnError: true
inputs:
jdkversion: 'JAVA_HOME_17_X64'

- task: SonarCloudPublish@1
- task: SonarCloudPublish@2
displayName: 'Publish SonarCloud quality gate results'
inputs:
pollingTimeoutSec: '300'

- job: tests
displayName: Run tests
Expand Down

0 comments on commit 3dce554

Please sign in to comment.