Skip to content

Enable components tests on helix #21280

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 25 commits into from
Closed
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
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"
}
}
23 changes: 11 additions & 12 deletions eng/helix/content/InstallNode.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@
This script installs NodeJs from http://nodejs.org/dist on a machine.
.PARAMETER Version
The version of NodeJS to install.
.PARAMETER InstallDir
The directory to install NodeJS to.
.LINK
https://nodejs.org/en/
#>
param(
[Parameter(Mandatory = $true)]
$Version,

[Parameter(Mandatory = $true)]
$InstallDir
$Version
)

$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
$InstallDir = $PSScriptRoot + '\nodejs' # Always install to workitem root / nodejs

Set-StrictMode -Version 1

Expand All @@ -31,7 +27,7 @@ if (Get-Command "node.exe" -ErrorAction SilentlyContinue)

if (Test-Path "$InstallDir\node.exe")
{
Write-Host "Node.exe found at $InstallDir"
Write-Host "Node.exe found at $InstallDir\node.exe"
exit
}

Expand All @@ -57,11 +53,8 @@ else {
[System.IO.Compression.ZipFile]::ExtractToDirectory("nodejs.zip", $tempDir)
}

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 "Expanded NodeJs to $tempDir, moving $tempDir\$nodeFile to $InstallDir subdir"
move $tempDir\$nodeFile $InstallDir
if (Test-Path "$InstallDir\node.exe")
{
Write-Host "Node.exe copied to $InstallDir"
Expand All @@ -70,3 +63,9 @@ else
{
Write-Host "Node.exe not copied to $InstallDir"
}
if (Test-Path "package-lock.json")
{
$Env:Path = $Env:Path + $InstallDir
Write-Host "Found package-lock.json, set path to $Env:Path running npm install..."
Invoke-Expression "npm install"
}
1 change: 1 addition & 0 deletions eng/helix/content/RunTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static async Task Main(string[] args)
}

runner.DisplayContents();
runner.DisplayContents("./wwwroot");

if (keepGoing)
{
Expand Down
8 changes: 2 additions & 6 deletions eng/helix/content/RunTests/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,9 @@ public void DisplayContents(string path = "./")
{
Console.WriteLine();
Console.WriteLine($"Displaying directory contents for {path}:");
foreach (var file in Directory.EnumerateFiles(path))
foreach (var file in Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories))
{
Console.WriteLine(Path.GetFileName(file));
}
foreach (var file in Directory.EnumerateDirectories(path))
{
Console.WriteLine(Path.GetFileName(file));
Console.WriteLine(file);
}
Console.WriteLine();
}
Expand Down
4 changes: 4 additions & 0 deletions eng/helix/content/installnode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ echo "Installing node from $(basename $url) $url"
mkdir $output_dir
echo "Unpacking to $output_dir"
tar --strip-components 1 -xzf "node-v$node_version-$platformarch.tar.gz" --no-same-owner --directory "$output_dir"
if [ -f "package-lock.json" ]; then
echo "Found package-lock.json, running npm install"
npm install
fi
2 changes: 1 addition & 1 deletion eng/helix/content/runtests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_MULTILEVEL_LOOKUP=0
set DOTNET_CLI_HOME=%CD%\home%random%

set "PATH=%DOTNET_ROOT%;%PATH%;%HELIX_CORRELATION_PAYLOAD%\node\bin"
set "PATH=%DOTNET_ROOT%;%PATH%;%CD%\nodejs"
echo Set path to: "%PATH%"
echo.

Expand Down
6 changes: 5 additions & 1 deletion eng/targets/Helix.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@
</ItemGroup>

<ItemGroup Condition="'$(TestDependsOnNode)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
<HelixPreCommand Include="call RunPowershell.cmd InstallNode.ps1 $(NodeVersion) %25HELIX_CORRELATION_PAYLOAD%25\node\bin || exit /b 1" />
<HelixPreCommand Include="call RunPowershell.cmd InstallNode.ps1 $(NodeVersion) || exit /b 1" />
</ItemGroup>

<ItemGroup Condition=" '$(TestDependsOnAspNetRuntime)' == 'true' ">
<!-- Grab all shipping packages. -->
<HelixContent Include="$(RepoRoot)artifacts\packages\$(Configuration)\Shipping\*$(SharedFxVersion).nupkg" />
</ItemGroup>

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

<ItemGroup>
<!-- Java test projects do not use xUnit. -->
<HelixContent Include="$(OutputPath)Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestAdapter.dll"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ private static Dictionary<string, string> FindProjects()

public static string FindSampleOrTestSitePath(string projectName)
{
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
{
var comma = projectName.IndexOf(",", StringComparison.Ordinal);
if (comma != -1)
{
projectName = projectName.Substring(0, comma);
}
if (string.Equals(projectName, "Components.TestServer", StringComparison.Ordinal))
{
projectName = "TestServer"; // This testasset doesn't match the folder name for some reason
}
var path = Path.Combine(AppContext.BaseDirectory, "testassets", projectName);
if (!Directory.Exists(path))
{
throw new ArgumentException($"Cannot find a sample or test site directory: '{path}'.");
}
return path;
}

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,20 +7,16 @@
<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 />

<!-- This project references the shared framework transitively. Prevent restore errors by setting this flag. -->
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>

<TestDependsOnNode>true</TestDependsOnNode>
<TestDependsOnJava>true</TestDependsOnJava>
<TestDependsOnChrome>true</TestDependsOnChrome>
</PropertyGroup>

<ItemGroup>
Expand All @@ -45,6 +41,16 @@
<ProjectReference Include="..\..\WebAssembly\testassets\Wasm.Authentication.Server\Wasm.Authentication.Server.csproj" />
</ItemGroup>

<ItemGroup>
<HelixContent Include="package.json" />
<HelixContent Include="package-lock.json" />
<HelixContent Include="..\..\..\Shared\E2ETesting\selenium-config.json" />
<HelixContent Include="..\testassets\**\*" LinkBase="testassets"/>
<HelixContent Include="..\..\Blazor\testassets\StandaloneApp\**\*" />
<!-- 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
Loading