Skip to content

Commit 359e7ed

Browse files
committed
Move Blazor Server template tests to new project
1 parent 0d15648 commit 359e7ed

24 files changed

+3225
-19
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.json diff
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using Microsoft.AspNetCore.E2ETesting;
5+
using Microsoft.AspNetCore.Testing;
6+
using Templates.Test.Helpers;
7+
using Xunit;
8+
9+
[assembly: TestFramework("Microsoft.AspNetCore.E2ETesting.XunitTestFrameworkWithAssemblyFixture", "BlazorTemplates.Tests")]
10+
11+
[assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(ProjectFactoryFixture))]
12+
[assembly: Microsoft.AspNetCore.E2ETesting.AssemblyFixture(typeof(SeleniumStandaloneServer))]
13+
14+
[assembly: QuarantinedTest("Investigation pending in https://github.com/dotnet/aspnetcore/issues/20479")]

src/ProjectTemplates/test/BlazorServerTemplateTest.cs renamed to src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public BlazorServerTemplateTest(ProjectFactoryFixture projectFactory, BrowserFix
2525
public Project Project { get; private set; }
2626

2727
[ConditionalFact(Skip = "This test ran for over an hour")]
28-
[SkipOnHelix("selenium")]
2928
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/20172")]
3029
public async Task BlazorServerTemplateWorks_NoAuth()
3130
{
@@ -84,7 +83,6 @@ public async Task BlazorServerTemplateWorks_NoAuth()
8483
[ConditionalTheory(Skip = "See: https://github.com/dotnet/aspnetcore/issues/20520")]
8584
[InlineData(true)]
8685
[InlineData(false)]
87-
[SkipOnHelix("ef restore no worky")]
8886
[QuarantinedTest]
8987
public async Task BlazorServerTemplateWorks_IndividualAuth(bool useLocalDB)
9088
{
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<!-- Shared testing infrastructure for running E2E tests using selenium -->
4+
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.props" />
5+
6+
<PropertyGroup>
7+
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
8+
<TestGroupName>ProjectTemplates.E2ETests</TestGroupName>
9+
<DefineConstants>$(DefineConstants);XPLAT</DefineConstants>
10+
11+
<RunTemplateTests Condition="'$(RunTemplateTests)' == ''" >true</RunTemplateTests>
12+
<!--Do not run this test project on Helix.-->
13+
<BuildHelixPayload>false</BuildHelixPayload>
14+
<SkipHelixArm>true</SkipHelixArm>
15+
16+
<BaseOutputPath />
17+
<OutputPath />
18+
19+
<!-- Properties that affect test runs -->
20+
<!-- TestTemplateCreationFolder is the folder where the templates will be created. Will point out to $(OutputDir)$(TestTemplateCreationFolder) -->
21+
<TestTemplateCreationFolder>TestTemplates\</TestTemplateCreationFolder>
22+
<TestPackageRestorePath>$([MSBuild]::EnsureTrailingSlash('$(RepoRoot)'))obj\template-restore\</TestPackageRestorePath>
23+
<TestTemplateTestsProps>TemplateTests.props</TestTemplateTestsProps>
24+
<GenerateLoggingTestingAssemblyAttributes>false</GenerateLoggingTestingAssemblyAttributes>
25+
<TestDependsOnAspNetRuntime>true</TestDependsOnAspNetRuntime>
26+
</PropertyGroup>
27+
28+
<ItemGroup>
29+
<EmbeddedResource Include="template-baselines.json" />
30+
<Compile Include="$(SharedSourceRoot)Process\*.cs" LinkBase="shared\Process" />
31+
<Compile Include="$(SharedSourceRoot)CertificateGeneration\**\*.cs" LinkBase="shared\CertificateGeneration" />
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<Reference Include="AngleSharp" />
36+
37+
<Compile Include="$(SharedSourceRoot)CommandLineUtils\**\*.cs" />
38+
</ItemGroup>
39+
40+
<ItemGroup>
41+
<ProjectReference Include="$(RepoRoot)src\Framework\src\Microsoft.AspNetCore.App.Runtime.csproj">
42+
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
43+
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
44+
</ProjectReference>
45+
<ProjectReference Include="$(RepoRoot)src\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj" />
46+
<ProjectReference Include="../testassets/DotNetToolsInstaller/DotNetToolsInstaller.csproj" ReferenceOutputAssembly="false" />
47+
<ProjectReference Include="../Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj" ReferenceOutputAssembly="false" />
48+
</ItemGroup>
49+
50+
<PropertyGroup>
51+
<PreserveExistingLogsInOutput Condition="'$(PreserveExistingLogsInOutput)' == '' AND '$(ContinuousIntegrationBuild)' == 'true'">true</PreserveExistingLogsInOutput>
52+
<PreserveExistingLogsInOutput Condition="'$(PreserveExistingLogsInOutput)' == ''">false</PreserveExistingLogsInOutput>
53+
</PropertyGroup>
54+
55+
<ItemGroup>
56+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
57+
<_Parameter1>DotNetEfFullPath</_Parameter1>
58+
<_Parameter2>$([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)'))dotnet-ef/$(DotnetEfPackageVersion)/tools/netcoreapp3.1/any/dotnet-ef.dll</_Parameter2>
59+
</AssemblyAttribute>
60+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
61+
<_Parameter1>TestPackageRestorePath</_Parameter1>
62+
<_Parameter2>$(TestPackageRestorePath)</_Parameter2>
63+
</AssemblyAttribute>
64+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
65+
<_Parameter1>Test.DefaultTargetFramework</_Parameter1>
66+
<_Parameter2>$(DefaultNetCoreTargetFramework)</_Parameter2>
67+
</AssemblyAttribute>
68+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
69+
<_Parameter1>ContinuousIntegrationBuild</_Parameter1>
70+
<_Parameter2>true</_Parameter2>
71+
</AssemblyAttribute>
72+
<AssemblyAttribute Include="Microsoft.AspNetCore.Testing.TestFrameworkFileLoggerAttribute">
73+
<_Parameter1>$(PreserveExistingLogsInOutput)</_Parameter1>
74+
<_Parameter2>$(TargetFramework)</_Parameter2>
75+
<_Parameter3></_Parameter3>
76+
</AssemblyAttribute>
77+
</ItemGroup>
78+
79+
<Target Name="PrepareForTest" BeforeTargets="CoreCompile" Condition="$(DesignTimeBuild) != true">
80+
<PropertyGroup>
81+
<TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder>
82+
<TestTemplateTestsProps>$(TestTemplateCreationFolder)$(TestTemplateTestsProps)</TestTemplateTestsProps>
83+
<CustomTemplateHivePath>$(TestTemplateCreationFolder)\Hives\$([System.Guid]::NewGuid())\.templateengine</CustomTemplateHivePath>
84+
</PropertyGroup>
85+
86+
<ItemGroup>
87+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
88+
<_Parameter1>ArtifactsShippingPackagesDir</_Parameter1>
89+
<_Parameter2>$(ArtifactsShippingPackagesDir)</_Parameter2>
90+
</AssemblyAttribute>
91+
92+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
93+
<_Parameter1>ArtifactsLogDir</_Parameter1>
94+
<_Parameter2>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'log'))</_Parameter2>
95+
</AssemblyAttribute>
96+
97+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
98+
<_Parameter1>ArtifactsNonShippingPackagesDir</_Parameter1>
99+
<_Parameter2>$(ArtifactsNonShippingPackagesDir)</_Parameter2>
100+
</AssemblyAttribute>
101+
102+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
103+
<_Parameter1>TestTemplateCreationFolder</_Parameter1>
104+
<_Parameter2>$(TestTemplateCreationFolder)</_Parameter2>
105+
</AssemblyAttribute>
106+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
107+
<_Parameter1>CustomTemplateHivePath</_Parameter1>
108+
<_Parameter2>$(CustomTemplateHivePath)</_Parameter2>
109+
</AssemblyAttribute>
110+
</ItemGroup>
111+
112+
<Message Importance="high" Text="Preparing environment for tests" />
113+
<!-- Remove the template creation folders and the package-restore folders to ensure that when we run the tests we don't
114+
get cached results and changes show up.
115+
-->
116+
117+
<ItemGroup>
118+
<_ExistingFilesFromLastRun Include="$(TestTemplateCreationFolder)**\*" />
119+
</ItemGroup>
120+
121+
<Delete Files="@(_ExistingFilesFromLastRun)" ContinueOnError="true" />
122+
123+
<Removedir Directories="$(TestTemplateCreationFolder)" Condition="Exists('$(TestTemplateCreationFolder)')" ContinueOnError="true">
124+
<Output TaskParameter="RemovedDirectories" ItemName="_CleanedUpDirectories" />
125+
</Removedir>
126+
<Removedir Directories="$(TestPackageRestorePath)" Condition="Exists('$(TestPackageRestorePath)')" ContinueOnError="true">
127+
<Output TaskParameter="RemovedDirectories" ItemName="_CleanedUpDirectories" />
128+
</Removedir>
129+
130+
<Message Importance="high" Text="Removed directory %(_CleanedUpDirectories.Identity)" />
131+
132+
<MakeDir Directories="$(TestTemplateCreationFolder)">
133+
<Output TaskParameter="DirectoriesCreated" ItemName="_CreatedDirectories" />
134+
</MakeDir>
135+
<MakeDir Directories="$(TestPackageRestorePath)">
136+
<Output TaskParameter="DirectoriesCreated" ItemName="_CreatedDirectories" />
137+
</MakeDir>
138+
139+
<Message Importance="high" Text="Created directory %(_CreatedDirectories.Identity)" />
140+
141+
<GenerateFileFromTemplate
142+
TemplateFile="$(MSBuildThisFileDirectory)Infrastructure\Directory.Build.targets.in"
143+
Properties="TemplateTestsPropsPath=$(TestTemplateTestsProps)"
144+
OutputPath="$(TestTemplateCreationFolder)Directory.Build.targets" />
145+
146+
<GenerateFileFromTemplate
147+
TemplateFile="$(MSBuildThisFileDirectory)Infrastructure\Directory.Build.props.in"
148+
Properties=""
149+
OutputPath="$(TestTemplateCreationFolder)Directory.Build.props" />
150+
151+
<!-- Workaround https://github.com/dotnet/core-setup/issues/6420 - there is no MSBuild setting for rollforward yet -->
152+
<Copy SourceFiles="$(MSBuildThisFileDirectory)Infrastructure\runtimeconfig.norollforward.json" DestinationFolder="$(TestTemplateCreationFolder)" UseHardLinksIfPossible="true" />
153+
154+
<Delete Files="$(TestTemplateTestsProps)" />
155+
156+
</Target>
157+
158+
<!-- Shared testing infrastructure for running E2E tests using selenium -->
159+
<Import Project="$(SharedSourceRoot)E2ETesting\E2ETesting.targets" />
160+
161+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<Project>
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.targets))\Directory.Build.targets" />
3+
<Import Project="$(MSBuildThisFileDirectory)Infrastructure\GenerateTestProps.targets" />
4+
</Project>

0 commit comments

Comments
 (0)