Skip to content

Commit 7bb518f

Browse files
authored
Merge pull request #118 from quantori/playwright-changes
Minor fixes to playwright tests
2 parents df90a59 + b83c8c2 commit 7bb518f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Behavioral.Automation.Playwright/Behavioral.Automation.Configs/Behavioral.Automation.Configs.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<Configurations>Debug;Release;Test;Dev;Prod</Configurations>
87
<Platforms>AnyCPU</Platforms>
98
</PropertyGroup>
109

Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Behavioral.Automation.Playwright.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
<ItemGroup>
3232
<PackageReference Include="BoDi" Version="1.5.0" />
33-
<PackageReference Include="CucumberExpressions.SpecFlow.3-9" Version="1.0.7" />
3433
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
3534
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
3635
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />

Behavioral.Automation.Playwright/Behavioral.Automation.Playwright/Hooks.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ public Hooks(WebContext webContext, ScenarioContext scenarioContext, IObjectCont
3535
[BeforeTestRun]
3636
public static async Task InitBrowser()
3737
{
38+
var exitCode = Program.Main(new[] { "install" });
39+
if (exitCode != 0)
40+
{
41+
throw new Exception($"Playwright exited with code {exitCode}");
42+
}
43+
3844
_playwright = await Microsoft.Playwright.Playwright.CreateAsync();
3945
if (_playwright is null) throw new Exception("Failed to initialize playwright.");
4046
_browser = await InitBrowserAsync();
@@ -69,11 +75,11 @@ public async Task MakeScreenshot()
6975
var path = new string(TestContext.CurrentContext.Test.Name
7076
.Where(x => !Path.GetInvalidFileNameChars().Contains(x))
7177
.ToArray()) + ".png";
72-
await _webContext.Page.ScreenshotAsync(new PageScreenshotOptions
78+
await _webContext.Page.ScreenshotAsync(new PageScreenshotOptions
7379
{
7480
Path = path
7581
});
76-
82+
7783
TestContext.AddTestAttachment(path);
7884
}
7985
}

0 commit comments

Comments
 (0)