[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:
parent
60a8f2348e
commit
635da5b73a
|
|
@ -56,6 +56,10 @@ namespace Templates.Test
|
||||||
aspNetProcess.VisitInBrowser(Browser);
|
aspNetProcess.VisitInBrowser(Browser);
|
||||||
TestBasicNavigation();
|
TestBasicNavigation();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BrowserFixture.EnforceSupportedConfigurations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var aspNetProcess = Project.StartPublishedProjectAsync())
|
using (var aspNetProcess = Project.StartPublishedProjectAsync())
|
||||||
|
|
@ -70,6 +74,10 @@ namespace Templates.Test
|
||||||
aspNetProcess.VisitInBrowser(Browser);
|
aspNetProcess.VisitInBrowser(Browser);
|
||||||
TestBasicNavigation();
|
TestBasicNavigation();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BrowserFixture.EnforceSupportedConfigurations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,8 +114,13 @@ namespace Templates.Test
|
||||||
aspNetProcess.VisitInBrowser(Browser);
|
aspNetProcess.VisitInBrowser(Browser);
|
||||||
TestBasicNavigation();
|
TestBasicNavigation();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BrowserFixture.EnforceSupportedConfigurations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
using (var aspNetProcess = Project.StartPublishedProjectAsync())
|
using (var aspNetProcess = Project.StartPublishedProjectAsync())
|
||||||
{
|
{
|
||||||
Assert.False(
|
Assert.False(
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,10 @@ namespace Templates.Test.SpaTemplateTest
|
||||||
aspNetProcess.VisitInBrowser(browser);
|
aspNetProcess.VisitInBrowser(browser);
|
||||||
TestBasicNavigation(visitFetchData: shouldVisitFetchData, usesAuth, browser, logs);
|
TestBasicNavigation(visitFetchData: shouldVisitFetchData, usesAuth, browser, logs);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BrowserFixture.EnforceSupportedConfigurations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usesAuth)
|
if (usesAuth)
|
||||||
|
|
@ -135,6 +139,10 @@ namespace Templates.Test.SpaTemplateTest
|
||||||
aspNetProcess.VisitInBrowser(browser);
|
aspNetProcess.VisitInBrowser(browser);
|
||||||
TestBasicNavigation(visitFetchData: shouldVisitFetchData, usesAuth, browser, logs);
|
TestBasicNavigation(visitFetchData: shouldVisitFetchData, usesAuth, browser, logs);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BrowserFixture.EnforceSupportedConfigurations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Collections.Concurrent;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Chrome;
|
using OpenQA.Selenium.Chrome;
|
||||||
|
|
@ -28,6 +29,14 @@ namespace Microsoft.AspNetCore.E2ETesting
|
||||||
|
|
||||||
public IMessageSink DiagnosticsMessageSink { get; }
|
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()
|
public static bool IsHostAutomationSupported()
|
||||||
{
|
{
|
||||||
// We emit an assemblymetadata attribute that reflects the value of SeleniumE2ETestsSupported at build
|
// We emit an assemblymetadata attribute that reflects the value of SeleniumE2ETestsSupported at build
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue