Migrate Playwright suite to .NET UI tests and deprecate TS project
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Microsoft.Playwright;
|
||||
|
||||
namespace JdeScoping.Ui.Tests.Support;
|
||||
|
||||
public sealed class PlaywrightFixture : IAsyncLifetime
|
||||
{
|
||||
private IPlaywright? _playwright;
|
||||
private IBrowser? _browser;
|
||||
|
||||
public IBrowser Browser => _browser ?? throw new InvalidOperationException("Browser is not initialized.");
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
_playwright = await Microsoft.Playwright.Playwright.CreateAsync();
|
||||
_browser = await _playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
|
||||
{
|
||||
Headless = UiTestSettings.Headless,
|
||||
Args = ["--no-sandbox", "--disable-dev-shm-usage"]
|
||||
});
|
||||
}
|
||||
|
||||
public async Task DisposeAsync()
|
||||
{
|
||||
if (_browser is not null)
|
||||
{
|
||||
await _browser.CloseAsync();
|
||||
}
|
||||
|
||||
_playwright?.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user