Migrate UI tests to Playwright dotta

This commit is contained in:
Joseph Doherty
2026-02-10 07:47:48 -05:00
parent c3a9a6b19c
commit 78e67c2aab
37 changed files with 842 additions and 230 deletions
@@ -1,17 +1,15 @@
using Microsoft.Playwright;
namespace JdeScoping.Ui.Tests.Support;
public sealed class PlaywrightFixture : IAsyncLifetime
{
private IPlaywright? _playwright;
private IBrowser? _browser;
private IPlaywright? _playwright;
public IBrowser Browser => _browser ?? throw new InvalidOperationException("Browser is not initialized.");
public async Task InitializeAsync()
{
_playwright = await Microsoft.Playwright.Playwright.CreateAsync();
_playwright = await Playwright.CreateAsync();
_browser = await _playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
{
Headless = UiTestSettings.Headless,
@@ -21,11 +19,8 @@ public sealed class PlaywrightFixture : IAsyncLifetime
public async Task DisposeAsync()
{
if (_browser is not null)
{
await _browser.CloseAsync();
}
if (_browser is not null) await _browser.CloseAsync();
_playwright?.Dispose();
}
}
}