[Templating] Enforce selenium tests runs on the expected platforms (#11602)

* Will cause the CI environment to fail if the E2E tests stop running by accident.
This commit is contained in:
Javier Calvarro Nelson 2019-07-01 14:42:11 +02:00 committed by GitHub
parent 60a8f2348e
commit 635da5b73a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 0 deletions

View File

@ -56,6 +56,10 @@ namespace Templates.Test
aspNetProcess.VisitInBrowser(Browser);
TestBasicNavigation();
}
else
{
BrowserFixture.EnforceSupportedConfigurations();
}
}
using (var aspNetProcess = Project.StartPublishedProjectAsync())
@ -70,6 +74,10 @@ namespace Templates.Test
aspNetProcess.VisitInBrowser(Browser);
TestBasicNavigation();
}
else
{
BrowserFixture.EnforceSupportedConfigurations();
}
}
}
@ -106,8 +114,13 @@ namespace Templates.Test
aspNetProcess.VisitInBrowser(Browser);
TestBasicNavigation();
}
else
{
BrowserFixture.EnforceSupportedConfigurations();
}
}
using (var aspNetProcess = Project.StartPublishedProjectAsync())
{
Assert.False(

View File

@ -113,6 +113,10 @@ namespace Templates.Test.SpaTemplateTest
aspNetProcess.VisitInBrowser(browser);
TestBasicNavigation(visitFetchData: shouldVisitFetchData, usesAuth, browser, logs);
}
else
{
BrowserFixture.EnforceSupportedConfigurations();
}
}
if (usesAuth)
@ -135,6 +139,10 @@ namespace Templates.Test.SpaTemplateTest
aspNetProcess.VisitInBrowser(browser);
TestBasicNavigation(visitFetchData: shouldVisitFetchData, usesAuth, browser, logs);
}
else
{
BrowserFixture.EnforceSupportedConfigurations();
}
}
}

View File

@ -6,6 +6,7 @@ using System.Collections.Concurrent;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
@ -28,6 +29,14 @@ namespace Microsoft.AspNetCore.E2ETesting
public IMessageSink DiagnosticsMessageSink { get; }
public static void EnforceSupportedConfigurations()
{
// Do not change the current platform support without explicit approval.
Assert.False(
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && RuntimeInformation.ProcessArchitecture == Architecture.X64,
"Selenium tests should be running in this platform.");
}
public static bool IsHostAutomationSupported()
{
// We emit an assemblymetadata attribute that reflects the value of SeleniumE2ETestsSupported at build