Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;Test;Dev;Prod</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

<ItemGroup>
<PackageReference Include="BoDi" Version="1.5.0" />
<PackageReference Include="CucumberExpressions.SpecFlow.3-9" Version="1.0.7" />
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public Hooks(WebContext webContext, ScenarioContext scenarioContext, IObjectCont
[BeforeTestRun]
public static async Task InitBrowser()
{
var exitCode = Program.Main(new[] { "install" });
if (exitCode != 0)
{
throw new Exception($"Playwright exited with code {exitCode}");
}

_playwright = await Microsoft.Playwright.Playwright.CreateAsync();
if (_playwright is null) throw new Exception("Failed to initialize playwright.");
_browser = await InitBrowserAsync();
Expand Down Expand Up @@ -69,11 +75,11 @@ public async Task MakeScreenshot()
var path = new string(TestContext.CurrentContext.Test.Name
.Where(x => !Path.GetInvalidFileNameChars().Contains(x))
.ToArray()) + ".png";
await _webContext.Page.ScreenshotAsync(new PageScreenshotOptions
await _webContext.Page.ScreenshotAsync(new PageScreenshotOptions
{
Path = path
});

TestContext.AddTestAttachment(path);
}
}
Expand Down