Skip to content

Commit 8ffb74f

Browse files
authored
Update to Selenium v.4.36.0, update core to migrate from Newthonsoft.Json to System.Text.Json +semver: feature (#275)
* Update to Selenium v.4.36.0, update core to migrate from Newthonsoft.Json to System.Text.Json +semver: feature * Update core version, stabilize tests, update DevTools references to use V140 * Stabilize findByImage test fixes #274
1 parent c45cc40 commit 8ffb74f

File tree

9 files changed

+28
-24
lines changed

9 files changed

+28
-24
lines changed

Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
</ItemGroup>
9292

9393
<ItemGroup>
94-
<PackageReference Include="Aquality.Selenium.Core" Version="3.5.0" />
94+
<PackageReference Include="Aquality.Selenium.Core" Version="4.1.0" />
9595
<PackageReference Include="WebDriverManager" Version="2.17.6" />
9696
</ItemGroup>
9797

Aquality.Selenium/src/Aquality.Selenium/Aquality.Selenium.xml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsEmulationExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Aquality.Selenium.Core.Utilities;
22
using OpenQA.Selenium.DevTools;
3-
using OpenQA.Selenium.DevTools.V138.DOM;
4-
using OpenQA.Selenium.DevTools.V138.Emulation;
3+
using OpenQA.Selenium.DevTools.V140.DOM;
4+
using OpenQA.Selenium.DevTools.V140.Emulation;
55
using System;
66
using System.Collections.Generic;
77
using System.Linq;

Aquality.Selenium/src/Aquality.Selenium/Browsers/DevToolsPerformanceExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using OpenQA.Selenium.DevTools.V138.Performance;
1+
using OpenQA.Selenium.DevTools.V140.Performance;
22
using System.Collections.Generic;
33
using System.Globalization;
44
using System.Linq;

Aquality.Selenium/tests/Aquality.Selenium.Tests/Aquality.Selenium.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030

3131
<ItemGroup>
3232
<PackageReference Include="nunit" Version="4.4.0" />
33-
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0">
33+
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0">
3434
<PrivateAssets>all</PrivateAssets>
3535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3636
</PackageReference>
37-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
37+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
3838
</ItemGroup>
3939

4040
<ItemGroup>

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/DevToolsEmulationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ public void Should_BePossibleTo_SetAndClearDeviceMetricsOverride_WithVersionSpec
5959
{
6060
void setAction(long width, long height, bool isMobile, double scaleFactor)
6161
{
62-
var parameters = new OpenQA.Selenium.DevTools.V138.Emulation.SetDeviceMetricsOverrideCommandSettings
62+
var parameters = new SetDeviceMetricsOverrideCommandSettings
6363
{
64-
DisplayFeature = new OpenQA.Selenium.DevTools.V138.Emulation.DisplayFeature
64+
DisplayFeature = new DisplayFeature
6565
{
66-
Orientation = OpenQA.Selenium.DevTools.V138.Emulation.DisplayFeatureOrientationValues.Horizontal
66+
Orientation = DisplayFeatureOrientationValues.Horizontal
6767
},
6868
Width = width,
6969
Height = height,

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/ImageLocatorTests.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Aquality.Selenium.Tests.Integration
99
{
1010
internal class ImageLocatorTests : UITest
1111
{
12+
private const string ImageTag = "img";
1213
private readonly BrokenImagesForm form = new();
1314

1415
[Test, Category(RetriesGroup), Retry(RetriesCount)]
@@ -18,26 +19,26 @@ public void Should_BePossibleTo_FindByImage()
1819
Assert.That(form.LabelByImage.State.IsDisplayed, Is.False, "Should be impossible to find element on page by image when it is absent");
1920
form.Open();
2021
Assert.That(form.LabelByImage.State.IsDisplayed, "Should be possible to find element on page by image");
21-
Assert.That(form.LabelByImage.GetElement().TagName, Is.EqualTo("img"), "Correct element must be found");
22+
Assert.That(form.LabelByImage.GetElement().TagName, Is.EqualTo(ImageTag), "Correct element must be found");
2223

2324
var childLabels = form.ChildLabelsByImage;
2425
var docLabels = form.LabelsByImage;
2526
Assert.That(docLabels.Count, Is.GreaterThan(1), "List of elements should be possible to find by image");
2627
Assert.That(docLabels.Count, Is.EqualTo(childLabels.Count), "Should be possible to find child elements by image with the same count");
2728

28-
var documentByTag = AqualityServices.Get<IElementFactory>().GetLabel(By.TagName("body"), "document by tag");
29+
var imageByTag = AqualityServices.Get<IElementFactory>().GetLabel(By.TagName(ImageTag), "Image by tag");
2930
var fullThreshold = 1;
30-
var getDocByImage = () => AqualityServices.Get<IElementFactory>().GetLabel(new ByImage(documentByTag.GetElement().GetScreenshot().AsByteArray) { Threshold = fullThreshold },
31-
"body screen");
31+
var getDocByImage = () => AqualityServices.Get<IElementFactory>().GetLabel(new ByImage(imageByTag.GetElement().GetScreenshot().AsByteArray) { Threshold = fullThreshold },
32+
"image by screenshot");
3233
ILabel documentByImage = getDocByImage();
33-
AqualityServices.ConditionalWait.WaitForTrue(() =>
34+
AqualityServices.ConditionalWait.WaitFor(() =>
3435
{
3536
documentByImage = getDocByImage();
3637
return documentByImage.State.IsDisplayed;
3738
});
38-
Assert.That(documentByImage.State.IsDisplayed, "Should be possible to find element by document screenshot");
39+
Assert.That(documentByImage.State.IsDisplayed, "Should be possible to find element by screenshot");
3940
Assert.That((documentByImage.Locator as ByImage)?.Threshold, Is.EqualTo(fullThreshold), "Should be possible to get ByImage threshold");
40-
Assert.That(documentByImage.GetElement().TagName, Is.EqualTo("body"), "Correct element must be found");
41+
Assert.That(documentByImage.GetElement().TagName, Is.EqualTo(ImageTag), "Correct element must be found");
4142
}
4243
}
4344
}

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/TestApp/MyLocation/LocationForm.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ public LocationForm() : base(By.Id("accordion"), "My Location")
2323

2424
public void DismissCookieInfo()
2525
{
26-
consentCookieInfoButton.Click();
27-
consentCookieInfoButton.State.WaitForNotDisplayed();
26+
if (consentCookieInfoButton.State.WaitForDisplayed())
27+
{
28+
consentCookieInfoButton.Click();
29+
consentCookieInfoButton.State.WaitForNotDisplayed();
30+
}
2831
if (gotItCookieButton.State.WaitForDisplayed())
2932
{
3033
gotItCookieButton.Click();

Aquality.Selenium/tests/Aquality.Selenium.Tests/Integration/Usecases/CustomBrowserFactoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void Should_BePossibleToUse_BrowserFromCustomFactory()
2424
var browserFactory = new CustomLocalBrowserFactory();
2525
AqualityServices.Browser = browserFactory.Browser;
2626
AqualityServices.Browser.GoTo(url);
27-
Assert.That(AqualityServices.Browser.CurrentUrl, Is.EqualTo(url));
27+
Assert.That(AqualityServices.Browser.CurrentUrl, Does.StartWith(url));
2828
}
2929

3030
[Test]
@@ -33,7 +33,7 @@ public void Should_BePossibleToUse_CustomFactory()
3333
var browserFactory = new CustomLocalBrowserFactory();
3434
AqualityServices.BrowserFactory = browserFactory;
3535
AqualityServices.Browser.GoTo(url);
36-
Assert.That(AqualityServices.Browser.CurrentUrl, Is.EqualTo(url));
36+
Assert.That(AqualityServices.Browser.CurrentUrl, Does.StartWith(url));
3737
}
3838

3939
[TearDown]

0 commit comments

Comments
 (0)