diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 141eb757a838..c6054f70769a 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -13,6 +13,12 @@
"commands": [
"dotnet-format"
]
+ },
+ "playwright-sharp-tool": {
+ "version": "0.170.2",
+ "commands": [
+ "playwright-sharp"
+ ]
}
}
}
diff --git a/AspNetCore.sln b/AspNetCore.sln
index 19a61c8895b4..25201eefd3ac 100644
--- a/AspNetCore.sln
+++ b/AspNetCore.sln
@@ -1568,6 +1568,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IIS.Common.TestLib", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InProcessNewShimWebSite", "src\Servers\IIS\IIS\test\testassets\InProcessNewShimWebSite\InProcessNewShimWebSite.csproj", "{22EA0993-8DFC-40C2-8481-8E85E21EFB56}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BrowserTesting", "BrowserTesting", "{8F33439F-5532-45D6-8A44-20EF9104AA9D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.BrowserTesting", "src\Shared\BrowserTesting\src\Microsoft.AspNetCore.BrowserTesting.csproj", "{B739074E-6652-4F5B-B37E-775DC2245FEC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -7435,6 +7439,18 @@ Global
{22EA0993-8DFC-40C2-8481-8E85E21EFB56}.Release|x64.Build.0 = Release|x64
{22EA0993-8DFC-40C2-8481-8E85E21EFB56}.Release|x86.ActiveCfg = Release|x86
{22EA0993-8DFC-40C2-8481-8E85E21EFB56}.Release|x86.Build.0 = Release|x86
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Debug|x64.Build.0 = Debug|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Debug|x86.Build.0 = Debug|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Release|x64.ActiveCfg = Release|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Release|x64.Build.0 = Release|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Release|x86.ActiveCfg = Release|Any CPU
+ {B739074E-6652-4F5B-B37E-775DC2245FEC}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -8209,6 +8225,8 @@ Global
{9B8F871E-ED33-4D2F-AA49-E39D9299EC85} = {41BB7BA4-AC08-4E9A-83EA-6D587A5B951C}
{7F295396-DBBD-40A5-A645-10004D1324DA} = {41BB7BA4-AC08-4E9A-83EA-6D587A5B951C}
{22EA0993-8DFC-40C2-8481-8E85E21EFB56} = {41BB7BA4-AC08-4E9A-83EA-6D587A5B951C}
+ {8F33439F-5532-45D6-8A44-20EF9104AA9D} = {5F0044F2-4C66-46A8-BD79-075F001AA034}
+ {B739074E-6652-4F5B-B37E-775DC2245FEC} = {8F33439F-5532-45D6-8A44-20EF9104AA9D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E8720B3-DBDD-498C-B383-2CC32A054E8F}
diff --git a/eng/Dependencies.props b/eng/Dependencies.props
index bd6f4c69b9f4..bf6613405102 100644
--- a/eng/Dependencies.props
+++ b/eng/Dependencies.props
@@ -175,6 +175,7 @@ and are generated based on the last package release.
+
diff --git a/eng/Versions.props b/eng/Versions.props
index 93f47d9fc75e..17e5eac3dfd5 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -273,6 +273,7 @@
1.0.2
12.0.2
13.0.4
+ 0.180.0
3.0.0
7.1.0
4.0.0-alpha07
diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/AssemblyInfo.AssemblyFixtures.cs b/src/ProjectTemplates/BlazorTemplates.Tests/AssemblyInfo.AssemblyFixtures.cs
index b60a694a12d7..3eb30b095263 100644
--- a/src/ProjectTemplates/BlazorTemplates.Tests/AssemblyInfo.AssemblyFixtures.cs
+++ b/src/ProjectTemplates/BlazorTemplates.Tests/AssemblyInfo.AssemblyFixtures.cs
@@ -1,10 +1,11 @@
// 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 Microsoft.AspNetCore.E2ETesting;
using Microsoft.AspNetCore.Testing;
+using ProjectTemplates.Tests.Infrastructure;
+using Templates.Test;
using Templates.Test.Helpers;
[assembly: AssemblyFixture(typeof(ProjectFactoryFixture))]
-[assembly: AssemblyFixture(typeof(SeleniumStandaloneServer))]
+[assembly: AssemblyFixture(typeof(PlaywrightFixture))]
diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs
index fac1a67ccda9..de27f48c4cb6 100644
--- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs
+++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs
@@ -2,37 +2,44 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Net;
-using System.Threading;
+using System.Runtime.InteropServices;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.E2ETesting;
-using Microsoft.AspNetCore.Testing;
-using OpenQA.Selenium;
+using Microsoft.AspNetCore.BrowserTesting;
+using PlaywrightSharp;
+using ProjectTemplates.Tests.Infrastructure;
using Templates.Test.Helpers;
using Xunit;
using Xunit.Abstractions;
namespace Templates.Test
{
- public class BlazorServerTemplateTest : BrowserTestBase
+ public class BlazorServerTemplateTest : BlazorTemplateTest
{
- public BlazorServerTemplateTest(ProjectFactoryFixture projectFactory, BrowserFixture browserFixture, ITestOutputHelper output) : base(browserFixture, output)
+ public BlazorServerTemplateTest(ProjectFactoryFixture projectFactory, PlaywrightFixture fixture, ITestOutputHelper output)
+ : base(fixture)
{
- ProjectFactory = projectFactory;
+ ProjectFactory = projectFactory; ;
+ Output = output;
+ BrowserContextInfo = new ContextInformation(CreateFactory(output));
}
public ProjectFactoryFixture ProjectFactory { get; set; }
-
+ public ITestOutputHelper Output { get; }
+ public ContextInformation BrowserContextInfo { get; }
public Project Project { get; private set; }
- [Fact]
- public async Task BlazorServerTemplateWorks_NoAuth()
+
+ [Theory]
+ [InlineData(BrowserKind.Chromium)]
+ public async Task BlazorServerTemplateWorks_NoAuth(BrowserKind browserKind)
{
// Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278
Environment.SetEnvironmentVariable("EnableDefaultScopedCssItems", "true");
- Project = await ProjectFactory.GetOrCreateProject("blazorservernoauth", Output);
+ Project = await ProjectFactory.GetOrCreateProject("blazorservernoauth" + browserKind.ToString(), Output);
var createResult = await Project.RunDotNetNewAsync("blazorserver");
Assert.True(0 == createResult.ExitCode, ErrorMessages.GetFailedProcessMessage("create/restore", Project, createResult));
@@ -47,6 +54,10 @@ public async Task BlazorServerTemplateWorks_NoAuth()
var buildResult = await Project.RunDotNetBuildAsync();
Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult));
+ await using var browser = Fixture.BrowserManager.IsAvailable(browserKind) ?
+ await Fixture.BrowserManager.GetBrowserInstance(browserKind, BrowserContextInfo) :
+ null;
+
using (var aspNetProcess = Project.StartBuiltProjectAsync())
{
Assert.False(
@@ -54,14 +65,17 @@ public async Task BlazorServerTemplateWorks_NoAuth()
ErrorMessages.GetFailedProcessMessageOrEmpty("Run built project", Project, aspNetProcess.Process));
await aspNetProcess.AssertStatusCode("/", HttpStatusCode.OK, "text/html");
- if (BrowserFixture.IsHostAutomationSupported())
+
+ if (Fixture.BrowserManager.IsAvailable(browserKind))
{
- aspNetProcess.VisitInBrowser(Browser);
- TestBasicNavigation();
+ var page = await browser.NewPageAsync();
+ await aspNetProcess.VisitInBrowserAsync(page);
+ await TestBasicNavigation(page);
+ await page.CloseAsync();
}
else
{
- BrowserFixture.EnforceSupportedConfigurations();
+ EnsureBrowserAvailable(browserKind);
}
}
@@ -72,27 +86,31 @@ public async Task BlazorServerTemplateWorks_NoAuth()
ErrorMessages.GetFailedProcessMessageOrEmpty("Run published project", Project, aspNetProcess.Process));
await aspNetProcess.AssertStatusCode("/", HttpStatusCode.OK, "text/html");
- if (BrowserFixture.IsHostAutomationSupported())
+ if (Fixture.BrowserManager.IsAvailable(browserKind))
{
- aspNetProcess.VisitInBrowser(Browser);
- TestBasicNavigation();
+ var page = await browser.NewPageAsync();
+ await aspNetProcess.VisitInBrowserAsync(page);
+ await TestBasicNavigation(page);
+ await page.CloseAsync();
}
else
{
- BrowserFixture.EnforceSupportedConfigurations();
+ EnsureBrowserAvailable(browserKind);
}
}
}
+ public static IEnumerable