-
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.
- Loading branch information
Showing
20 changed files
with
341 additions
and
119 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,31 @@ | ||
using ExternalMerlin.TUnit.RealDevices; | ||
using Saucery.Core.Dojo; | ||
using Saucery.Tests.Common.PageObjects; | ||
using Saucery.TUnit; | ||
using Shouldly; | ||
|
||
[assembly: ParallelLimiter<MyParallelLimit>] | ||
|
||
namespace ExternalMerlin.TUnit.RealDevices; | ||
|
||
public class ClickLinkTests : SauceryTBase | ||
{ | ||
[Test] | ||
[MethodDataSource(typeof(RequestedPlatformData), nameof(RequestedPlatformData.AllPlatforms))] | ||
public async Task ClickLinkTest(BrowserVersion requestedPlatform) | ||
{ | ||
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: 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,38 @@ | ||
using Saucery.Core.Dojo; | ||
using Saucery.Tests.Common.PageObjects; | ||
using Saucery.TUnit; | ||
|
||
namespace ExternalMerlin.TUnit.RealDevices; | ||
|
||
public class DataDrivenTests : SauceryTBase | ||
{ | ||
[Test] | ||
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])] | ||
public Task DataDrivenTest(BrowserVersion requestedPlatform, int data) | ||
{ | ||
InitialiseDriver(requestedPlatform); | ||
|
||
var guineaPigPage = new GuineaPigPage(SauceryDriver(), "https://saucelabs.com/"); | ||
|
||
guineaPigPage.TypeField(SauceryDriver(), "comments", data.ToString()); | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public static IEnumerable<(BrowserVersion, int)> AllCombinations(int[] data) | ||
{ | ||
foreach (var browserVersion in RequestedPlatformData.AllPlatformsAsList()) | ||
{ | ||
foreach (var datum in data) | ||
{ | ||
yield return (browserVersion, datum); | ||
} | ||
} | ||
} | ||
} | ||
|
||
/* | ||
* 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
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,8 @@ | ||
using TUnit.Core.Interfaces; | ||
|
||
namespace ExternalMerlin.TUnit.RealDevices; | ||
|
||
public record MyParallelLimit : IParallelLimit | ||
{ | ||
public int Limit => 3; | ||
} |
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,34 @@ | ||
using Saucery.Core.DataSources; | ||
using Saucery.Core.Dojo; | ||
using Saucery.Core.OnDemand; | ||
using Saucery.Core.OnDemand.Base; | ||
using Saucery.Core.Util; | ||
|
||
namespace ExternalMerlin.TUnit.RealDevices; | ||
|
||
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_WINDOWS_11, SauceryConstants.BROWSER_CHROME, "123"), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_10, SauceryConstants.BROWSER_CHROME, "124", SauceryConstants.SCREENRES_2560_1600) | ||
}; | ||
|
||
SetPlatforms(platforms); | ||
} | ||
|
||
public static List<Func<BrowserVersion>> AllPlatforms() => GetAllPlatformsAsFunc(); | ||
public static List<BrowserVersion> AllPlatformsAsList() => GetAllPlatformsAsList(); | ||
} | ||
/* | ||
* 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,31 @@ | ||
using ExternalMerlin.TUnit; | ||
using Saucery.Core.Dojo; | ||
using Saucery.Tests.Common.PageObjects; | ||
using Saucery.TUnit; | ||
using Shouldly; | ||
|
||
[assembly: ParallelLimiter<MyParallelLimit>] | ||
|
||
namespace ExternalMerlin.TUnit; | ||
|
||
public class ClickLinkTests : SauceryTBase | ||
{ | ||
[Test] | ||
[MethodDataSource(typeof(RequestedPlatformData), nameof(RequestedPlatformData.AllPlatforms))] | ||
public async Task ClickLinkTest(BrowserVersion requestedPlatform) | ||
{ | ||
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: 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,36 @@ | ||
using Saucery.Core.Dojo; | ||
using Saucery.Tests.Common.PageObjects; | ||
using Saucery.TUnit; | ||
|
||
namespace ExternalMerlin.TUnit; | ||
|
||
public class DataDrivenTests : SauceryTBase | ||
{ | ||
[Test] | ||
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])] | ||
public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data) | ||
{ | ||
InitialiseDriver(requestedPlatform); | ||
|
||
var guineaPigPage = new GuineaPigPage(SauceryDriver(), "https://saucelabs.com/"); | ||
|
||
guineaPigPage.TypeField(SauceryDriver(), "comments", data.ToString()); | ||
} | ||
|
||
public static IEnumerable<(BrowserVersion, int)> AllCombinations(int[] data) | ||
{ | ||
foreach (var browserVersion in RequestedPlatformData.AllPlatformsAsList()) | ||
{ | ||
foreach (var datum in data) | ||
{ | ||
yield return (browserVersion, datum); | ||
} | ||
} | ||
} | ||
} | ||
|
||
/* | ||
* 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
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,8 @@ | ||
using TUnit.Core.Interfaces; | ||
|
||
namespace ExternalMerlin.TUnit; | ||
|
||
public record MyParallelLimit : IParallelLimit | ||
{ | ||
public int Limit => 3; | ||
} |
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,34 @@ | ||
using Saucery.Core.DataSources; | ||
using Saucery.Core.Dojo; | ||
using Saucery.Core.OnDemand; | ||
using Saucery.Core.OnDemand.Base; | ||
using Saucery.Core.Util; | ||
|
||
namespace ExternalMerlin.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_WINDOWS_11, SauceryConstants.BROWSER_CHROME, "123"), | ||
new DesktopPlatform(SauceryConstants.PLATFORM_WINDOWS_10, SauceryConstants.BROWSER_CHROME, "124", SauceryConstants.SCREENRES_2560_1600) | ||
}; | ||
|
||
SetPlatforms(platforms); | ||
} | ||
|
||
public static List<Func<BrowserVersion>> AllPlatforms() => GetAllPlatformsAsFunc(); | ||
public static List<BrowserVersion> AllPlatformsAsList() => GetAllPlatformsAsList(); | ||
} | ||
/* | ||
* 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
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
Oops, something went wrong.