-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
* dojo improvement * add external tests * target real devices * fix asserts * prepare next tunit release * prepare next release
- Loading branch information
There are no files selected for viewing
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 | ||
await Assert.That(Driver!.Url).Contains("saucelabs.com/test-guinea-pig2.html"); | ||
} | ||
} | ||
/* | ||
* Copyright Andrew Gray, SauceForge | ||
* Date: 7th December 2024 | ||
* | ||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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 async Task DataDrivenTest(BrowserVersion requestedPlatform, int data) | ||
{ | ||
InitialiseDriver(requestedPlatform); | ||
|
||
var guineaPigPage = new GuineaPigPage(SauceryDriver(), "https://saucelabs.com/"); | ||
|
||
guineaPigPage.TypeField(SauceryDriver(), "comments", data.ToString()); | ||
|
||
var commentField = guineaPigPage.GetField(SauceryDriver(), "comments"); | ||
await Assert.That(commentField).IsNotNull(); | ||
|
||
var commentText = commentField.GetDomProperty("value"); | ||
await Assert.That(commentText).Contains(data.ToString()); | ||
} | ||
|
||
public static IEnumerable<(BrowserVersion, int)> AllCombinations(int[] data) => from browserVersion in RequestedPlatformData.AllPlatformsAsList() | ||
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / build
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / nunit-integration-tests
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / nunit-real-integration-tests
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / xunit-integration-tests
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / xunit-external-tests
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / nunit-external-tests
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / nunit-real-external-tests
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / xunit-real-external-tests
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / tunit-integration-tests
Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs GitHub Actions / tunit-external-tests
|
||
from datum in data | ||
select (browserVersion, datum); | ||
} | ||
|
||
/* | ||
* Copyright Andrew Gray, SauceForge | ||
* Date: 7th December 2024 | ||
* | ||
*/ |
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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Saucery.Core.DataSources; | ||
using Saucery.Core.Dojo; | ||
using Saucery.Core.OnDemand; | ||
using Saucery.Core.OnDemand.Base; | ||
|
||
namespace ExternalMerlin.TUnit.RealDevices; | ||
|
||
public class RequestedPlatformData : SauceryTestData | ||
{ | ||
static RequestedPlatformData() | ||
{ | ||
var platforms = new List<SaucePlatform> | ||
{ | ||
//Real Devices | ||
new AndroidRealDevice("Google.*", "15"), | ||
new IOSRealDevice("iPhone 14 Pro Max", "16"), | ||
}; | ||
|
||
SetPlatforms(platforms); | ||
} | ||
|
||
public static List<Func<BrowserVersion>> AllPlatforms() => GetAllPlatformsAsFunc(); | ||
public static List<BrowserVersion> AllPlatformsAsList() => GetAllPlatformsAsList(); | ||
} | ||
/* | ||
* Copyright Andrew Gray, SauceForge | ||
* Date: 12th July 2024 | ||
* | ||
*/ |
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 | ||
await Assert.That(Driver!.Url).Contains("saucelabs.com/test-guinea-pig2.html"); | ||
} | ||
} | ||
/* | ||
* Copyright Andrew Gray, SauceForge | ||
* Date: 7th December 2024 | ||
* | ||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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()); | ||
|
||
var commentField = guineaPigPage.GetField(SauceryDriver(), "comments"); | ||
await Assert.That(commentField).IsNotNull(); | ||
|
||
var commentText = commentField.GetDomProperty("value"); | ||
await Assert.That(commentText).Contains(data.ToString()); | ||
} | ||
|
||
public static IEnumerable<(BrowserVersion, int)> AllCombinations(int[] data) => from browserVersion in RequestedPlatformData.AllPlatformsAsList() | ||
Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs GitHub Actions / xunit-real-integration-tests
Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs GitHub Actions / tunit-real-integration-tests
|
||
from datum in data | ||
select (browserVersion, datum); | ||
} | ||
|
||
/* | ||
* Copyright Andrew Gray, SauceForge | ||
* Date: 7th December 2024 | ||
* | ||
*/ |
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; | ||
} |
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 | ||
* | ||
*/ |