-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into feat/resharper
- Loading branch information
Showing
18 changed files
with
362 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Saucery.Core.Dojo; | ||
using Saucery.Tests.Common.PageObjects; | ||
using Saucery.TUnit; | ||
using Shouldly; | ||
|
||
namespace Merlin.TUnit; | ||
|
||
public class ClickLinkTests : SauceryTBase | ||
{ | ||
[Test] | ||
[MethodDataSource(typeof(RequestedPlatformData), nameof(RequestedPlatformData.AllPlatforms))] | ||
public async Task ClickLinkTest( | ||
BrowserVersion requestedPlatform | ||
) | ||
{ | ||
//int i = 0; | ||
//i++; | ||
|
||
InitialiseDriver(requestedPlatform); | ||
|
||
var guineaPigPage = new GuineaPigPage(SauceryDriver(), "https://saucelabs.com/"); | ||
|
||
guineaPigPage.ClickLink(SauceryDriver()); | ||
|
||
// verify the browser was navigated to the correct page | ||
Driver!.Url.ShouldContain("saucelabs.com/test-guinea-pig2.html"); | ||
} | ||
} | ||
/* | ||
* Copyright Andrew Gray, SauceForge | ||
* Date: 16th April 2023 | ||
* | ||
*/ |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector" Version="6.0.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.msbuild" Version="6.0.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="TUnit" Version="0.4.74" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Saucery.Core\Saucery.Core.csproj" /> | ||
<ProjectReference Include="..\Saucery.Tests.Common\Saucery.Tests.Common.csproj" /> | ||
<ProjectReference Include="..\Saucery.TUnit\Saucery.TUnit.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Saucery.Core.DataSources; | ||
using Saucery.Core.Dojo; | ||
using Saucery.Core.OnDemand; | ||
using Saucery.Core.OnDemand.Base; | ||
using Saucery.Core.Util; | ||
|
||
namespace Merlin.TUnit; | ||
|
||
public class RequestedPlatformData : SauceryTestData | ||
{ | ||
static RequestedPlatformData() | ||
{ | ||
var platforms = new List<SaucePlatform> | ||
{ | ||
//Emulated Mobile Platforms | ||
new AndroidPlatform("Google Pixel 8 Pro GoogleAPI Emulator", "15.0", SauceryConstants.DEVICE_ORIENTATION_PORTRAIT), | ||
new IOSPlatform("iPhone 14 Pro Max Simulator", "16.2", SauceryConstants.DEVICE_ORIENTATION_LANDSCAPE), | ||
|
||
//Desktop Platforms | ||
new DesktopPlatform(SauceryConstants.PLATFORM_LINUX, SauceryConstants.BROWSER_CHROME, SauceryConstants.BROWSER_VERSION_LATEST), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_11, SauceryConstants.BROWSER_CHROME, "100->119", SauceryConstants.SCREENRES_2560_1600), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_10, SauceryConstants.BROWSER_CHROME, SauceryConstants.BROWSER_VERSION_LATEST, SauceryConstants.SCREENRES_2560_1600), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_81, SauceryConstants.BROWSER_CHROME, "100", SauceryConstants.SCREENRES_800_600), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_8, SauceryConstants.BROWSER_FIREFOX, "latest"), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_8, SauceryConstants.BROWSER_FIREFOX, "latest", SauceryConstants.SCREENRES_800_600), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_MAC_11, SauceryConstants.BROWSER_CHROME, SauceryConstants.BROWSER_VERSION_LATEST), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_MAC_12, SauceryConstants.BROWSER_CHROME, SauceryConstants.BROWSER_VERSION_LATEST), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_MAC_13, SauceryConstants.BROWSER_CHROME, SauceryConstants.BROWSER_VERSION_LATEST), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_MAC_1015, SauceryConstants.BROWSER_SAFARI, "15", SauceryConstants.SCREENRES_800_600), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_10, SauceryConstants.BROWSER_IE, "11"), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_10, SauceryConstants.BROWSER_IE, "11", SauceryConstants.SCREENRES_800_600), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_10, SauceryConstants.BROWSER_EDGE, "99"), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_10, SauceryConstants.BROWSER_EDGE, "99", SauceryConstants.SCREENRES_800_600) | ||
}; | ||
|
||
SetPlatforms(platforms); | ||
} | ||
|
||
public static IEnumerable<BrowserVersion> AllPlatforms() => (IEnumerable<BrowserVersion>)GetAllPlatforms(); | ||
} | ||
/* | ||
* Copyright Andrew Gray, SauceForge | ||
* Date: 12th July 2024 | ||
* | ||
*/ |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.13.1" /> | ||
<PackageReference Include="TUnit" Version="0.4.74" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Sandbox.TUnit | ||
{ | ||
public class Sandbox | ||
{ | ||
[Test] | ||
public async Task MyTest() | ||
{ | ||
var result = Add(1, 2); | ||
|
||
await Assert.That(result).IsEqualTo(3); | ||
} | ||
|
||
private int Add(int x, int y) | ||
{ | ||
return x + y; | ||
} | ||
|
||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ry.Core.Tests/Issue1118/Base/BaseClass.cs → ...re.Tests/NUnitIssue1118/Base/BaseClass.cs
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
4 changes: 2 additions & 2 deletions
4
Saucery.Core.Tests/Issue1118/Fixture.cs → Saucery.Core.Tests/NUnitIssue1118/Fixture.cs
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
4 changes: 2 additions & 2 deletions
4
Saucery.Core.Tests/Issue1118/Fixture2.cs → ...ery.Core.Tests/NUnitIssue1118/Fixture2.cs
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
2 changes: 1 addition & 1 deletion
2
Saucery.Core.Tests/Issue1118/SourceData.cs → ...y.Core.Tests/NUnitIssue1118/SourceData.cs
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Appium.Android; | ||
using OpenQA.Selenium.Appium.iOS; | ||
using OpenQA.Selenium.Appium.Service; | ||
using Saucery.Core.Dojo; | ||
using Saucery.Core.Driver; | ||
using Saucery.Core.OnDemand; | ||
using Saucery.Core.Options; | ||
using Saucery.Core.RestAPI.FlowControl; | ||
using Saucery.Core.RestAPI.TestStatus; | ||
using Saucery.Core.Util; | ||
|
||
namespace Saucery.TUnit; | ||
|
||
public class BaseFixture | ||
{ | ||
public WebDriver? Driver; | ||
|
||
internal readonly SauceLabsStatusNotifier SauceLabsStatusNotifier = new(); | ||
|
||
private readonly SauceLabsFlowController SauceLabsFlowController = new(); | ||
|
||
public OptionFactory? OptionFactory; | ||
|
||
private readonly AppiumClientConfig AppiumClientConfig = new() { DirectConnect = true }; | ||
|
||
public bool InitialiseDriver((DriverOptions opts, BrowserVersion browserVersion) tuple, int waitSecs) | ||
{ | ||
SauceLabsFlowController.ControlFlow(tuple.browserVersion.IsARealDevice()); | ||
try | ||
{ | ||
Driver = OptionFactory!.IsApple() | ||
? new IOSDriver( | ||
new Uri(SauceryConstants.SAUCELABS_HUB), | ||
tuple.opts, | ||
TimeSpan.FromSeconds(waitSecs), | ||
AppiumClientConfig) | ||
: OptionFactory!.IsAndroid() | ||
? new AndroidDriver( | ||
new Uri(SauceryConstants.SAUCELABS_HUB), | ||
tuple.opts, | ||
TimeSpan.FromSeconds(waitSecs), | ||
AppiumClientConfig) | ||
: new SauceryRemoteWebDriver( | ||
new Uri(SauceryConstants.SAUCELABS_HUB), | ||
tuple.opts, | ||
waitSecs); | ||
|
||
return true; | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine(ex.Message); | ||
return false; | ||
} | ||
} | ||
|
||
//public void Dispose() { | ||
// GC.SuppressFinalize(this); | ||
// if (Driver is not null) | ||
// { | ||
// Driver.Quit(); | ||
// Driver.Dispose(); | ||
// } | ||
|
||
// OptionFactory?.Dispose(); | ||
//} | ||
|
||
public WebDriver SauceryDriver() => | ||
Driver!; | ||
} | ||
/* | ||
* Copyright Andrew Gray, SauceForge | ||
* Date: 7th December 2024 | ||
* | ||
*/ |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="TUnit" Version="0.4.74" /> | ||
<PackageReference Include="TUnit.Core" Version="0.4.74" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Saucery.Core\Saucery.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Images\" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.