Use Selenium to test Chrome
This commit is contained in:
parent
c80588ec51
commit
e69285a36d
|
|
@ -114,8 +114,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kestrel.Transport.Sockets.B
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kestrel.Transport.Libuv.BindTests", "test\Kestrel.Transport.Libuv.BindTests\Kestrel.Transport.Libuv.BindTests.csproj", "{FB9C6B61-0A7B-4FFA-B772-A754316B262E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kestrel.Transport.Libuv.BindTests", "test\Kestrel.Transport.Libuv.BindTests\Kestrel.Transport.Libuv.BindTests.csproj", "{FB9C6B61-0A7B-4FFA-B772-A754316B262E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kestrel.H2Spec.FunctionalTests", "test\Kestrel.H2Spec.FunctionalTests\Kestrel.H2Spec.FunctionalTests.csproj", "{C4123E55-5760-4557-B89B-39E1258FD7F9}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{B19F67B8-7635-42C3-B5BF-00D1CC47FA64}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{B19F67B8-7635-42C3-B5BF-00D1CC47FA64}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.gitattributes = .gitattributes
|
.gitattributes = .gitattributes
|
||||||
|
|
@ -138,6 +136,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
|
||||||
version.props = version.props
|
version.props = version.props
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kestrel.Interop.FunctionalTests", "test\Kestrel.Interop.FunctionalTests\Kestrel.Interop.FunctionalTests.csproj", "{DF5394AB-679B-4F2F-8E9C-5327AD053E91}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -424,18 +424,18 @@ Global
|
||||||
{FB9C6B61-0A7B-4FFA-B772-A754316B262E}.Release|x64.Build.0 = Release|Any CPU
|
{FB9C6B61-0A7B-4FFA-B772-A754316B262E}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{FB9C6B61-0A7B-4FFA-B772-A754316B262E}.Release|x86.ActiveCfg = Release|Any CPU
|
{FB9C6B61-0A7B-4FFA-B772-A754316B262E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{FB9C6B61-0A7B-4FFA-B772-A754316B262E}.Release|x86.Build.0 = Release|Any CPU
|
{FB9C6B61-0A7B-4FFA-B772-A754316B262E}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Debug|x64.Build.0 = Debug|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Debug|x86.Build.0 = Debug|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Release|Any CPU.Build.0 = Release|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Release|x64.ActiveCfg = Release|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Release|x64.Build.0 = Release|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Release|x86.ActiveCfg = Release|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9}.Release|x86.Build.0 = Release|Any CPU
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -466,7 +466,7 @@ Global
|
||||||
{B5422347-E919-431D-9EF2-C352FFE4D6C1} = {D3273454-EA07-41D2-BF0B-FCC3675C2483}
|
{B5422347-E919-431D-9EF2-C352FFE4D6C1} = {D3273454-EA07-41D2-BF0B-FCC3675C2483}
|
||||||
{9254C3EB-196B-402F-A059-34FEA6140500} = {D3273454-EA07-41D2-BF0B-FCC3675C2483}
|
{9254C3EB-196B-402F-A059-34FEA6140500} = {D3273454-EA07-41D2-BF0B-FCC3675C2483}
|
||||||
{FB9C6B61-0A7B-4FFA-B772-A754316B262E} = {D3273454-EA07-41D2-BF0B-FCC3675C2483}
|
{FB9C6B61-0A7B-4FFA-B772-A754316B262E} = {D3273454-EA07-41D2-BF0B-FCC3675C2483}
|
||||||
{C4123E55-5760-4557-B89B-39E1258FD7F9} = {D3273454-EA07-41D2-BF0B-FCC3675C2483}
|
{DF5394AB-679B-4F2F-8E9C-5327AD053E91} = {D3273454-EA07-41D2-BF0B-FCC3675C2483}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {2D10D020-6770-47CA-BB8D-2C23FE3AE071}
|
SolutionGuid = {2D10D020-6770-47CA-BB8D-2C23FE3AE071}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@
|
||||||
<MoqPackageVersion>4.10.0</MoqPackageVersion>
|
<MoqPackageVersion>4.10.0</MoqPackageVersion>
|
||||||
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
||||||
<NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion>
|
<NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion>
|
||||||
|
<SeleniumWebDriverChromeDriverPackageVersion>2.43.0</SeleniumWebDriverChromeDriverPackageVersion>
|
||||||
|
<SeleniumWebDriverPackageVersion>3.12.1</SeleniumWebDriverPackageVersion>
|
||||||
<SystemBuffersPackageVersion>4.5.0</SystemBuffersPackageVersion>
|
<SystemBuffersPackageVersion>4.5.0</SystemBuffersPackageVersion>
|
||||||
<SystemIOPipelinesPackageVersion>4.5.2</SystemIOPipelinesPackageVersion>
|
<SystemIOPipelinesPackageVersion>4.5.2</SystemIOPipelinesPackageVersion>
|
||||||
<SystemMemoryPackageVersion>4.5.1</SystemMemoryPackageVersion>
|
<SystemMemoryPackageVersion>4.5.1</SystemMemoryPackageVersion>
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,19 @@
|
||||||
#if NETCOREAPP2_2
|
#if NETCOREAPP2_2
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.FunctionalTests;
|
|
||||||
using Microsoft.AspNetCore.Testing;
|
using Microsoft.AspNetCore.Testing;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging.Testing;
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
|
using OpenQA.Selenium.Chrome;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Interop.FunctionalTests
|
namespace Interop.FunctionalTests
|
||||||
|
|
@ -40,7 +41,7 @@ namespace Interop.FunctionalTests
|
||||||
private string NetLogPath { get; set; }
|
private string NetLogPath { get; set; }
|
||||||
private string StartupLogPath { get; set; }
|
private string StartupLogPath { get; set; }
|
||||||
private string ShutdownLogPath { get; set; }
|
private string ShutdownLogPath { get; set; }
|
||||||
private string ChromeArgs { get; set; }
|
private string[] ChromeArgs { get; set; }
|
||||||
|
|
||||||
private void InitializeArgs()
|
private void InitializeArgs()
|
||||||
{
|
{
|
||||||
|
|
@ -48,17 +49,20 @@ namespace Interop.FunctionalTests
|
||||||
StartupLogPath = Path.Combine(ResolvedLogOutputDirectory, $"{ResolvedTestMethodName}.su.json");
|
StartupLogPath = Path.Combine(ResolvedLogOutputDirectory, $"{ResolvedTestMethodName}.su.json");
|
||||||
ShutdownLogPath = Path.Combine(ResolvedLogOutputDirectory, $"{ResolvedTestMethodName}.sd.json");
|
ShutdownLogPath = Path.Combine(ResolvedLogOutputDirectory, $"{ResolvedTestMethodName}.sd.json");
|
||||||
|
|
||||||
ChromeArgs = $"--headless " +
|
ChromeArgs = new [] {
|
||||||
$"--no-sandbox " +
|
$"--headless",
|
||||||
$"--disable-gpu " +
|
$"--no-sandbox",
|
||||||
$"--allow-insecure-localhost " +
|
$"--disable-gpu",
|
||||||
$"--ignore-certificate-errors --enable-features=NetworkService " +
|
$"--allow-insecure-localhost",
|
||||||
$"--enable-logging " +
|
$"--ignore-certificate-errors",
|
||||||
$"--dump-dom " +
|
$"--enable-features=NetworkService",
|
||||||
$"--virtual-time-budget=10000 " +
|
$"--enable-logging",
|
||||||
$"--log-net-log={NetLogPath} " +
|
$"--log-net-log={NetLogPath}",
|
||||||
$"--trace-startup --trace-startup-file={StartupLogPath} " +
|
$"--trace-startup",
|
||||||
$"--trace-shutdown --trace-shutdown-file={ShutdownLogPath}";
|
$"--trace-startup-file={StartupLogPath}",
|
||||||
|
$"--trace-shutdown",
|
||||||
|
$"--trace-shutdown-file={ShutdownLogPath}"
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalTheory]
|
||||||
|
|
@ -70,54 +74,48 @@ namespace Interop.FunctionalTests
|
||||||
{
|
{
|
||||||
InitializeArgs();
|
InitializeArgs();
|
||||||
|
|
||||||
using (var server = new TestServer(async context =>
|
var hostBuilder = new WebHostBuilder()
|
||||||
{
|
.UseKestrel(options =>
|
||||||
if (string.Equals(context.Request.Query["TestMethod"], "POST", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
{
|
||||||
await context.Response.WriteAsync(_postHtml);
|
options.Listen(IPAddress.Loopback, 0, listenOptions =>
|
||||||
}
|
{
|
||||||
else
|
listenOptions.Protocols = HttpProtocols.Http2;
|
||||||
|
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.ConfigureServices(AddTestLogging)
|
||||||
|
.Configure(app => app.Run(async context =>
|
||||||
{
|
{
|
||||||
await context.Response.WriteAsync($"Interop {context.Request.Protocol} {context.Request.Method}");
|
if (string.Equals(context.Request.Query["TestMethod"], "POST", StringComparison.OrdinalIgnoreCase))
|
||||||
}
|
{
|
||||||
},
|
await context.Response.WriteAsync(_postHtml);
|
||||||
new TestServiceContext(LoggerFactory),
|
}
|
||||||
options => options.Listen(IPAddress.Loopback, 0, listenOptions =>
|
else
|
||||||
|
{
|
||||||
|
await context.Response.WriteAsync($"Interop {context.Request.Protocol} {context.Request.Method}");
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
using (var host = hostBuilder.Build())
|
||||||
{
|
{
|
||||||
listenOptions.Protocols = HttpProtocols.Http2;
|
await host.StartAsync();
|
||||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
var chromeOutput = RunHeadlessChrome($"https://localhost:{host.GetPort()}/{requestSuffix}");
|
||||||
})))
|
|
||||||
{
|
|
||||||
var chromeOutput = await RunHeadlessChrome($"https://localhost:{server.Port}/{requestSuffix}");
|
|
||||||
|
|
||||||
AssertExpectedResponseOrShowDebugInstructions(expectedResponse, chromeOutput);
|
AssertExpectedResponseOrShowDebugInstructions(expectedResponse, chromeOutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<string> RunHeadlessChrome(string testUrl)
|
private string RunHeadlessChrome(string testUrl)
|
||||||
{
|
{
|
||||||
var chromeArgs = $"{ChromeArgs} {testUrl}";
|
var chromeOptions = new ChromeOptions();
|
||||||
var chromeStartInfo = new ProcessStartInfo
|
chromeOptions.AddArguments(ChromeArgs);
|
||||||
|
|
||||||
|
using (var driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), chromeOptions))
|
||||||
{
|
{
|
||||||
FileName = ChromeConstants.ExecutablePath,
|
driver.Navigate().GoToUrl(testUrl);
|
||||||
Arguments = chromeArgs,
|
|
||||||
UseShellExecute = false,
|
|
||||||
CreateNoWindow = true,
|
|
||||||
RedirectStandardError = true,
|
|
||||||
RedirectStandardOutput = true
|
|
||||||
};
|
|
||||||
|
|
||||||
Logger.LogInformation($"Staring chrome: {ChromeConstants.ExecutablePath} {chromeArgs}");
|
return driver.PageSource;
|
||||||
|
}
|
||||||
var headlessChromeProcess = Process.Start(chromeStartInfo);
|
|
||||||
var chromeOutput = await headlessChromeProcess.StandardOutput.ReadToEndAsync();
|
|
||||||
var chromeError = await headlessChromeProcess.StandardError.ReadToEndAsync();
|
|
||||||
Logger.LogInformation($"Standard output: {chromeOutput}");
|
|
||||||
Logger.LogInformation($"Standard error: {chromeError}");
|
|
||||||
|
|
||||||
headlessChromeProcess.WaitForExit();
|
|
||||||
|
|
||||||
return chromeOutput;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AssertExpectedResponseOrShowDebugInstructions(string expectedResponse, string actualResponse)
|
private void AssertExpectedResponseOrShowDebugInstructions(string expectedResponse, string actualResponse)
|
||||||
|
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace H2Spec.FunctionalTests
|
namespace Interop.FunctionalTests
|
||||||
{
|
{
|
||||||
public static class H2SpecCommands
|
public static class H2SpecCommands
|
||||||
{
|
{
|
||||||
|
|
@ -8,7 +8,6 @@ using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
using Microsoft.AspNetCore.Testing;
|
using Microsoft.AspNetCore.Testing;
|
||||||
|
|
@ -17,7 +16,7 @@ using Microsoft.Extensions.Logging.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace H2Spec.FunctionalTests
|
namespace Interop.FunctionalTests
|
||||||
{
|
{
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")]
|
[OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")]
|
||||||
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81,
|
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81,
|
||||||
|
|
@ -47,7 +46,7 @@ namespace H2Spec.FunctionalTests
|
||||||
{
|
{
|
||||||
await host.StartAsync();
|
await host.StartAsync();
|
||||||
|
|
||||||
H2SpecCommands.RunTest(testCase.Id, GetPort(host), testCase.Https, Logger);
|
H2SpecCommands.RunTest(testCase.Id, host.GetPort(), testCase.Https, Logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,13 +129,5 @@ namespace H2Spec.FunctionalTests
|
||||||
await context.Response.WriteAsync("Hello World");
|
await context.Response.WriteAsync("Hello World");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int GetPort(IWebHost host)
|
|
||||||
{
|
|
||||||
return host.ServerFeatures.Get<IServerAddressesFeature>().Addresses
|
|
||||||
.Select(a => new Uri(a))
|
|
||||||
.First()
|
|
||||||
.Port;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AssemblyName>H2Spec.FunctionalTests</AssemblyName>
|
<AssemblyName>Interop.FunctionalTests</AssemblyName>
|
||||||
<RootNamespace>H2Spec.FunctionalTests</RootNamespace>
|
<RootNamespace>Interop.FunctionalTests</RootNamespace>
|
||||||
<!-- h2spec doesn't run on the desktop framework where ALPN isn't available. -->
|
<!-- h2spec doesn't run on the desktop framework where ALPN isn't available. -->
|
||||||
<!-- DeveloperBuildTestTfms is StandardTestTfms minus desktop. -->
|
<!-- DeveloperBuildTestTfms is StandardTestTfms minus desktop. -->
|
||||||
<TargetFrameworks>$(DeveloperBuildTestTfms)</TargetFrameworks>
|
<TargetFrameworks>$(DeveloperBuildTestTfms)</TargetFrameworks>
|
||||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||||
<TestGroupName>H2Spec.FunctionalTests</TestGroupName>
|
<TestGroupName>Interop.FunctionalTests</TestGroupName>
|
||||||
|
<WarningsNotAsErrors>CS8002;$(WarningsNotAsErrors)</WarningsNotAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="..\shared\TransportTestHelpers\IWebHostPortExtensions.cs" LinkBase="shared" />
|
||||||
<Compile Include="..\shared\TestResources.cs" LinkBase="shared" />
|
<Compile Include="..\shared\TestResources.cs" LinkBase="shared" />
|
||||||
<Content Include="..\shared\TestCertificates\*.pfx" LinkBase="shared\TestCertificates" CopyToOutputDirectory="PreserveNewest" />
|
<Content Include="..\shared\TestCertificates\*.pfx" LinkBase="shared\TestCertificates" CopyToOutputDirectory="PreserveNewest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
@ -24,6 +26,8 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Internal.AspNetCore.H2Spec.All" Version="$(MicrosoftInternalAspNetCoreH2SpecAllPackageVersion)" />
|
<PackageReference Include="Microsoft.Internal.AspNetCore.H2Spec.All" Version="$(MicrosoftInternalAspNetCoreH2SpecAllPackageVersion)" />
|
||||||
|
<PackageReference Include="Selenium.WebDriver" Version ="$(SeleniumWebDriverPackageVersion)" />
|
||||||
|
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version ="$(SeleniumWebDriverChromeDriverPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -4,12 +4,16 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
|
||||||
namespace Interop.FunctionalTests
|
namespace Interop.FunctionalTests
|
||||||
{
|
{
|
||||||
public static class ChromeConstants
|
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
|
||||||
|
public class SkipIfChromeUnavailableAttribute : Attribute, ITestCondition
|
||||||
{
|
{
|
||||||
public static string ExecutablePath { get; } = ResolveChromeExecutablePath();
|
public bool IsMet => string.IsNullOrEmpty(Environment.GetEnvironmentVariable("JENKINS_HOME")) && (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI")) || File.Exists(ResolveChromeExecutablePath()));
|
||||||
|
|
||||||
|
public string SkipReason => "This is running on Jenkins or Chrome/Chromium is not installed and this is a dev environment.";
|
||||||
|
|
||||||
private static string ResolveChromeExecutablePath()
|
private static string ResolveChromeExecutablePath()
|
||||||
{
|
{
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
// 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 Microsoft.AspNetCore.Testing.xunit;
|
|
||||||
|
|
||||||
namespace Interop.FunctionalTests
|
|
||||||
{
|
|
||||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
|
|
||||||
public class SkipIfChromeUnavailableAttribute : Attribute, ITestCondition
|
|
||||||
{
|
|
||||||
public bool IsMet => string.IsNullOrEmpty(Environment.GetEnvironmentVariable("JENKINS_HOME")) && (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI")) || File.Exists(ChromeConstants.ExecutablePath));
|
|
||||||
|
|
||||||
public string SkipReason => "This is running on Jenkins or Chrome/Chromium is not installed and this is a dev environment.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="$(MicrosoftAspNetCoreHttpAbstractionsPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="$(MicrosoftAspNetCoreHttpAbstractionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Internal.AspNetCore.H2Spec.All" Version="$(MicrosoftInternalAspNetCoreH2SpecAllPackageVersion)" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
|
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
|
||||||
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="$(SystemNetHttpWinHttpHandlerPackageVersion)" />
|
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="$(SystemNetHttpWinHttpHandlerPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue