Skip to content

helix + pw + linux/osx #30676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
6d797aa
Update playwright to 191.1
HaoK Mar 5, 2021
7a009c5
Update runtests.sh
HaoK Mar 5, 2021
01c36c7
Update runtests.ps1
HaoK Mar 5, 2021
5e062e6
Update ContextInformation.cs
HaoK Mar 5, 2021
5487e65
Update TestRunner.cs
HaoK Mar 5, 2021
dfa2bb5
Update runtests.sh
HaoK Mar 5, 2021
240fcd5
Update runtests.ps1
HaoK Mar 5, 2021
dcaee00
Update runtests.sh
HaoK Mar 5, 2021
851fe5a
Update BrowserManager.cs
HaoK Mar 5, 2021
f205ae2
Update BrowserManager.cs
HaoK Mar 5, 2021
3338c20
Update BrowserManager.cs
HaoK Mar 5, 2021
130590e
Update BrowserManager.cs
HaoK Mar 6, 2021
14ff8f6
Update runtests.sh
HaoK Mar 6, 2021
e0f0762
Update BrowserManager.cs
HaoK Mar 6, 2021
9337217
Update BrowserManager.cs
HaoK Mar 6, 2021
ccf693b
Update TestRunner.cs
HaoK Mar 6, 2021
0780315
Update runtests.sh
HaoK Mar 7, 2021
e9a3dee
Update runtests.ps1
HaoK Mar 7, 2021
4062e0d
Update runtests.ps1
HaoK Mar 8, 2021
c683be7
Update runtests.sh
HaoK Mar 8, 2021
fb46691
Update BrowserManager.cs
HaoK Mar 9, 2021
6f446b8
Update Helix.Common.props
HaoK Mar 9, 2021
1bcdae4
Use correct driver for osx
HaoK Mar 9, 2021
45dcdd2
Update runtests.sh
HaoK Mar 9, 2021
ed2cd1d
Add apt-get packages for pw and set correct osx node path
HaoK Mar 9, 2021
305e8ff
Update BrowserManager.cs
HaoK Mar 9, 2021
62f8545
Update runtests.sh
HaoK Mar 10, 2021
9fd8c22
Update runtests.sh
HaoK Mar 10, 2021
455e86c
Update runtests.sh
HaoK Mar 10, 2021
40d2ea9
Update runtests.sh
HaoK Mar 10, 2021
dbeadea
Update BlazorServerTemplateTest.cs
HaoK Mar 11, 2021
11e119c
Update BlazorWasmTemplateTest.cs
HaoK Mar 11, 2021
1903155
Skip libdus-glib on osx
HaoK Mar 11, 2021
cab8111
Update BrowserManager.cs
HaoK Mar 11, 2021
ad7ee3a
Disable firefox for now
HaoK Mar 11, 2021
43a2611
Add more missing deps
HaoK Mar 11, 2021
6ecb555
Assume yes for sudo apt-get
HaoK Mar 12, 2021
d8576ea
Skipping more tests on mac
HaoK Mar 12, 2021
88f6fbd
Update BlazorWasmTemplateTest.cs
HaoK Mar 12, 2021
4e32207
Merge branch 'main' into haok/pwmac2
HaoK Mar 12, 2021
e6d587d
Update runtests.ps1
HaoK Mar 12, 2021
69c5c94
Update playwrightSettings.json
HaoK Mar 12, 2021
14c0d18
Update helix-matrix.yml
HaoK Mar 12, 2021
803ee55
Update playwrightSettings.json
HaoK Mar 13, 2021
8d54adc
Update BlazorTemplates.Tests.csproj
HaoK Mar 13, 2021
f5916c6
Skip most of helix matrix for now
HaoK Mar 13, 2021
3f6d9c4
Update BlazorTemplates.Tests.csproj
HaoK Mar 13, 2021
a2efa58
Add ubuntu 2004 deps
HaoK Mar 13, 2021
3d01358
Update BlazorTemplates.Tests.csproj
HaoK Mar 13, 2021
cdcca8b
Update Helix.targets
HaoK Mar 13, 2021
c3f8cc5
Update Helix.targets
HaoK Mar 13, 2021
b8e9f4c
Update runtests.sh
HaoK Mar 13, 2021
1c278dd
Update Helix.targets
HaoK Mar 14, 2021
6f239c9
Update helix-matrix.yml
HaoK Mar 14, 2021
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
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
<NewtonsoftJsonBsonVersion>1.0.2</NewtonsoftJsonBsonVersion>
<NewtonsoftJsonVersion>12.0.2</NewtonsoftJsonVersion>
<NSwagApiDescriptionClientVersion>13.0.4</NSwagApiDescriptionClientVersion>
<PlaywrightSharpVersion>0.180.0</PlaywrightSharpVersion>
<PlaywrightSharpVersion>0.191.1</PlaywrightSharpVersion>
<PollyExtensionsHttpVersion>3.0.0</PollyExtensionsHttpVersion>
<PollyVersion>7.1.0</PollyVersion>
<SeleniumSupportVersion>4.0.0-beta1</SeleniumSupportVersion>
Expand Down
2 changes: 2 additions & 0 deletions eng/helix/content/RunTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ static async Task Main(string[] args)
{
keepGoing = await runner.InstallPlaywrightAsync();
}
#else
Console.WriteLine("Playwright install skipped.");
#endif

runner.DisplayContents();
Expand Down
2 changes: 1 addition & 1 deletion eng/helix/content/RunTests/RunTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20158.1" />
<PackageReference Condition=" '$(InstallPlaywright)' == 'true' " Include="PlaywrightSharp" Version="0.180.0" />
<PackageReference Condition=" '$(InstallPlaywright)' == 'true' " Include="PlaywrightSharp" Version="0.191.1" />
</ItemGroup>
</Project>
22 changes: 12 additions & 10 deletions eng/helix/content/RunTests/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,16 @@ public bool SetupEnvironment()

#if INSTALLPLAYWRIGHT
// Playwright will download and look for browsers to this directory
var playwrightBrowsers = Path.Combine(helixDir, "ms-playwright");
var playwrightBrowsers = Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH");
Console.WriteLine($"Setting PLAYWRIGHT_BROWSERS_PATH: {playwrightBrowsers}");
EnvironmentVariables.Add("PLAYWRIGHT_BROWSERS_PATH", playwrightBrowsers);
var playrightDriver = Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH");
Console.WriteLine($"Setting PLAYWRIGHT_DRIVER_PATH: {playrightDriver}");
EnvironmentVariables.Add("PLAYWRIGHT_DRIVER_PATH", playrightDriver);
#else
Console.WriteLine($"Skipping setting PLAYWRIGHT_BROWSERS_PATH");
#endif

Console.WriteLine($"Creating nuget restore directory: {nugetRestore}");
Directory.CreateDirectory(nugetRestore);

Expand Down Expand Up @@ -95,8 +100,9 @@ public async Task<bool> InstallPlaywrightAsync()
{
try
{
Console.WriteLine($"Installing Playwright to {EnvironmentVariables["PLAYWRIGHT_BROWSERS_PATH"]}");
await Playwright.InstallAsync(EnvironmentVariables["PLAYWRIGHT_BROWSERS_PATH"]);
Console.WriteLine($"Installing Playwright to Browsers: {Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH")} Driver: {Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH")}");
await Playwright.InstallAsync(Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH"), Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH"));
DisplayContents(Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH"));
return true;
}
catch (Exception e)
Expand All @@ -106,7 +112,7 @@ public async Task<bool> InstallPlaywrightAsync()
}
}
#endif

public async Task<bool> InstallAspNetAppIfNeededAsync()
{
try
Expand Down Expand Up @@ -170,7 +176,7 @@ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
errorDataReceived: Console.Error.WriteLine,
throwOnError: false,
cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);

// ';' is the path separator on Windows, and ':' on Unix
Options.Path += OperatingSystem.IsWindows() ? ";" : ":";
Options.Path += $"{Environment.GetEnvironmentVariable("DOTNET_CLI_HOME")}/.dotnet/tools";
Expand Down Expand Up @@ -341,9 +347,7 @@ public void UploadResults()
// Combine the directory name + log name for the copied log file name to avoid overwriting duplicate test names in different test projects
var logName = $"{Path.GetFileName(Path.GetDirectoryName(file))}_{Path.GetFileName(file)}";
Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, logName)}");
// Need to copy to HELIX_WORKITEM_UPLOAD_ROOT and HELIX_WORKITEM_UPLOAD_ROOT/../ in order for Azure Devops attachments to link properly and for Helix to store the logs
File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, logName));
File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, "..", logName));
}
}
else
Expand All @@ -357,9 +361,7 @@ public void UploadResults()
{
var fileName = Path.GetFileName(file);
Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)}");
// Need to copy to HELIX_WORKITEM_UPLOAD_ROOT and HELIX_WORKITEM_UPLOAD_ROOT/../ in order for Azure Devops attachments to link properly and for Helix to store the logs
File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName));
File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, "..", fileName));
}
}
else
Expand Down
5 changes: 3 additions & 2 deletions eng/helix/content/runtests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ param(

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_MULTILEVEL_LOOKUP = 0
$env:PLAYWRIGHT_BROWSERS_PATH = "$currentDirectory\ms-playwright"
$env:InstallPlaywright = "$InstallPlaywright"

$currentDirectory = Get-Location
$env:PLAYWRIGHT_BROWSERS_PATH = "$currentDirectory\ms-playwright"
$env:PLAYWRIGHT_DRIVER_PATH = "$currentDirectory\.playwright\win-x64\native\playwright.cmd"

$envPath = "$env:PATH;$env:HELIX_CORRELATION_PAYLOAD\node\bin"

function InvokeInstallDotnet([string]$command) {
Expand Down
47 changes: 44 additions & 3 deletions eng/helix/content/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

dotnet_sdk_version="$2"
dotnet_runtime_version="$3"
helixQueue="$5"
installPlaywright="${10}"

RESET="\033[0m"
RED="\033[0;31m"
Expand All @@ -25,8 +27,47 @@ export DOTNET_CLI_HOME="$DIR/.home$RANDOM"

export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

# Set playwright browser path
# Set playwright stuff
export PLAYWRIGHT_BROWSERS_PATH="$DIR/ms-playwright"
if [[ "$helixQueue" == *"OSX"* ]]; then
export PLAYWRIGHT_DRIVER_PATH="$DIR/.playwright/osx/native/playwright.sh"
PLAYWRIGHT_NODE_PATH=$DIR/.playwright/osx/native/node
else
export PLAYWRIGHT_DRIVER_PATH="$DIR/.playwright/unix/native/playwright.sh"
PLAYWRIGHT_NODE_PATH=$DIR/.playwright/unix/native/node
fi
export InstallPlaywright="$installPlaywright"
if [ -f "$PLAYWRIGHT_DRIVER_PATH" ]; then
if [[ "$helixQueue" != *"OSX"* ]]; then
echo "Installing Playwright requirements..."
sudo apt-get install -y libdbus-glib-1-2
sudo apt-get install -y libbrotli1
sudo apt-get install -y libegl1
sudo apt-get install -y libnotify4
sudo apt-get install -y libvpx5
sudo apt-get install -y libopus0
sudo apt-get install -y libwoff1
sudo apt-get install -y libgstreamer-plugins-base1.0-0
sudo apt-get install -y libgstreamer1.0-0
sudo apt-get install -y libgstreamer-gl1.0-0
sudo apt-get install -y libgstreamer-plugins-bad1.0-0
sudo apt-get install -y libopenjp2-7
sudo apt-get install -y libwebpdemux2
sudo apt-get install -y libwebp6
sudo apt-get install -y libenchant1c2a
sudo apt-get install -y libsecret-1-0
sudo apt-get install -y libhyphen0
sudo apt-get install -y libgles2
sudo apt-get install -y gstreamer1.0-libav
sudo apt-get install -y libxkbcommon0
sudo apt-get install -y libgtk-3-0
sudo apt-get install -y libharfbuzz-icu0
fi
echo "chmod +x $PLAYWRIGHT_DRIVER_PATH"
chmod +x $PLAYWRIGHT_DRIVER_PATH
echo "chmod +x $PLAYWRIGHT_NODE_PATH"
chmod +x $PLAYWRIGHT_NODE_PATH
fi

RESET="\033[0m"
RED="\033[0;31m"
Expand Down Expand Up @@ -83,8 +124,8 @@ exit_code=0
echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources"
$DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources

echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9"
$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9
echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $helixQueue --arch $6 --quarantined $7 --ef $8 --helixTimeout $9"
$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $helixQueue --arch $6 --quarantined $7 --ef $8 --helixTimeout $9
exit_code=$?
echo "Finished tests...exit_code=$exit_code"

Expand Down
4 changes: 2 additions & 2 deletions eng/targets/Helix.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

<!-- PR(ci.yaml) required queues -->
<ItemGroup Condition="'$(IsRequiredCheck)' == 'true' AND '$(TargetArchitecture)' == 'x64' AND '$(_UseHelixOpenQueues)' == 'true'">
<HelixAvailableTargetQueue Include="Ubuntu.1604.Amd64.Open" Platform="Linux" />
<HelixAvailableTargetQueue Include="Ubuntu.1804.Amd64.Open" Platform="Linux" />
<HelixAvailableTargetQueue Include="Windows.10.Amd64.Server20H2.Open" Platform="Windows" />
<HelixAvailableTargetQueue Include="OSX.1014.Amd64.Open" Platform="Linux" />
</ItemGroup>

<!-- queues for helix-matrix.yml pipeline -->
<ItemGroup Condition="'$(TargetArchitecture)' == 'x64' AND '$(IsHelixDaily)' == 'true' AND '$(_UseHelixOpenQueues)' == 'true' AND '$(IsWindowsOnlyTest)' != 'true'">
<HelixAvailableTargetQueue Include="Ubuntu.1804.Amd64.Open" Platform="Linux" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playwright reqs depend on ubuntu 1804 min version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You comment implies we shouldn't be using Playwright tests on 16.04 at all. Should we remove this queue or skip the Playwright tests here❔

<HelixAvailableTargetQueue Include="Ubuntu.1604.Amd64.Open" Platform="Linux" />
<HelixAvailableTargetQueue Include="Ubuntu.2004.Amd64.Open" Platform="Linux" />
<HelixAvailableTargetQueue Include="OSX.1100.Amd64.Open" Platform="Linux" />
<HelixAvailableTargetQueue Include="Debian.9.Amd64.Open" Platform="Linux" />
Expand Down
4 changes: 2 additions & 2 deletions eng/targets/Helix.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<HelixPreCommand Include="call RunPowershell.cmd mssql\InstallSqlServerLocalDB.ps1 || exit /b 1" />
</ItemGroup>

<PropertyGroup Condition="'$(TestDependsOnPlaywright)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
<SkipHelixQueues>Windows.7.Amd64.Open;Windows.81.Amd64.Open</SkipHelixQueues>
<PropertyGroup Condition="'$(TestDependsOnPlaywright)' == 'true'">
<SkipHelixQueues>Windows.7.Amd64.Open;Windows.81.Amd64.Open;Redhat.7.Amd64.Open;Redhat.7.Amd64;Debian.9.Amd64.Open;Debian.9.Amd64.Open;Ubuntu.2004.Amd64.Open;Ubuntu.2004.Amd64;Ubuntu.1604.Amd64.Open;Ubuntu.1604.Amd64;Alpine.312.Amd64.Open;(Alpine.312.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:alpine-3.12-helix-20200908125345-56c6673;(Fedora.33.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:fedora-33-helix-20210120000908-a9df267</SkipHelixQueues>
</PropertyGroup>

<ItemGroup Condition="'$(TestDependsOnPlaywright)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ await Fixture.BrowserManager.GetBrowserInstance(browserKind, BrowserContextInfo)
[Theory]
[MemberData(nameof(BlazorServerTemplateWorks_IndividualAuthData))]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/30807")]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/30825", Queues = "All.OSX")]
public async Task BlazorServerTemplateWorks_IndividualAuth(BrowserKind browserKind, bool useLocalDB)
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<RunTemplateTests Condition="'$(RunTemplateTests)' == ''">true</RunTemplateTests>
<SkipTests Condition="'$(RunTemplateTests)' != 'true'">true</SkipTests>
<IsWindowsOnlyTest>true</IsWindowsOnlyTest>
<SkipHelixArm>true</SkipHelixArm>
<BaseOutputPath />
<OutputPath />
Expand Down Expand Up @@ -45,6 +44,8 @@
<Reference Include="Microsoft.Extensions.Configuration" />
<Reference Include="Microsoft.Extensions.Configuration.Json" />
<Reference Include="Anglesharp" />
<Reference Include="PlaywrightSharp" Condition="'$(TargetOsName)' != 'linux-musl'" />
<Reference Include="PlaywrightSharp" ExcludeAssets="build" Condition="'$(TargetOsName)' == 'linux-musl'" />
<ProjectReference Include="$(RepoRoot)src\Framework\App.Runtime\src\Microsoft.AspNetCore.App.Runtime.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
Expand All @@ -57,4 +58,13 @@

<!-- Shared testing infrastructure for running E2E template tests -->
<Import Project="..\TestInfrastructure\PrepareForTest.targets" />

<Target Name="PublishAssets" AfterTargets="Publish">
<ItemGroup>
<_PublishFiles Include="$(OutputPath).playwright\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(_PublishFiles)" DestinationFolder="$(PublishDir)\.playwright\%(_PublishFiles.RecursiveDir)\" />
</Target>


</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ public Task BlazorWasmHostedTemplate_IndividualAuth_Works_WithLocalDB(BrowserKin
[Theory]
[InlineData(BrowserKind.Chromium)]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/30820")]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/30825", Queues = "All.OSX")]
public Task BlazorWasmHostedTemplate_IndividualAuth_Works_WithOutLocalDB(BrowserKind browserKind)
{
return BlazorWasmHostedTemplate_IndividualAuth_Works(browserKind, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"Firefox": {
"BrowserKind": "Firefox",
"IsEnabled": true
"IsEnabled": false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you turn this off on playwrightSettings.ci.json

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure if this works I'll switch it to that file, just trying to make things not blow up on linux

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already set in ci.json, so I'll just try removing it and seeing if it blows up again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like this works (at least not on helix right now), so I'm just going to turn it off globally

},
"Webkit": {
"BrowserKind": "Webkit",
Expand Down
11 changes: 10 additions & 1 deletion src/Shared/BrowserTesting/src/BrowserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -46,7 +47,15 @@ private async Task InitializeAsync()

async Task InitializeCore()
{
Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory/*, debug: "pw:api"*/);
var driverPath = Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH");
if (!string.IsNullOrEmpty(driverPath))
{
Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory, driverExecutablePath: driverPath, debug: "pw:api");
}
else
{
Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory, debug: "pw:api");
}
foreach (var (browserName, options) in _browserManagerConfiguration.BrowserOptions)
{
if (!_launchBrowsers.ContainsKey(browserName))
Expand Down
11 changes: 4 additions & 7 deletions src/Shared/BrowserTesting/src/ContextInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,18 @@ private void CleanupPage(object sender, EventArgs e)

internal BrowserContextOptions ConfigureUniqueHarPath(BrowserContextOptions browserContextOptions)
{
var uploadDir = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT");
if (browserContextOptions?.RecordHar?.Path != null)
{
var identifier = Guid.NewGuid().ToString("N");
var harDirectory = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT");
if (string.IsNullOrEmpty(harDirectory))
{
harDirectory = browserContextOptions.RecordHar.Path;
}
browserContextOptions.RecordHar.Path = Path.Combine(harDirectory, $"{identifier}.har");
browserContextOptions.RecordHar.Path = Path.Combine(
string.IsNullOrEmpty(uploadDir) ? browserContextOptions.RecordHar.Path : uploadDir,
$"{identifier}.har");
_harPath = browserContextOptions.RecordHar.Path;
}

if (browserContextOptions?.RecordVideo?.Dir != null)
{
var uploadDir = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT");
if (!string.IsNullOrEmpty(uploadDir))
{
browserContextOptions.RecordVideo.Dir = uploadDir;
Expand Down