Files
jdescopingtool/NEW/tests/JdeScoping.Ui.Tests/Support/UiTestBase.cs
T

30 lines
734 B
C#

using Microsoft.Playwright;
namespace JdeScoping.Ui.Tests.Support;
[Collection(UiTestCollection.Name)]
public abstract class UiTestBase
{
private readonly PlaywrightFixture _fixture;
protected UiTestBase(PlaywrightFixture fixture)
{
_fixture = fixture;
}
protected async Task RunAsync(Func<IPage, Task> action)
{
await using var context = await _fixture.Browser.NewContextAsync(new BrowserNewContextOptions
{
BaseURL = UiTestSettings.BaseUrl,
IgnoreHTTPSErrors = true
});
var page = await context.NewPageAsync();
page.SetDefaultTimeout(30_000);
page.SetDefaultNavigationTimeout(120_000);
await action(page);
}
}