Skip to content

Commit

Permalink
rewrite tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agray committed Dec 11, 2023
1 parent 130f3f1 commit c4d6c4d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 40 deletions.
39 changes: 19 additions & 20 deletions ExternalMerlin.XUnit/ClickLinkTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Saucery.Core.Dojo;
using Saucery.Core.OnDemand;
using Saucery.Tests.Common.PageObjects;
using Saucery.XUnit;
using Shouldly;
Expand All @@ -9,26 +8,11 @@ namespace ExternalMerlin.XUnit;

public class ClickLinkTests(ITestOutputHelper output, BaseFixture baseFixture) : SauceryXBase(output, baseFixture)
{
[Theory]
[MemberData(nameof(RequestedPlatformData.Platforms), MemberType = typeof(RequestedPlatformData))]
public void ClickLinkTest(string os,
string platformNameForOption,
string browserName,
string name,
string automationBackend,
string deviceName,
string recommendedAppiumVersion,
List<string> supportedBackendVersions,
List<string> deprecatedBackendVersions,
string testName,
string deviceOrientation,
string screenResolution,
PlatformType platformType,
List<string> screenResolutions)
[Theory]
[MemberData(nameof(AllPlatforms))]
public void ClickLinkTest(BrowserVersion requestedPlatform)
{
InitialiseDriver(new BrowserVersion(os, platformNameForOption, browserName, name, automationBackend, deviceName, recommendedAppiumVersion,
supportedBackendVersions, deprecatedBackendVersions, testName, deviceOrientation, screenResolution,
platformType, screenResolutions));
InitialiseDriver(requestedPlatform);

var guineaPigPage = new GuineaPigPage(BaseFixture.SauceryDriver(), "https://saucelabs.com/");

Expand All @@ -37,6 +21,21 @@ public void ClickLinkTest(string os,
// verify the browser was navigated to the correct page
BaseFixture.Driver!.Url.ShouldContain("saucelabs.com/test-guinea-pig2.html");
}

public static IEnumerable<object[]> AllPlatforms
{
get
{
List<object[]> allPlatforms = [];

foreach(var platform in RequestedPlatformData.Items) {
allPlatforms.Add([platform]);
}

return from c in allPlatforms
select c;
}
}
}
/*
* Copyright Andrew Gray, SauceForge
Expand Down
38 changes: 18 additions & 20 deletions Merlin.XUnit/ClickLinkTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Saucery.Core.Dojo;
using Saucery.Core.OnDemand;
using Saucery.Tests.Common.PageObjects;
using Saucery.XUnit;
using Shouldly;
Expand All @@ -10,25 +9,9 @@ namespace Merlin.XUnit;
public class ClickLinkTests(ITestOutputHelper output, BaseFixture baseFixture) : SauceryXBase(output, baseFixture) //, IClassFixture<ConcurrencyFixture>
{
[Theory]
[MemberData(nameof(RequestedPlatformData.Platforms), MemberType = typeof(RequestedPlatformData))]
public void ClickLinkTest(string os,
string platformNameForOption,
string browserName,
string name,
string automationBackend,
string deviceName,
string recommendedAppiumVersion,
List<string> supportedBackendVersions,
List<string> deprecatedBackendVersions,
string testName,
string deviceOrientation,
string screenResolution,
PlatformType platformType,
List<string> screenResolutions)
{
InitialiseDriver(new BrowserVersion(os, platformNameForOption, browserName, name, automationBackend, deviceName, recommendedAppiumVersion,
supportedBackendVersions, deprecatedBackendVersions, testName, deviceOrientation, screenResolution,
platformType, screenResolutions));
[MemberData(nameof(AllPlatforms))]
public void ClickLinkTest(BrowserVersion requestedPlatform) {
InitialiseDriver(requestedPlatform);

var guineaPigPage = new GuineaPigPage(BaseFixture.SauceryDriver(), "https://saucelabs.com/");

Expand All @@ -37,6 +20,21 @@ public void ClickLinkTest(string os,
// verify the browser was navigated to the correct page
BaseFixture.Driver!.Url.ShouldContain("saucelabs.com/test-guinea-pig2.html");
}

public static IEnumerable<object[]> AllPlatforms
{
get
{
List<object[]> allPlatforms = [];

foreach(var platform in RequestedPlatformData.Items) {
allPlatforms.Add([platform]);
}

return from c in allPlatforms
select c;
}
}
}
/*
* Copyright Andrew Gray, SauceForge
Expand Down

0 comments on commit c4d6c4d

Please sign in to comment.