Migrate UI tests to Playwright dotta
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user