Skip to content

Commit b41bbcc

Browse files
committed
Enforce selenium tests run on the expected platforms
1 parent 5c81754 commit b41bbcc

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

src/ProjectTemplates/test/RazorComponentsTemplateTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public async Task RazorComponentsTemplateWorks_NoAuth()
5656
aspNetProcess.VisitInBrowser(Browser);
5757
TestBasicNavigation();
5858
}
59+
else
60+
{
61+
BrowserFixture.EnforceSupportedConfigurations();
62+
}
5963
}
6064

6165
using (var aspNetProcess = Project.StartPublishedProjectAsync())
@@ -70,6 +74,10 @@ public async Task RazorComponentsTemplateWorks_NoAuth()
7074
aspNetProcess.VisitInBrowser(Browser);
7175
TestBasicNavigation();
7276
}
77+
else
78+
{
79+
BrowserFixture.EnforceSupportedConfigurations();
80+
}
7381
}
7482
}
7583

@@ -106,8 +114,13 @@ public async Task RazorComponentsTemplateWorks_IndividualAuth(bool useLocalDB)
106114
aspNetProcess.VisitInBrowser(Browser);
107115
TestBasicNavigation();
108116
}
117+
else
118+
{
119+
BrowserFixture.EnforceSupportedConfigurations();
120+
}
109121
}
110122

123+
111124
using (var aspNetProcess = Project.StartPublishedProjectAsync())
112125
{
113126
Assert.False(

src/ProjectTemplates/test/SpaTemplateTest/SpaTemplateTestBase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ protected async Task SpaTemplateImplAsync(
113113
aspNetProcess.VisitInBrowser(browser);
114114
TestBasicNavigation(visitFetchData: shouldVisitFetchData, usesAuth, browser, logs);
115115
}
116+
else
117+
{
118+
BrowserFixture.EnforceSupportedConfigurations();
119+
}
116120
}
117121

118122
if (usesAuth)
@@ -135,6 +139,10 @@ protected async Task SpaTemplateImplAsync(
135139
aspNetProcess.VisitInBrowser(browser);
136140
TestBasicNavigation(visitFetchData: shouldVisitFetchData, usesAuth, browser, logs);
137141
}
142+
else
143+
{
144+
BrowserFixture.EnforceSupportedConfigurations();
145+
}
138146
}
139147
}
140148

src/Shared/E2ETesting/BrowserFixture.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections.Concurrent;
66
using System.Linq;
77
using System.Reflection;
8+
using System.Runtime.InteropServices;
89
using System.Threading.Tasks;
910
using OpenQA.Selenium;
1011
using OpenQA.Selenium.Chrome;
@@ -27,6 +28,14 @@ public BrowserFixture(IMessageSink diagnosticsMessageSink)
2728

2829
public IMessageSink DiagnosticsMessageSink { get; }
2930

31+
public static void EnforceSupportedConfigurations()
32+
{
33+
// Do not change the current platform support without explicit approval.
34+
Assert.False(
35+
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && RuntimeInformation.ProcessArchitecture == Architecture.X64,
36+
"Selenium tests should be running in this platform.");
37+
}
38+
3039
public static bool IsHostAutomationSupported()
3140
{
3241
// We emit an assemblymetadata attribute that reflects the value of SeleniumE2ETestsSupported at build

0 commit comments

Comments
 (0)