Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into feat/resharper
Browse files Browse the repository at this point in the history
  • Loading branch information
agray committed Sep 26, 2024
2 parents 778d095 + 51cc954 commit b4cf1a6
Show file tree
Hide file tree
Showing 38 changed files with 265 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Saucery" Version="4.5.4" />
<PackageReference Include="Saucery" Version="4.5.5" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion ExternalMerlin.NUnit/ExternalMerlin.NUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Saucery" Version="4.5.4" />
<PackageReference Include="Saucery" Version="4.5.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Saucery.XUnit" Version="4.5.4" />
<PackageReference Include="Saucery.XUnit" Version="4.5.5" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion ExternalMerlin.XUnit/ExternalMerlin.XUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Saucery.XUnit" Version="4.5.4" />
<PackageReference Include="Saucery.XUnit" Version="4.5.5" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Merlin.NUnit.RealDevices/Merlin.NUnit.RealDevices.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="RestSharp" Version="112.0.0" />
<PackageReference Include="Selenium.Support" Version="4.24.0" />
<PackageReference Include="Selenium.Support" Version="4.25.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Merlin.NUnit/Merlin.NUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="RestSharp" Version="112.0.0" />
<PackageReference Include="Selenium.Support" Version="4.24.0" />
<PackageReference Include="Selenium.Support" Version="4.25.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Merlin.XUnit.RealDevices/Merlin.XUnit.RealDevices.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="Meziantou.Xunit.ParallelTestFramework" Version="2.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit" Version="2.9.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion Merlin.XUnit/Merlin.XUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="Meziantou.Xunit.ParallelTestFramework" Version="2.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit" Version="2.9.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions Saucery.Core.Tests/AndroidFactoryVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public void AppiumAndroidOptionTest(SaucePlatform saucePlatform)
var factory = new OptionFactory(validPlatform);
factory.ShouldNotBeNull();

var opts = factory.CreateOptions("AppiumAndroidOptionTest");
opts.ShouldNotBeNull();
var tuple = factory.CreateOptions("AppiumAndroidOptionTest");
tuple.opts.ShouldNotBeNull();
}
}
public class AndroidDataClass
Expand Down
4 changes: 2 additions & 2 deletions Saucery.Core.Tests/DesktopFactoryVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void DesktopOptionTest(SaucePlatform saucePlatform)
var factory = new OptionFactory(validplatform);
factory.ShouldNotBeNull();

var opts = factory.CreateOptions("DesktopOptionTest");
opts.ShouldNotBeNull();
var tuple = factory.CreateOptions("DesktopOptionTest");
tuple.opts.ShouldNotBeNull();
}
}
public class DesktopDataClass
Expand Down
4 changes: 2 additions & 2 deletions Saucery.Core.Tests/IOSFactoryVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public void AppiumIOSOptionTest(SaucePlatform saucePlatform)
var factory = new OptionFactory(validPlatform);
factory.ShouldNotBeNull();

var opts = factory.CreateOptions("AppiumIOSOptionTest");
opts.ShouldNotBeNull();
var tuple = factory.CreateOptions("AppiumIOSOptionTest");
tuple.opts.ShouldNotBeNull();
}
}
public class IOSDataClass
Expand Down
11 changes: 10 additions & 1 deletion Saucery.Core.Tests/RESTTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NUnit.Framework;
using NUnit.Framework.Constraints;
using Saucery.Core.Dojo;
using Saucery.Core.Dojo.Platforms.Base;
using Saucery.Core.Dojo.Platforms.ConcreteProducts.Apple;
Expand Down Expand Up @@ -26,7 +27,15 @@ public void Setup()
public void FlowControlTest() {
var flowController = new SauceLabsFlowController();
//Console.WriteLine(@"RESTTests: About to call ControlFlow()");
flowController.ControlFlow();
flowController.ControlFlow(false);
}

[Test]
public void FlowControlTestRealDevice()
{
var flowController = new SauceLabsFlowController();
//Console.WriteLine(@"RESTTests: About to call ControlFlow()");
flowController.ControlFlow(true);
}

[Test]
Expand Down
4 changes: 2 additions & 2 deletions Saucery.Core.Tests/RealAndroidFactoryVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public void AppiumAndroidOptionTest(SaucePlatform saucePlatform)
var factory = new OptionFactory(validPlatform);
factory.ShouldNotBeNull();

var opts = factory.CreateOptions("AppiumRealAndroidOptionTest");
opts.ShouldNotBeNull();
var tuple = factory.CreateOptions("AppiumRealAndroidOptionTest");
tuple.opts.ShouldNotBeNull();
}
}
public class RealAndroidDataClass
Expand Down
4 changes: 2 additions & 2 deletions Saucery.Core.Tests/RealIOSFactoryVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public void AppiumIOSOptionTest(SaucePlatform saucePlatform)
var factory = new OptionFactory(validPlatform);
factory.ShouldNotBeNull();

var opts = factory.CreateOptions("AppiumRealIOSOptionTest");
opts.ShouldNotBeNull();
var tuple = factory.CreateOptions("AppiumRealIOSOptionTest");
tuple.opts.ShouldNotBeNull();
}
}
public class RealIOSDataClass
Expand Down
2 changes: 1 addition & 1 deletion Saucery.Core.Tests/Saucery.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="RestSharp" Version="112.0.0" />
<PackageReference Include="Selenium.Support" Version="4.24.0" />
<PackageReference Include="Selenium.Support" Version="4.25.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
</ItemGroup>

Expand Down
17 changes: 8 additions & 9 deletions Saucery.Core/DataSources/SauceryTestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,25 @@ protected static void SetPlatforms(List<SaucePlatform> platforms)
BrowserVersions = platformConfigurator.FilterAll(expandedPlatforms);
}

public static IEnumerable<BrowserVersion> Items => BrowserVersions!.Select(x => x).AsEnumerable();
public static IEnumerable<BrowserVersion> Items =>
BrowserVersions!
.Select(x => x)
.AsEnumerable();

protected static IEnumerable<object[]> GetAllCombinations(object[] data) {
List<object[]> allCombinations = [];

foreach(var platform in Items) {
foreach(var datum in data) {
allCombinations.Add([platform, datum]);
}
foreach(var platform in Items)
{
allCombinations.AddRange(data.Select(datum => (object[]) [platform, datum]));
}

return allCombinations;
}

protected static IEnumerable<object[]> GetAllPlatforms() {
List<object[]> allPlatforms = [];

foreach(var platform in Items) {
allPlatforms.Add([platform]);
}
allPlatforms.AddRange(Items.Select(platform => (object[]) [platform]));

return allPlatforms.AsEnumerable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ namespace Saucery.Core.Dojo.Browsers.ConcreteCreators.Apple;

internal class IOSBrowserCreator(SupportedPlatform sp) : BrowserCreator(sp)
{
public override BrowserBase? Create(string platformNameForOption, List<string> screenResolutions) => new IOSBrowser(Platform, screenResolutions, platformNameForOption);
public override BrowserBase? Create(string platformNameForOption, List<string> screenResolutions) =>
new IOSBrowser(Platform, screenResolutions, platformNameForOption);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ namespace Saucery.Core.Dojo.Browsers.ConcreteCreators.Google;

internal class AndroidBrowserCreator(SupportedPlatform sp) : BrowserCreator(sp)
{
public override BrowserBase? Create(string platformNameForOption, List<string> screenResolutions) => new AndroidBrowser(Platform, platformNameForOption);
public override BrowserBase? Create(string platformNameForOption, List<string> screenResolutions) =>
new AndroidBrowser(Platform, platformNameForOption);
}
77 changes: 48 additions & 29 deletions Saucery.Core/Dojo/DojoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,27 @@ private static void AddVersion(this BrowserBase b, List<BrowserBase> browsers, S
_ => null
};

var browsers = platform?.Browsers.Find(b => b.Os.Equals(sp.Os, StringComparison.Ordinal) && b.Name.ToLower().Equals(sp.Browser.ToLower()));

if (browsers == null) { return null; }
var browsers = platform?.Browsers.Find(b =>
b.Os.Equals(sp.Os, StringComparison.Ordinal) &&
b.Name.ToLower().Equals(sp.Browser.ToLower()));

if (browsers == null)
{
return null;
}

return sp.ScreenResolution == string.Empty
? browsers.BrowserVersions.Find(v => v.Os.Equals(sp.Os, StringComparison.Ordinal) && v.BrowserName.ToLower().Equals(sp.Browser.ToLower()) && v.Name!.ToLower().Equals(sp.BrowserVersion.ToLower()))
: browsers.BrowserVersions.Find(v => v.Os.Equals(sp.Os, StringComparison.Ordinal) && v.BrowserName.ToLower().Equals(sp.Browser.ToLower()) && v.Name!.ToLower().Equals(sp.BrowserVersion.ToLower()) && v.ScreenResolutions.Contains(sp.ScreenResolution));
? browsers.BrowserVersions
.Find(v =>
v.Os.Equals(sp.Os, StringComparison.Ordinal) &&
v.BrowserName.ToLower().Equals(sp.Browser.ToLower()) &&
v.Name!.ToLower().Equals(sp.BrowserVersion.ToLower()))
: browsers.BrowserVersions
.Find(v =>
v.Os.Equals(sp.Os, StringComparison.Ordinal) &&
v.BrowserName.ToLower().Equals(sp.Browser.ToLower()) &&
v.Name!.ToLower().Equals(sp.BrowserVersion.ToLower()) &&
v.ScreenResolutions.Contains(sp.ScreenResolution));
}

public static BrowserVersion? FindAndroidBrowser(this List<PlatformBase> platforms, SaucePlatform sp)
Expand All @@ -175,16 +189,20 @@ private static void AddVersion(this BrowserBase b, List<BrowserBase> browsers, S
_ => platform
};

var browsers = platform?.Browsers.Find(b => b.Os.Equals(sp.Os, StringComparison.Ordinal) && b.DeviceName.Equals(sp.LongName, StringComparison.Ordinal));
var browsers = platform?.Browsers
.Find(b =>
b.Os.Equals(sp.Os, StringComparison.Ordinal) &&
b.DeviceName.Equals(sp.LongName, StringComparison.Ordinal));

return browsers == null
? null
: browsers.BrowserVersions.Count == 1
? browsers.BrowserVersions[0]
: browsers.BrowserVersions
.Find(v => v.Os.Equals(sp.Os, StringComparison.Ordinal) &&
v.DeviceName.Equals(sp.LongName, StringComparison.Ordinal)
&& v.Name!.Equals(sp.BrowserVersion, StringComparison.Ordinal));
: browsers.BrowserVersions.Count == 1
? browsers.BrowserVersions[0]
: browsers.BrowserVersions
.Find(v =>
v.Os.Equals(sp.Os, StringComparison.Ordinal) &&
v.DeviceName.Equals(sp.LongName, StringComparison.Ordinal) &&
v.Name!.Equals(sp.BrowserVersion, StringComparison.Ordinal));
}

public static PlatformBase FindAndroidPlatform(this List<PlatformBase> platforms, SaucePlatform sp) {
Expand Down Expand Up @@ -236,19 +254,19 @@ public static PlatformBase FindAndroidPlatform(this List<PlatformBase> platforms
};

var browsers = platform?.Browsers
.Find(b => b.PlatformNameForOption
.Equals(sp.Os, StringComparison.Ordinal) &&
b.DeviceName.Equals(sp.LongName, StringComparison.Ordinal));
.Find(b =>
b.PlatformNameForOption.Equals(sp.Os, StringComparison.Ordinal) &&
b.DeviceName.Equals(sp.LongName, StringComparison.Ordinal));

return browsers == null
? null
: browsers.BrowserVersions.Count == 1
? browsers.BrowserVersions[0]
: browsers.BrowserVersions
.Find(v => v.PlatformNameForOption
.Equals(sp.Os, StringComparison.Ordinal) &&
v.DeviceName.Equals(sp.LongName, StringComparison.Ordinal) &&
v.Name!.Equals(sp.BrowserVersion, StringComparison.Ordinal));
: browsers.BrowserVersions.Count == 1
? browsers.BrowserVersions[0]
: browsers.BrowserVersions
.Find(v =>
v.PlatformNameForOption.Equals(sp.Os, StringComparison.Ordinal) &&
v.DeviceName.Equals(sp.LongName, StringComparison.Ordinal) &&
v.Name!.Equals(sp.BrowserVersion, StringComparison.Ordinal));
}

public static PlatformBase FindIOSPlatform(this List<PlatformBase> platforms, SaucePlatform sp) {
Expand All @@ -268,16 +286,17 @@ public static PlatformBase FindIOSPlatform(this List<PlatformBase> platforms, Sa
return platform!;
}

private static BrowserBase? FindBrowser(this IEnumerable<BrowserBase> browsers, SupportedPlatform sp) => browsers
.FirstOrDefault(b => b.Name
.Equals(sp.api_name, StringComparison.Ordinal) &&
private static BrowserBase? FindBrowser(this IEnumerable<BrowserBase> browsers, SupportedPlatform sp) =>
browsers.FirstOrDefault(b =>
b.Name.Equals(sp.api_name, StringComparison.Ordinal) &&
b.DeviceName.Equals(sp.long_name, StringComparison.Ordinal) &&
b.Os.Equals(sp.Os, StringComparison.Ordinal));

private static BrowserBase? FindRealBrowser(this IEnumerable<BrowserBase> browsers, SupportedPlatform sp) => browsers
.FirstOrDefault(b => b.Name.Equals(sp.api_name, StringComparison.Ordinal) &&
b.DeviceName.Equals(sp.long_name, StringComparison.Ordinal) &&
b.Os.Equals(sp.Os, StringComparison.Ordinal));
private static BrowserBase? FindRealBrowser(this IEnumerable<BrowserBase> browsers, SupportedPlatform sp) =>
browsers.FirstOrDefault(b =>
b.Name.Equals(sp.api_name, StringComparison.Ordinal) &&
b.DeviceName.Equals(sp.long_name, StringComparison.Ordinal) &&
b.Os.Equals(sp.Os, StringComparison.Ordinal));

public static BrowserVersion Classify(this BrowserVersion browserVersion)
{
Expand Down
Loading

0 comments on commit b4cf1a6

Please sign in to comment.