Skip to content

Try reenabling helix for components #18636

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

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b134013
Try reenabling helix for components
HaoK Jan 28, 2020
8e7a6fc
Update Microsoft.AspNetCore.Components.E2ETests.csproj
HaoK Jan 28, 2020
90aa6ba
Update Microsoft.AspNetCore.Components.E2ETests.csproj
HaoK Jan 28, 2020
7408c37
Update Microsoft.AspNetCore.Components.E2ETests.csproj
HaoK Jan 28, 2020
8f2d148
Update Microsoft.AspNetCore.Components.E2ETests.csproj
HaoK Jan 28, 2020
546542a
Update Microsoft.AspNetCore.Components.E2ETests.csproj
HaoK Jan 28, 2020
e9acce3
Components needs node
HaoK Jan 29, 2020
63ca262
Skip tracking logic in helix
javiercn Feb 18, 2020
65c6641
Cleanup
HaoK Mar 9, 2020
32d299a
Update runtests.cmd
HaoK Mar 9, 2020
96184fe
Update runtests.cmd
HaoK Mar 9, 2020
e221c4d
Update Microsoft.AspNetCore.SpaServices.Extensions.Tests.csproj
HaoK Mar 9, 2020
4dda963
Update Microsoft.AspNetCore.SpaServices.Extensions.Tests.csproj
HaoK Mar 9, 2020
bc164d6
Update runtests.cmd
HaoK Mar 9, 2020
79a3cb6
Update Helix.props
HaoK Mar 9, 2020
d09404b
Update InstallYarn.cmd
HaoK Mar 10, 2020
7cdd480
Update InstallYarn.cmd
HaoK Mar 10, 2020
e2adda5
Update runtests.cmd
HaoK Mar 10, 2020
7af41a9
Update InstallNode.ps1
HaoK Mar 10, 2020
f8d89bf
Update InstallYarn.cmd
HaoK Mar 10, 2020
1aa8aa4
Update InstallNode.ps1
HaoK Mar 11, 2020
18b4f7d
Update InstallYarn.cmd
HaoK Mar 11, 2020
434f914
Update runtests.cmd
HaoK Mar 11, 2020
37400a5
Update InstallYarn.cmd
HaoK Mar 11, 2020
705f094
Update InstallYarn.cmd
HaoK Mar 11, 2020
f0b613b
Update InstallYarn.cmd
HaoK Mar 11, 2020
251a6ab
npm => yarn
HaoK Mar 11, 2020
1a889f2
Update InstallYarn.cmd
HaoK Mar 11, 2020
938b064
Update SeleniumStandaloneServer.cs
HaoK Mar 11, 2020
d1519c7
Update SeleniumStandaloneServer.cs
HaoK Mar 12, 2020
6b729c9
Update SeleniumStandaloneServer.cs
HaoK Mar 12, 2020
cd3b9e6
Update InstallYarn.cmd
HaoK Mar 13, 2020
474270d
Manually restore npm/yarn
HaoK Mar 13, 2020
97c6501
Fix config path
HaoK Mar 13, 2020
bde697d
InstallChrome
HaoK Mar 13, 2020
0e36a95
Update Helix.targets
HaoK Mar 13, 2020
ecc7884
Update Microsoft.AspNetCore.Components.E2ETests.csproj
HaoK Mar 13, 2020
f8923ac
Update Microsoft.AspNetCore.Components.E2ETests.csproj
HaoK Mar 13, 2020
d4c53d8
Fix screenshot path
HaoK Mar 14, 2020
17eaf65
Copy logs and screenshots to upload root
HaoK Mar 14, 2020
3dcea8c
Remove spew
HaoK Mar 14, 2020
9e996fa
Update Microsoft.AspNetCore.Components.E2ETests.csproj
HaoK Mar 14, 2020
4887b70
Update E2ETestOptions.cs
HaoK Mar 14, 2020
5762d66
Fix upload
HaoK Mar 14, 2020
51a9029
Try writing screenshots to upload root
HaoK Mar 14, 2020
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
4 changes: 4 additions & 0 deletions eng/helix/content/InstallChrome.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$InstallerPath = "$env:Temp\chrome_installer.exe";
Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $InstallerPath;
Start-Process -FilePath $InstallerPath -Args "/silent /install" -Verb RunAs -Wait;
Remove-Item $InstallerPath
2 changes: 1 addition & 1 deletion eng/helix/content/InstallJdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ Remove-Item -Force -Recurse $tempDir -ErrorAction Ignore | out-null

if ($env:TF_BUILD) {
Write-Host "##vso[task.prependpath]$installDir\bin"
}
}
6 changes: 3 additions & 3 deletions eng/helix/content/InstallNode.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ param(

$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
$InstallDir = '.' # Use workload directory always

Set-StrictMode -Version 1

Expand Down Expand Up @@ -59,9 +60,8 @@ else {

Write-Host "Expanded NodeJs"
New-Item -Path "$InstallDir" -ItemType "directory" -Force
Write-Host "Copying $tempDir\$nodeFile\node.exe to $InstallDir"
Copy-Item "$tempDir\$nodeFile\node.exe" "$InstallDir\node.exe"

Write-Host "Copying $tempDir\$nodeFile\* to $InstallDir"
Copy-Item "$tempDir\$nodeFile\*" "$InstallDir" -Recurse
if (Test-Path "$InstallDir\node.exe")
{
Write-Host "Node.exe copied to $InstallDir"
Expand Down
7 changes: 7 additions & 0 deletions eng/helix/content/InstallYarn.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set PATH=%HELIX_WORKITEM_ROOT%;%PATH%;%HELIX_CORRELATION_PAYLOAD%\jdk\bin
call npm.cmd i yarn
xcopy /S /I /E /Q %HELIX_WORKITEM_ROOT%\node_modules\npm npmBak
xcopy /S /I /E /Q %HELIX_WORKITEM_ROOT%\node_modules\yarn yarnBak
call yarn install
xcopy /S /I /E /Q npmBak %HELIX_WORKITEM_ROOT%\node_modules\npm
xcopy /S /I /E /Q yarnBak %HELIX_WORKITEM_ROOT%\node_modules\yarn
11 changes: 9 additions & 2 deletions eng/helix/content/runtests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_MULTILEVEL_LOOKUP=0
set DOTNET_CLI_HOME=%HELIX_CORRELATION_PAYLOAD%\home

set PATH=%DOTNET_ROOT%;!PATH!;%HELIX_CORRELATION_PAYLOAD%\node\bin
echo Set path to: %PATH%
set PATH=%DOTNET_ROOT%;%HELIX_WORKITEM_ROOT%;%HELIX_CORRELATION_PAYLOAD%\jdk\bin;!PATH!
echo Set path to: !PATH!
echo "Installing SDK"
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %$arch% -Version %$sdkVersion% -InstallDir %DOTNET_ROOT%"
echo "Installing Runtime"
Expand All @@ -35,6 +35,7 @@ if EXIST ".\Microsoft.AspNetCore.App" (
dotnet tool install dotnet-ef --global --version %$efVersion%

set PATH=!PATH!;%DOTNET_CLI_HOME%\.dotnet\tools
echo Set path to: !PATH!
)

echo "Current Directory: %HELIX_WORKITEM_ROOT%"
Expand Down Expand Up @@ -90,6 +91,12 @@ if %$quarantined%==true (

echo "Copying TestResults\TestResults.xml to ."
copy TestResults\TestResults.xml testResults.xml
echo "Copying artifacts/logs to %HELIX_WORKITEM_UPLOAD_ROOT%/../"
for /R artifacts/log %%f in (*.log) do copy %%f %HELIX_WORKITEM_UPLOAD_ROOT%/../
for /R artifacts/log %%f in (*.log) do copy %%f %HELIX_WORKITEM_UPLOAD_ROOT%/
echo "Copying screenshots to %HELIX_WORKITEM_UPLOAD_ROOT%/../"
for /R screenshots %%f in (*) do copy %%f %HELIX_WORKITEM_UPLOAD_ROOT%/../
for /R screenshots %%f in (*) do copy %%f %HELIX_WORKITEM_UPLOAD_ROOT%/

exit /b %exit_code%

8 changes: 8 additions & 0 deletions eng/targets/Helix.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
<HelixPreCommand Include="call RunPowershell.cmd InstallNode.ps1 $(NodeVersion) %25HELIX_CORRELATION_PAYLOAD%25\node\bin || exit /b 1" />
</ItemGroup>

<ItemGroup Condition="'$(TestDependsOnYarn)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
<HelixPreCommand Include="call InstallYarn.cmd || exit /b 1" />
</ItemGroup>

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

<ItemGroup Condition="'$(IsHelixJob)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true' AND '$(TestDependsOnAspNetRuntime)' == 'true'">
<HelixContent Include="$(RepoRoot)artifacts\packages\Release\Shipping\Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg" />
<HelixPreCommand Include="call RunPowershell.cmd InstallAppRuntime.ps1 Microsoft.AspNetCore.App.Runtime.win-x64.$(AppRuntimeVersion).nupkg Microsoft.AspNetCore.App netcoreapp5.0 win-x64 || exit /b 1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ private static Dictionary<string, string> FindProjects()

protected static string FindSampleOrTestSitePath(string projectName)
{
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
{
return Path.Combine(AppContext.BaseDirectory, "BasicTestApp");
}

var projects = _projects.Value;
if (projects.TryGetValue(projectName, out var dir))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,18 @@
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<TestGroupName>Components.E2ETests</TestGroupName>

<!-- https://github.com/dotnet/aspnetcore/issues/6857 -->
<BuildHelixPayload>false</BuildHelixPayload>

<!-- Run on platforms where we support Selenium -->
<SkipTests Condition="'$(SeleniumE2ETestsSupported)' != 'true'">true</SkipTests>
<SkipTests Condition="'$(SeleniumE2ETestsSupported)' == 'true'">false</SkipTests>

<!-- Tests do not work on Helix or when bin/ directory is not in project directory due to undeclared dependency on test content. -->
<BaseOutputPath />

<OutputPath />


<GenerateLoggingTestingAssemblyAttributes>false</GenerateLoggingTestingAssemblyAttributes>

<!-- Avoid CS1705 errors due to mix of assemblies brought in transitively. -->
<CompileUsingReferenceAssemblies>false</CompileUsingReferenceAssemblies>
<TestDependsOnNode>true</TestDependsOnNode>
<TestDependsOnJava>true</TestDependsOnJava>
<TestDependsOnYarn>true</TestDependsOnYarn>
<TestDependsOnChrome>true</TestDependsOnChrome>
</PropertyGroup>

<ItemGroup>
Expand All @@ -48,6 +44,16 @@
<ProjectReference Include="..\testassets\TestServer\Components.TestServer.csproj" />
</ItemGroup>

<ItemGroup>
<HelixContent Include="package.json" />
<HelixContent Include="yarn.lock" />
<HelixContent Include="..\..\..\Shared\E2ETesting\selenium-config.json" />
<HelixContent Include="$(ArtifactsBinDir)AzureAD.WebSite\$(Configuration)\**\AzureAD.WebSite.deps.json" />
<HelixContent Include="..\testassets\**\*" />
<!-- This is currently windows only -->
<HelixProjectPlatform Remove="Linux;OSX" />
</ItemGroup>

<!-- Shared testing infrastructure for running E2E tests using selenium -->
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.targets" />

Expand Down
2 changes: 1 addition & 1 deletion src/Components/test/E2ETest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"private": true,
"scripts": {
"selenium-standalone": "selenium-standalone",
"prepare": "selenium-standalone install --config ../../../Shared/E2ETesting/selenium-config.json"
"prepare": "selenium-standalone install --config selenium-config.json"
},
"author": "",
"license": "Apache-2.0",
Expand Down
6 changes: 6 additions & 0 deletions src/Components/test/E2ETest/selenium-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"drivers": {
"chrome": {}
},
"ignoreExtraDrivers": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>Microsoft.AspNetCore.Testing.BasicTestApp.ContentRoot</_Parameter1>
<_Parameter2>$([MSBuild]::NormalizeDirectory('$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\BasicTestApp'))'))</_Parameter2>
<_Parameter2 Condition="$(IsHelixJob) != 'true'">$([MSBuild]::NormalizeDirectory('$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\BasicTestApp'))'))</_Parameter2>
<_Parameter2 Condition="$(IsHelixJob) == 'true'">..\BasicTestApp'))'))</_Parameter2>
</AssemblyAttribute>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<PropertyGroup>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<TestDependsOnNode>true</TestDependsOnNode>
<!-- Depends on npm which is not picked up on helix -->
<!-- https://github.com/dotnet/aspnetcore/issues/18672 -->
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Shared/E2ETesting/E2ETestOptions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -45,6 +47,10 @@ static E2ETestOptions()
var instance = new E2ETestOptions();
Configuration.Bind(instance);
Instance = instance;
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT")))
{
instance.ScreenShotsPath = Path.Combine(Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"), "..");
}
}
catch
{
Expand Down
69 changes: 40 additions & 29 deletions src/Shared/E2ETesting/SeleniumStandaloneServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ private static async Task InitializeInstance(ITestOutputHelper output)
var port = FindAvailablePort();
var uri = new UriBuilder("http", "localhost", port, "/wd/hub").Uri;

var seleniumConfigPath = typeof(SeleniumStandaloneServer).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
.FirstOrDefault(k => k.Key == "Microsoft.AspNetCore.Testing.SeleniumConfigPath")
?.Value;
var seleniumConfigPath = (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix"))) ?
typeof(SeleniumStandaloneServer).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
.FirstOrDefault(k => k.Key == "Microsoft.AspNetCore.Testing.SeleniumConfigPath")
?.Value
: "selenium-config.json";

if (seleniumConfigPath == null)
{
Expand All @@ -98,7 +100,7 @@ private static async Task InitializeInstance(ITestOutputHelper output)

var psi = new ProcessStartInfo
{
FileName = "npm",
FileName = (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix"))) ? "npm" : "yarn",
Arguments = $"run selenium-standalone start -- --config \"{seleniumConfigPath}\" -- -port {port}",
RedirectStandardOutput = true,
RedirectStandardError = true,
Expand All @@ -107,38 +109,47 @@ private static async Task InitializeInstance(ITestOutputHelper output)
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
psi.FileName = "cmd";
psi.Arguments = $"/c npm {psi.Arguments}";
}

// It's important that we get the folder value before we start the process to prevent
// untracked processes when the tracking folder is not correctly configure.
var trackingFolder = GetProcessTrackingFolder();
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
{
// Just create a random tracking folder on helix
trackingFolder = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName());
Directory.CreateDirectory(trackingFolder);
}

if (!Directory.Exists(trackingFolder))
{
throw new InvalidOperationException($"Invalid tracking folder. Set the 'SeleniumProcessTrackingFolder' MSBuild property to a valid folder.");
var cmd = (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix"))) ? "npm" : "yarn";
psi.Arguments = $"/c {cmd} {psi.Arguments}";
}

Process process = null;
Process sentinel = null;
string pidFilePath = null;
try
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
{
process = Process.Start(psi);
pidFilePath = await WriteTrackingFileAsync(output, trackingFolder, process);
sentinel = StartSentinelProcess(process, pidFilePath, SeleniumProcessTimeout);
// It's important that we get the folder value before we start the process to prevent
// untracked processes when the tracking folder is not correctly configure.
var trackingFolder = GetProcessTrackingFolder();

if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
{
// Just create a random tracking folder on helix
trackingFolder = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName());
Directory.CreateDirectory(trackingFolder);
}

if (!Directory.Exists(trackingFolder))
{
throw new InvalidOperationException($"Invalid tracking folder. Set the 'SeleniumProcessTrackingFolder' MSBuild property to a valid folder.");
}

try
{
process = Process.Start(psi);
pidFilePath = await WriteTrackingFileAsync(output, trackingFolder, process);
sentinel = StartSentinelProcess(process, pidFilePath, SeleniumProcessTimeout);
}
catch
{
ProcessCleanup(process, pidFilePath);
ProcessCleanup(sentinel, pidFilePath: null);
throw;
}
}
catch
else
{
ProcessCleanup(process, pidFilePath);
ProcessCleanup(sentinel, pidFilePath: null);
throw;
process = Process.Start(psi);
}

// Log output for selenium standalone process.
Expand Down