E13.Common.Nunit.UI
2025.117.22
dotnet add package E13.Common.Nunit.UI --version 2025.117.22
NuGet\Install-Package E13.Common.Nunit.UI -Version 2025.117.22
<PackageReference Include="E13.Common.Nunit.UI" Version="2025.117.22" />
<PackageVersion Include="E13.Common.Nunit.UI" Version="2025.117.22" />
<PackageReference Include="E13.Common.Nunit.UI" />
paket add E13.Common.Nunit.UI --version 2025.117.22
#r "nuget: E13.Common.Nunit.UI, 2025.117.22"
#addin nuget:?package=E13.Common.Nunit.UI&version=2025.117.22
#tool nuget:?package=E13.Common.Nunit.UI&version=2025.117.22
E13.Common.Nunit.UI
Overview
E13.Common.Nunit.UI is a specialized package within the E13.Common collection designed for UI testing with NUnit and PuppeteerSharp. It extends E13.Common.Nunit with UI-specific testing utilities, including browser automation, screenshot comparison, and authentication helpers for web applications.
Features
- UI Test Fixtures: Base classes for UI testing with PuppeteerSharp integration
- Screenshot Comparison: Automated visual regression testing with screenshot comparison
- Authentication Support: Helpers for testing authenticated UI flows
- Browser Automation: Utilities for interacting with web pages in tests
- Test Organization: Attributes and extensions for organizing UI tests
Installation
dotnet add package E13.Common.Nunit.UI
Usage
Creating a UI Test Fixture
using E13.Common.Nunit.UI;
using Microsoft.Extensions.Hosting;
using NUnit.Framework;
using PuppeteerSharp;
using System.Threading.Tasks;
// Create a test fixture for your UI
public class MyUITests : BaseUIFixture
{
// Define viewport dimensions
public MyUITests()
: base(1280, 720, () => CreateHostBuilder())
{
}
private static IHostBuilder CreateHostBuilder() =>
Host.CreateDefaultBuilder()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<TestStartup>();
});
[Test]
public async Task HomePage_LoadsCorrectly()
{
// Navigate to a page
await Page.GoToAsync("https://localhost:5001");
// Take and compare a screenshot
await Page.ConfirmScreenshot("HomePage");
// Assert page content
var title = await Page.GetTitleAsync();
Assert.AreEqual("Home Page", title);
}
}
Testing Authenticated UI Flows
using E13.Common.Nunit.UI;
using Microsoft.Extensions.Hosting;
using NUnit.Framework;
using System.Threading.Tasks;
public class AuthenticatedUITests : BaseAuthUIFixture
{
protected override string AuthUrl => "https://localhost:5001/login";
public AuthenticatedUITests()
: base(1280, 720, () => CreateHostBuilder())
{
}
private static IHostBuilder CreateHostBuilder() =>
Host.CreateDefaultBuilder()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<TestStartup>();
});
[Test]
[RequiresAuth]
public async Task SecurePage_WhenAuthenticated_ShowsContent()
{
// The [RequiresAuth] attribute will trigger automatic login
// Navigate to a secure page
await Page.GoToAsync("https://localhost:5001/secure");
// Take and compare a screenshot
await Page.ConfirmScreenshot("SecurePage");
// Assert secure content is visible
var content = await Page.QuerySelectorAsync(".secure-content");
Assert.IsNotNull(content);
}
}
Dependencies
- .NET 9.0
- PuppeteerSharp
- PuppeteerSharp.Contrib.Extensions
- PuppeteerSharp.Contrib.Should
- Microsoft.Extensions.Hosting
- E13.Common.Nunit
Related Packages
E13.Common.Nunit.UI is part of the E13.Common collection, which includes:
- E13.Common.Core - Core utilities and base classes
- E13.Common.Nunit - Base NUnit testing utilities
- E13.Common.Nunit.Api - NUnit utilities for API testing
- E13.Common.Blazor - Blazor UI components
- E13.Common.AspNet - ASP.NET shared components
Contributing
Contributions to E13.Common.Nunit.UI are welcome. If you have suggestions or improvements, please submit an issue or create a pull request in the GitHub repository.
License
This project is licensed under the MIT License. For more details, see the LICENSE file in the repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- E13.Common.Nunit (>= 2025.114.21)
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.3.0)
- Microsoft.Extensions.Hosting (>= 9.0.3)
- PuppeteerSharp (>= 20.1.3)
- PuppeteerSharp.Contrib.Extensions (>= 7.0.0)
- PuppeteerSharp.Contrib.Should (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2025.117.22 | 83 | 4/27/2025 |
2025.114.21 | 135 | 4/24/2025 |
2025.114.20 | 138 | 4/24/2025 |
2025.114.19 | 138 | 4/24/2025 |
2025.114.18 | 145 | 4/24/2025 |
2025.112.17 | 152 | 4/22/2025 |
2025.112.16 | 147 | 4/22/2025 |
2025.111.15 | 153 | 4/21/2025 |
2025.106.14 | 166 | 4/16/2025 |
2025.106.12 | 191 | 4/16/2025 |
2025.97.11 | 152 | 4/7/2025 |
2025.96.9 | 156 | 4/6/2025 |
2025.96.8 | 152 | 4/6/2025 |
2025.91.7 | 153 | 4/1/2025 |
2025.91.6 | 143 | 4/1/2025 |
2025.90.4 | 146 | 3/31/2025 |
2023.30.1 | 346 | 1/30/2023 |
2023.18.1 | 305 | 1/18/2023 |
2021.324.4 | 1,148 | 11/20/2021 |
2021.56.3 | 400 | 2/25/2021 |
2021.42.17 | 390 | 2/11/2021 |
2021.40.24 | 420 | 2/9/2021 |
2021.40.22 | 422 | 2/9/2021 |
2021.40.21 | 405 | 2/9/2021 |
2021.40.2 | 423 | 2/9/2021 |
1.0.0 | 148 | 4/1/2025 |