Skip to content

Commit

Permalink
update nuget packages
Browse files Browse the repository at this point in the history
  • Loading branch information
agray committed Dec 28, 2024
1 parent 3748cba commit 7a84b8f
Show file tree
Hide file tree
Showing 25 changed files with 61 additions and 74 deletions.
14 changes: 9 additions & 5 deletions ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class DataDrivenTests : SauceryTBase
{
[Test]
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])]
public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
public async Task DataDrivenTest(Func<BrowserVersion> requestedPlatform, int data)
{
InitialiseDriver(requestedPlatform);
InitialiseDriver(requestedPlatform());

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

Expand All @@ -23,9 +23,13 @@ public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
await Assert.That(commentText).Contains(data.ToString());
}

public static IEnumerable<(BrowserVersion, int)> AllCombinations(int[] data) => from browserVersion in RequestedPlatformData.AllPlatformsAsList()
from datum in data
select (browserVersion, datum);
public static IEnumerable<(Func<BrowserVersion>, int)> AllCombinations(int[] data) =>

Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / build

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / xunit-real-integration-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / xunit-external-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / nunit-external-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / xunit-real-external-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit.RealDevices/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / tunit-real-integration-tests

Return a `Func<T>` rather than a `<T>`.
RequestedPlatformData
.AllPlatforms()
.SelectMany(
_ => data,
(browserVersionFunc, datum) => (browserVersionFunc, datum)
);
}

/*
Expand Down
1 change: 0 additions & 1 deletion ExternalMerlin.TUnit.RealDevices/RequestedPlatformData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ static RequestedPlatformData()
}

public static List<Func<BrowserVersion>> AllPlatforms() => GetAllPlatformsAsFunc();
public static List<BrowserVersion> AllPlatformsAsList() => GetAllPlatformsAsList();
}
/*
* Copyright Andrew Gray, SauceForge
Expand Down
15 changes: 10 additions & 5 deletions ExternalMerlin.TUnit/DataDrivenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class DataDrivenTests : SauceryTBase
{
[Test]
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])]
public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
public async Task DataDrivenTest(Func<BrowserVersion> requestedPlatform, int data)
{
InitialiseDriver(requestedPlatform);
InitialiseDriver(requestedPlatform());

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

Expand All @@ -23,9 +23,14 @@ public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
await Assert.That(commentText).Contains(data.ToString());
}

public static IEnumerable<(BrowserVersion, int)> AllCombinations(int[] data) => from browserVersion in RequestedPlatformData.AllPlatformsAsList()
from datum in data
select (browserVersion, datum);
public static IEnumerable<(Func<BrowserVersion>, int)> AllCombinations(int[] data) =>

Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / nunit-integration-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / nunit-real-integration-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / nunit-real-external-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / xunit-integration-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / tunit-integration-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / tunit-real-external-tests

Return a `Func<T>` rather than a `<T>`.

Check warning on line 26 in ExternalMerlin.TUnit/DataDrivenTests.cs

View workflow job for this annotation

GitHub Actions / tunit-external-tests

Return a `Func<T>` rather than a `<T>`.
RequestedPlatformData
.AllPlatforms()
.SelectMany(
_ => data,
(browserVersionFunc, datum) => (browserVersionFunc, datum)
);

}

/*
Expand Down
1 change: 0 additions & 1 deletion ExternalMerlin.TUnit/RequestedPlatformData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ static RequestedPlatformData()
}

public static List<Func<BrowserVersion>> AllPlatforms() => GetAllPlatformsAsFunc();
public static List<BrowserVersion> AllPlatformsAsList() => GetAllPlatformsAsList();
}
/*
* Copyright Andrew Gray, SauceForge
Expand Down
14 changes: 9 additions & 5 deletions Merlin.TUnit.RealDevices/DataDrivenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class DataDrivenTests : SauceryTBase
{
[Test]
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])]
public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
public async Task DataDrivenTest(Func<BrowserVersion> requestedPlatform, int data)
{
InitialiseDriver(requestedPlatform);
InitialiseDriver(requestedPlatform());

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

Expand All @@ -23,9 +23,13 @@ public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
await Assert.That(commentText).Contains(data.ToString());
}

public static IEnumerable<(BrowserVersion, int)> AllCombinations(int[] data) => from browserVersion in RequestedPlatformData.AllPlatformsAsList()
from datum in data
select (browserVersion, datum);
public static IEnumerable<(Func<BrowserVersion>, int)> AllCombinations(int[] data) =>
RequestedPlatformData
.AllPlatforms()
.SelectMany(
_ => data,
(browserVersionFunc, datum) => (browserVersionFunc, datum)
);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion Merlin.TUnit.RealDevices/Merlin.TUnit.RealDevices.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="TUnit" Version="0.5.32" />
<PackageReference Include="TUnit" Version="0.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion Merlin.TUnit.RealDevices/RequestedPlatformData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ static RequestedPlatformData()
}

public static List<Func<BrowserVersion>> AllPlatforms() => GetAllPlatformsAsFunc();
public static List<BrowserVersion> AllPlatformsAsList() => GetAllPlatformsAsList();
}
/*
* Copyright Andrew Gray, SauceForge
Expand Down
14 changes: 9 additions & 5 deletions Merlin.TUnit/DataDrivenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class DataDrivenTests : SauceryTBase
{
[Test]
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])]
public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
public async Task DataDrivenTest(Func<BrowserVersion> requestedPlatform, int data)
{
InitialiseDriver(requestedPlatform);
InitialiseDriver(requestedPlatform());

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

Expand All @@ -23,9 +23,13 @@ public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
await Assert.That(commentText).Contains(data.ToString());
}

public static IEnumerable<(BrowserVersion, int)> AllCombinations(int[] data) => from browserVersion in RequestedPlatformData.AllPlatformsAsList()
from datum in data
select (browserVersion, datum);
public static IEnumerable<(Func<BrowserVersion>, int)> AllCombinations(int[] data) =>
RequestedPlatformData
.AllPlatforms()
.SelectMany(
_ => data,
(browserVersionFunc, datum) => (browserVersionFunc, datum)
);
}

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

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion Merlin.TUnit/RequestedPlatformData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ static RequestedPlatformData()
}

public static List<Func<BrowserVersion>> AllPlatforms() => GetAllPlatformsAsFunc();
public static List<BrowserVersion> AllPlatformsAsList() => GetAllPlatformsAsList();
}
/*
* Copyright Andrew Gray, SauceForge
Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Your Project file should look something like this:
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Saucery.TUnit" Version="0.5.22" />
<PackageReference Include="Saucery.TUnit" Version="0.6.0" />
</ItemGroup>
</Project>
Expand All @@ -322,30 +322,34 @@ using Saucery.Core.Dojo;
using Saucery.Tests.Common.PageObjects;
using Saucery.TUnit;
namespace ExternalMerlin.TUnit;
namespace Merlin.TUnit.RealDevices;
public class DataDrivenTests : SauceryTBase
{
[Test]
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])
public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])]
public async Task DataDrivenTest(Func<BrowserVersion> requestedPlatform, int data)
{
InitialiseDriver(requestedPlatform);
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()
from datum in data
select (browserVersion, datum);
public static IEnumerable<(Func<BrowserVersion>, int)> AllCombinations(int[] data) =>
RequestedPlatformData
.AllPlatforms()
.SelectMany(
browserVersionFunc => data,
(browserVersionFunc, datum) => (browserVersionFunc, datum)
);
}
```

Expand All @@ -370,10 +374,10 @@ A data driven test is specified like this:
```
[Test]
[MethodDataSource(nameof(AllCombinations), Arguments = [new[] { 4, 5 }])]
public async Task DataDrivenTest(BrowserVersion requestedPlatform, int data)
public async Task DataDrivenTest(Func<BrowserVersion> requestedPlatform, int data)
```

You can call the class what you like but it must take a `BrowserVersion` and the `data` as a parameter and subclass `SauceryTBase`.
You can call the class what you like but it must take a `Func<BrowserVersion>` and the `data` as a parameter and subclass `SauceryTBase`.

`[MethodDataSource(nameof(AllCombinations)...]` is how you tell SauceryT what platforms you want to test on. You need to specify a class to do that. In this example its called `RequestedPlatformData` but you can call it anything you like.

Expand Down Expand Up @@ -407,7 +411,6 @@ public class RequestedPlatformData : SauceryTestData
}
public static List<Func<BrowserVersion>> AllPlatforms() => GetAllPlatformsAsFunc();
public static List<BrowserVersion> AllPlatformsAsList() => GetAllPlatformsAsList();
```

The `List<SaucePlatform>` is what you will specify. The rest of the class is mandatory. Check out `SauceryConstants` for all the platform, browser and screenres enums.
Expand Down
2 changes: 1 addition & 1 deletion Sandbox.TUnit/Sandbox.TUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.13.1" />
<PackageReference Include="TUnit" Version="0.5.32" />
<PackageReference Include="TUnit" Version="0.6.0" />
</ItemGroup>

</Project>
21 changes: 2 additions & 19 deletions Saucery.Core/DataSources/SauceryTestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,8 @@ protected static IEnumerable<object[]> GetAllPlatforms() {
return allPlatforms.AsEnumerable();
}

protected static List<BrowserVersion> GetAllPlatformsAsList()
{
List<BrowserVersion> allPlatforms = [];
allPlatforms.AddRange(from platform in Items
select platform);
return allPlatforms;
}

protected static List<Func<BrowserVersion>> GetAllPlatformsAsFunc()
{
var listOfFunc = new List<Func<BrowserVersion>>();

foreach (var platform in Items)
{
listOfFunc.Add(() => platform);
}

return listOfFunc;
}
protected static List<Func<BrowserVersion>> GetAllPlatformsAsFunc() =>
Items.Select(platform => (Func<BrowserVersion>)(() => platform)).ToList();
}
/*
* Copyright Andrew Gray, SauceForge
Expand Down
2 changes: 1 addition & 1 deletion Saucery.Core/Saucery.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="6.0.1" />
<PackageReference Include="Appium.WebDriver" Version="7.0.0" />
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="DotNetSeleniumExtras.PageObjects.Core" Version="4.14.1" />
<PackageReference Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" />
Expand Down
Binary file modified Saucery.TUnit/Images/Saucery.TUnit.128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Saucery.TUnit/Images/Saucery.TUnit.128x128.xcf
Binary file not shown.
Binary file modified Saucery.TUnit/Images/Saucery.TUnit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Saucery.TUnit/Images/Saucery.TUnit.xcf
Binary file not shown.
Binary file added Saucery.TUnit/Images/TUnitLogo 128x128.xcf
Binary file not shown.
Binary file added Saucery.TUnit/Images/TUnitLogo 2048x2048.xcf
Binary file not shown.
Binary file added Saucery.TUnit/Images/TUnitLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Saucery.TUnit/Images/tunit.128x128.png
Binary file not shown.
Binary file removed Saucery.TUnit/Images/tunit.256x256.png
Binary file not shown.
12 changes: 0 additions & 12 deletions Saucery.TUnit/Images/tunit.svg

This file was deleted.

6 changes: 3 additions & 3 deletions Saucery.TUnit/Saucery.TUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<PackageId>Saucery.TUnit</PackageId>
<PackageVersion>0.5.22</PackageVersion>
<PackageVersion>0.6.0</PackageVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Authors>Andrew Gray</Authors>
<Company>SauceForge</Company>
Expand All @@ -29,8 +29,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="TUnit" Version="0.5.32" />
<PackageReference Include="TUnit.Core" Version="0.5.32" />
<PackageReference Include="TUnit" Version="0.6.0" />
<PackageReference Include="TUnit.Core" Version="0.6.0" />
<None Include="Images\Saucery.TUnit.128x128.png" Pack="true" PackagePath="\" />
<None Include="..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
Expand Down

0 comments on commit 7a84b8f

Please sign in to comment.