Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
6185e38
Update BlazorTemplates.Tests.csproj
HaoK Feb 11, 2021
d31fe14
Try setting playwrite browsers path
HaoK Feb 11, 2021
2dee066
Publish browsers from install path
HaoK Feb 11, 2021
45e712d
Try to Install-WindowsFeature Server-Media-Foundation
HaoK Feb 12, 2021
3b27085
Update BlazorServerTemplateTest.cs
HaoK Feb 12, 2021
feb658a
Update BlazorWasmTemplateTest.cs
HaoK Feb 12, 2021
197ef2e
Update BlazorServerTemplateTest.cs
HaoK Feb 12, 2021
91fd2da
Update BlazorServerTemplateTest.cs
HaoK Feb 12, 2021
6d9bc8c
Update runtests.ps1
HaoK Feb 12, 2021
99bb62f
Update runtests.ps1
HaoK Feb 12, 2021
c75bea6
Update BlazorTemplates.Tests.csproj
HaoK Feb 12, 2021
278edd8
Update runtests.ps1
HaoK Feb 12, 2021
01c7d51
Update runtests.ps1
HaoK Feb 12, 2021
9908369
Create installPlaywrightReqs.psq
HaoK Feb 12, 2021
82b0c52
Update runtests.ps1
HaoK Feb 12, 2021
480b56f
Update Helix.Common.props
HaoK Feb 12, 2021
6598dce
Update BlazorTemplates.Tests.csproj
HaoK Feb 12, 2021
71c4f98
Rename installPlaywrightReqs.psq to installPlaywrightReqs.ps1
HaoK Feb 12, 2021
9f07497
Cleanup
HaoK Feb 12, 2021
1fa2904
Fix dotnet-ef update to work on helix
HaoK Feb 13, 2021
5c35258
Install dotnet serve as part of templates tests payloads
HaoK Feb 13, 2021
ac5d56e
Require localdb
HaoK Feb 13, 2021
44097b0
Update Helix.Common.props
HaoK Feb 13, 2021
7b3d5d7
Update Helix.targets
HaoK Feb 13, 2021
e27ebd2
Update BlazorTemplates.Tests.csproj
HaoK Feb 13, 2021
f7a0d35
Update Helix.Common.props
HaoK Feb 13, 2021
e8f7fef
Update Directory.Build.props
HaoK Feb 13, 2021
841d239
Update Directory.Build.props
HaoK Feb 13, 2021
7c2597b
Update Directory.Build.props
HaoK Feb 13, 2021
eafc070
Move iis schema updates to TestDependsOnIIS
HaoK Feb 13, 2021
f77e3d1
Update Helix.targets
HaoK Feb 13, 2021
c4f576e
Fix up serve helix execution
HaoK Feb 13, 2021
77d30a0
Pass in playwright option
HaoK Feb 15, 2021
5310eda
Update RunTestsOptions.cs
HaoK Feb 15, 2021
2b0b897
Update runtests.sh
HaoK Feb 15, 2021
d0355b7
Update runtests.sh
HaoK Feb 15, 2021
e472a10
Update Helix.targets
HaoK Feb 15, 2021
69e1a9a
Update RunTests.csproj
HaoK Feb 15, 2021
c9dbbd2
Update TestRunner.cs
HaoK Feb 15, 2021
d42b8d0
Update Program.cs
HaoK Feb 15, 2021
321d08b
Update TestRunner.cs
HaoK Feb 15, 2021
ddaba37
Skip publish of browser binaries
HaoK Feb 15, 2021
7011b08
Try to install sdk 5.0.103 for playwright
HaoK Feb 15, 2021
5e10cf3
Update RunTests.csproj
HaoK Feb 16, 2021
67007ac
Update RunTestsOptions.cs
HaoK Feb 16, 2021
c1e1bfb
Update TestRunner.cs
HaoK Feb 16, 2021
8571207
Update Program.cs
HaoK Feb 16, 2021
113605f
Update Program.cs
HaoK Feb 16, 2021
313bbef
Update runtests.ps1
HaoK Feb 16, 2021
ffd581f
Specify the playwright browsers path in install
HaoK Feb 16, 2021
1b5cdae
Update runtests.sh
HaoK Feb 16, 2021
de31ea5
Update runtests.ps1
HaoK Feb 16, 2021
59e68a4
Update runtests.ps1
HaoK Feb 16, 2021
e152e50
Update runtests.ps1
HaoK Feb 16, 2021
791bdab
Update runtests.ps1
HaoK Feb 16, 2021
47012b5
Update runtests.ps1
HaoK Feb 16, 2021
3fc8434
Update BlazorTemplates.Tests.csproj
HaoK Feb 16, 2021
9b29ef0
Update BlazorTemplates.Tests.csproj
HaoK Feb 16, 2021
e28f32c
Update BlazorTemplates.Tests.csproj
HaoK Feb 16, 2021
218a819
Bump hang test timeout to 15 minutes
HaoK Feb 16, 2021
7f4def4
Only enable playwright when needed
HaoK Feb 16, 2021
a34938a
Update RunTests.csproj
HaoK Feb 16, 2021
2160154
Update RunTests.csproj
HaoK Feb 16, 2021
cd21d73
Update TestRunner.cs
HaoK Feb 16, 2021
6620961
Update RunTestsOptions.cs
HaoK Feb 16, 2021
7848ec2
Update Program.cs
HaoK Feb 16, 2021
79a4afc
Update RunTestsOptions.cs
HaoK Feb 16, 2021
efe65ae
Update runtests.ps1
HaoK Feb 16, 2021
6ed9f24
conditional for pw in runtests
HaoK Feb 16, 2021
bc48000
Fix dotnet build param
HaoK Feb 16, 2021
e330e79
Fixes
HaoK Feb 17, 2021
d0bb511
Fix runtests
HaoK Feb 17, 2021
1fe6c9d
Update BlazorTemplates.Tests.csproj
HaoK Feb 17, 2021
2578ea3
Try the full matrix
HaoK Feb 17, 2021
b7d90c3
Update installPlaywrightReqs.ps1
HaoK Feb 17, 2021
954b230
Update installPlaywrightReqs.ps1
HaoK Feb 17, 2021
bd5864c
Only try to install server media foundation if needed
HaoK Feb 17, 2021
1511fc2
Skip playwright tests on win7 (missing dism cmdlet)
HaoK Feb 18, 2021
9b189a8
Update installPlaywrightReqs.ps1
HaoK Feb 18, 2021
2d5734d
Update Helix.targets
HaoK Feb 18, 2021
938b316
Disable verbose logging for now
HaoK Feb 18, 2021
c82ad5f
Skip win81 too
HaoK Feb 18, 2021
4b5a7c2
Remove net5.0 install
HaoK Feb 20, 2021
4820f8f
Update BlazorWasmTemplateTest.cs
HaoK Feb 20, 2021
c9c1c87
Update BlazorWasmTemplateTest.cs
HaoK Feb 20, 2021
2f921b1
Update TestRunner.cs
HaoK Feb 21, 2021
d804ff2
Update TestRunner.cs
HaoK Feb 21, 2021
30cf208
Record har's directly to helix upload directory
HaoK Feb 23, 2021
de86438
Update video path to helix upload dir
HaoK Feb 23, 2021
422af5e
Fail to look at artifacts
HaoK Feb 25, 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
6 changes: 5 additions & 1 deletion .azure/pipelines/helix-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# We only want to run full helix matrix on main
pr: none
pr:
autoCancel: true
branches:
include:
- '*'
trigger: none
schedules:
# Cron timezone is UTC.
Expand Down
6 changes: 6 additions & 0 deletions eng/helix/content/RunTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ static async Task Main(string[] args)
{
keepGoing = runner.InstallAspNetRefIfNeeded();
}
#if INSTALLPLAYWRIGHT
if (keepGoing)
{
keepGoing = await runner.InstallPlaywrightAsync();
}
#endif

runner.DisplayContents();

Expand Down
2 changes: 2 additions & 0 deletions eng/helix/content/RunTests/RunTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<DefineConstants Condition=" '$(InstallPlaywright)' == 'true' ">$(DefineConstants);INSTALLPLAYWRIGHT</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20158.1" />
<PackageReference Condition=" '$(InstallPlaywright)' == 'true' " Include="PlaywrightSharp" Version="0.180.0" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion eng/helix/content/RunTests/RunTestsOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
Expand Down Expand Up @@ -67,7 +68,7 @@ public static RunTestsOptions Parse(string[] args)
Quarantined = parseResult.ValueForOption<bool>("--quarantined"),
RuntimeVersion = sharedFxVersion,
Target = parseResult.ValueForOption<string>("--target"),
Timeout = TimeSpan.Parse(parseResult.ValueForOption<string>("--helixTimeout")),
Timeout = TimeSpan.Parse(parseResult.ValueForOption<string>("--helixTimeout"), CultureInfo.InvariantCulture),

// When targeting pack builds, it has exactly the same version as the shared framework.
AspNetRef = $"Microsoft.AspNetCore.App.Ref.{sharedFxVersion}.nupkg",
Expand Down
37 changes: 36 additions & 1 deletion eng/helix/content/RunTests/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
#if INSTALLPLAYWRIGHT
using PlaywrightSharp;
#endif

namespace RunTests
{
Expand Down Expand Up @@ -40,6 +43,13 @@ public bool SetupEnvironment()
Console.WriteLine($"Set DotNetEfFullPath: {dotnetEFFullPath}");
EnvironmentVariables.Add("DotNetEfFullPath", dotnetEFFullPath);

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

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

Expand Down Expand Up @@ -80,6 +90,23 @@ public void DisplayContents(string path = "./")
}
}

#if INSTALLPLAYWRIGHT
public async Task<bool> InstallPlaywrightAsync()
{
try
{
Console.WriteLine($"Installing Playwright to {EnvironmentVariables["PLAYWRIGHT_BROWSERS_PATH"]}");
await Playwright.InstallAsync(EnvironmentVariables["PLAYWRIGHT_BROWSERS_PATH"]);
return true;
}
catch (Exception e)
{
Console.WriteLine($"Exception installing playwright: {e.ToString()}");
return false;
}
}
#endif

public async Task<bool> InstallAspNetAppIfNeededAsync()
{
try
Expand Down Expand Up @@ -136,6 +163,14 @@ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
throwOnError: false,
cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);

await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
$"tool install dotnet-serve --tool-path {Options.HELIX_WORKITEM_ROOT}",
environmentVariables: EnvironmentVariables,
outputDataReceived: Console.WriteLine,
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 @@ -231,7 +266,7 @@ public async Task<int> RunTestsAsync()
{
// Timeout test run 5 minutes before the Helix job would timeout
var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5)));
var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\"";
var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=15m\"";
if (Options.Quarantined)
{
Console.WriteLine("Running quarantined tests.");
Expand Down
12 changes: 12 additions & 0 deletions eng/helix/content/installPlaywrightReqs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Write-Host "Set-ExecutionPolicy Bypass -Scope Process"
Set-ExecutionPolicy Bypass -Scope Process
if ((Get-WindowsOptionalFeature -FeatureName ServerMediaFoundation -Online).State -eq "Enabled") {
Write-Host "ServerMediaFoundation feature already enabled."
} else {
Write-Host "Enable-WindowsOptionalFeature -Online -FeatureName ServerMediaFoundation (For Playwright)"
try {
Enable-WindowsOptionalFeature -Online -FeatureName ServerMediaFoundation
} catch {
Write-Host "Enable-WindowsOptionalFeature -Online -FeatureName ServerMediaFoundation threw an exception: $PSItem"
}
}
11 changes: 6 additions & 5 deletions eng/helix/content/runtests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ param(
[string]$Quarantined,
[string]$EF,
[string]$HelixTimeout,
[string]$InstallPlaywright,
[string]$FeedCred
)

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

$currentDirectory = Get-Location
$envPath = "$env:PATH;$env:HELIX_CORRELATION_PAYLOAD\node\bin"
Expand Down Expand Up @@ -53,7 +55,6 @@ function InstallDotnetSDKAndRuntime([string]$Feed, [string]$FeedCredParam) {
Write-Host "Set PATH to: $env:PATH"

$success = InvokeInstallDotnet ". eng\common\tools.ps1; InstallDotNet $env:DOTNET_ROOT $SdkVersion $Arch `'`' `$true `'$Feed`' `'$FeedCredParam`' `$true"

if (!$success) {
Write-Host "Retrying..."
continue
Expand All @@ -79,15 +80,15 @@ if ([string]::IsNullOrEmpty($FeedCred)) {
InstallDotnetSDKAndRuntime "https://dotnetclimsrc.blob.core.windows.net/dotnet" $FeedCred
}

Write-Host "Restore: dotnet restore RunTests\RunTests.csproj --ignore-failed-sources"
dotnet restore RunTests\RunTests.csproj --ignore-failed-sources
Write-Host "Restore: dotnet restore RunTests\RunTests.csproj --ignore-failed-sources /p:InstallPlaywright=$InstallPlaywright"
dotnet restore RunTests\RunTests.csproj --ignore-failed-sources /p:InstallPlaywright=$InstallPlaywright

if ($LastExitCode -ne 0) {
exit $LastExitCode
}

Write-Host "Running tests: dotnet run --no-restore --project RunTests\RunTests.csproj -- --target $Target --runtime $AspRuntimeVersion --queue $Queue --arch $Arch --quarantined $Quarantined --ef $EF --helixTimeout $HelixTimeout"
dotnet run --no-restore --project RunTests\RunTests.csproj -- --target $Target --runtime $AspRuntimeVersion --queue $Queue --arch $Arch --quarantined $Quarantined --ef $EF --helixTimeout $HelixTimeout
Write-Host "Running tests: dotnet run --no-restore /p:InstallPlaywright=$InstallPlaywright --project RunTests\RunTests.csproj -- --target $Target --runtime $AspRuntimeVersion --queue $Queue --arch $Arch --quarantined $Quarantined --ef $EF --helixTimeout $HelixTimeout"
dotnet run --no-restore /p:InstallPlaywright=$InstallPlaywright --project RunTests\RunTests.csproj -- --target $Target --runtime $AspRuntimeVersion --queue $Queue --arch $Arch --quarantined $Quarantined --ef $EF --helixTimeout $HelixTimeout

Write-Host "Finished running tests: exit_code=$LastExitCode"
exit $LastExitCode
7 changes: 5 additions & 2 deletions eng/helix/content/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export DOTNET_CLI_HOME="$DIR/.home$RANDOM"

export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

# Set playwright browser path
export PLAYWRIGHT_BROWSERS_PATH="$DIR/ms-playwright"

RESET="\033[0m"
RED="\033[0;31m"
YELLOW="\033[0;33m"
Expand All @@ -49,15 +52,15 @@ if [[ -z "${10:-}" ]]; then
}
else
echo "InstallDotNet $DOTNET_ROOT $dotnet_sdk_version '' '' true https://dotnetclimsrc.blob.core.windows.net/dotnet ..."
InstallDotNet $DOTNET_ROOT $dotnet_sdk_version "" "" true https://dotnetclimsrc.blob.core.windows.net/dotnet ${10} || {
InstallDotNet $DOTNET_ROOT $dotnet_sdk_version "" "" true https://dotnetclimsrc.blob.core.windows.net/dotnet ${11} || {
exit_code=$?
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
ExitWithExitCode $exit_code
}
echo

echo "InstallDotNet $DOTNET_ROOT $dotnet_runtime_version '' dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ..."
InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ${10} || {
InstallDotNet $DOTNET_ROOT $dotnet_runtime_version "" dotnet true https://dotnetclimsrc.blob.core.windows.net/dotnet ${11} || {
exit_code=$?
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2
ExitWithExitCode $exit_code
Expand Down
8 changes: 0 additions & 8 deletions eng/targets/Helix.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@

<ItemGroup Condition="'$(IsWindowsOnlyTest)' == 'true'">
<HelixAvailablePlatform Include="Windows" />

<HelixContent Include="$(RepoRoot)src\Servers\IIS\tools\update_schema.ps1" />
<HelixContent Include="$(RepoRoot)src\Servers\IIS\tools\UpdateIISExpressCertificate.ps1" />
<HelixContent Include="$(RepoRoot)src\Servers\IIS\tools\TestCert.pfx" />
<HelixContent Include="$(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml" />

<HelixPreCommand Include="call RunPowershell.cmd update_schema.ps1 || exit /b 1" />
<HelixPreCommand Include="call RunPowershell.cmd UpdateIISExpressCertificate.ps1 || exit /b 1" />
</ItemGroup>

<!-- PR(ci.yaml) required queues -->
Expand Down
22 changes: 20 additions & 2 deletions eng/targets/Helix.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@
<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>

<ItemGroup Condition="'$(TestDependsOnPlaywright)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
<HelixPreCommand Include="call RunPowershell.cmd installPlaywrightReqs.ps1 || exit /b 1" />
</ItemGroup>

<ItemGroup Condition="'$(TestDependsOnIIS)' == 'true' AND '$(IsWindowsOnlyTest)' == 'true'">
<HelixContent Include="$(RepoRoot)src\Servers\IIS\tools\update_schema.ps1" />
<HelixContent Include="$(RepoRoot)src\Servers\IIS\tools\UpdateIISExpressCertificate.ps1" />
<HelixContent Include="$(RepoRoot)src\Servers\IIS\tools\TestCert.pfx" />
<HelixContent Include="$(RepoRoot)src\Servers\IIS\AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml" />

<HelixPreCommand Include="call RunPowershell.cmd update_schema.ps1 || exit /b 1" />
<HelixPreCommand Include="call RunPowershell.cmd UpdateIISExpressCertificate.ps1 || exit /b 1" />
</ItemGroup>

<ItemGroup Condition="'$(TestDependsOnNode)' == 'true' AND '$(IsWindowsHelixQueue)' == 'false'">
<HelixPreCommand Include="./installnode.sh $(NodeVersion) $(TargetArchitecture)" />
</ItemGroup>
Expand Down Expand Up @@ -163,8 +181,8 @@
SharedFxVersion because that's needed even when the targeting pack isn't building.
Use the BrowserDebugHost transport package as a sentinel for the non-shipping version of the NETCoreApp shared framework.
-->
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreBrowserDebugHostTransportVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfVersion) $(HelixTimeout) $(DotNetRuntimeSourceFeedKey)</Command>
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreBrowserDebugHostTransportVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfVersion) $(HelixTimeout) $(DotNetRuntimeSourceFeedKey)</Command>
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreBrowserDebugHostTransportVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfVersion) $(HelixTimeout) $(TestDependsOnPlaywright) $(DotNetRuntimeSourceFeedKey)</Command>
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreBrowserDebugHostTransportVersion) $(SharedFxVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfVersion) $(HelixTimeout) $(TestDependsOnPlaywright) $(DotNetRuntimeSourceFeedKey)</Command>
<Command Condition="$(HelixCommand) != ''">$(HelixCommand)</Command>
<Timeout>$(HelixTimeout)</Timeout>
</HelixWorkItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Microsoft.AspNetCore.BrowserTesting;
using Microsoft.AspNetCore.Testing;
using PlaywrightSharp;
using ProjectTemplates.Tests.Infrastructure;
using Templates.Test.Helpers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

<RunTemplateTests Condition="'$(RunTemplateTests)' == ''">true</RunTemplateTests>
<SkipTests Condition="'$(RunTemplateTests)' != 'true'">true</SkipTests>
<!--Do not run this test project on Helix.-->
<BuildHelixPayload>false</BuildHelixPayload>
<IsWindowsOnlyTest>true</IsWindowsOnlyTest>
<SkipHelixArm>true</SkipHelixArm>

<BaseOutputPath />
<OutputPath />

Expand All @@ -18,6 +16,8 @@
<TestTemplateCreationFolder>TestTemplates\</TestTemplateCreationFolder>
<TestPackageRestorePath>$([MSBuild]::EnsureTrailingSlash('$(RepoRoot)'))obj\template-restore\</TestPackageRestorePath>
<TestDependsOnAspNetRuntime>true</TestDependsOnAspNetRuntime>
<TestDependsOnMssql>true</TestDependsOnMssql>
<TestDependsOnPlaywright>true</TestDependsOnPlaywright>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public async Task BlazorWasmStandaloneTemplate_Works(BrowserKind browserKind)
EnsureBrowserAvailable(browserKind);
}
}

Assert.True(0 == 1, "Fail to get logs");
}

private async Task<IPage> NavigateToPage(IBrowserContext browser, string listeningUri)
Expand Down Expand Up @@ -654,7 +656,19 @@ private void UpdatePublishedSettings(Project serverProject)

Output.WriteLine("Running dotnet serve on published output...");
var developmentCertificate = DevelopmentCertificate.Create(project.TemplateOutputDir);
var serveProcess = ProcessEx.Run(Output, publishDir, DotNetMuxer.MuxerPathOrDefault(), $"serve -S --pfx \"{developmentCertificate.CertificatePath}\" --pfx-pwd \"{developmentCertificate.CertificatePassword}\" --port 0");
var args = $"-S --pfx \"{developmentCertificate.CertificatePath}\" --pfx-pwd \"{developmentCertificate.CertificatePassword}\" --port 0";
var command = DotNetMuxer.MuxerPathOrDefault();
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HELIX_DIR")))
{
args = $"serve " + args;
}
else
{
command = "dotnet-serve";
args = "--roll-forward LatestMajor " + args; // dotnet-serve targets net5.0 by default
}

var serveProcess = ProcessEx.Run(Output, publishDir, command, args);
var listeningUri = ResolveListeningUrl(serveProcess);
return (serveProcess, listeningUri);
}
Expand Down
18 changes: 12 additions & 6 deletions src/ProjectTemplates/Shared/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,25 @@ internal async Task<ProcessResult> RunDotNetEfUpdateDatabaseAsync()
{
var assembly = typeof(ProjectFactoryFixture).Assembly;

var dotNetEfFullPath = assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(attribute => attribute.Key == "DotNetEfFullPath")
.Value;

var args = $"\"{dotNetEfFullPath}\" --verbose --no-build database update";
var args = "--verbose --no-build database update";

// Only run one instance of 'dotnet new' at once, as a workaround for
// https://github.com/aspnet/templating/issues/63
await DotNetNewLock.WaitAsync();
try
{
Output.WriteLine("Acquired DotNetNewLock");
using var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), args);
var command = DotNetMuxer.MuxerPathOrDefault();
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DotNetEfFullPath")))
{
args = $"\"{DotNetEfFullPath}\" " + args;
}
else
{
command = "dotnet-ef";
}

using var result = ProcessEx.Run(Output, TemplateOutputDir, command, args);
await result.Exited;
return new ProcessResult(result);
}
Expand Down
1 change: 1 addition & 0 deletions src/Servers/IIS/IIS/test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<!-- IIS tests are Windows-only -->
<IsWindowsOnlyTest>true</IsWindowsOnlyTest>
<TestDependsOnIIS>true</TestDependsOnIIS>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Shared/BrowserTesting/src/BrowserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private async Task InitializeAsync()

async Task InitializeCore()
{
Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory, debug: "pw:api");
Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory/*, debug: "pw:api"*/);
foreach (var (browserName, options) in _browserManagerConfiguration.BrowserOptions)
{
if (!_launchBrowsers.ContainsKey(browserName))
Expand Down
17 changes: 16 additions & 1 deletion src/Shared/BrowserTesting/src/ContextInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,25 @@ internal BrowserContextOptions ConfigureUniqueHarPath(BrowserContextOptions brow
if (browserContextOptions?.RecordHar?.Path != null)
{
var identifier = Guid.NewGuid().ToString("N");
browserContextOptions.RecordHar.Path = Path.Combine(browserContextOptions.RecordHar.Path, $"{identifier}.har");
var harDirectory = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT");
if (string.IsNullOrEmpty(harDirectory))
{
harDirectory = browserContextOptions.RecordHar.Path;
}

browserContextOptions.RecordHar.Path = Path.Combine(harDirectory, $"{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;
}
}

return browserContextOptions;
}
}
Expand Down