Skip to content

Commit 2becbdd

Browse files
[release/6.0-rc1] E2E test fixes (#35460)
1 parent 5137828 commit 2becbdd

21 files changed

+69
-70
lines changed

.azure/pipelines/components-e2e-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ stages:
4242
cancelTimeoutInMinutes: 30
4343
buildArgs: -all -test /p:SkipHelixReadyTests=true /p:SkipIISNewHandlerTests=true /p:SkipIISTests=true
4444
/p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false
45+
/p:RunQuarantinedTests=true
4546
beforeBuild:
4647
- powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1"
4748
displayName: Setup IISExpress test certificates and schema

src/Components/test/E2ETest/Infrastructure/WebDriverExtensions/WebDriverExtensions.cs

-9
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ public static void Navigate(this IWebDriver browser, Uri baseUri, string relativ
1515
{
1616
var absoluteUrl = new Uri(baseUri, relativeUrl);
1717

18-
if (noReload)
19-
{
20-
var existingUrl = browser.Url;
21-
if (string.Equals(existingUrl, absoluteUrl.AbsoluteUri, StringComparison.Ordinal))
22-
{
23-
return;
24-
}
25-
}
26-
2718
browser.Navigate().GoToUrl("about:blank");
2819
browser.Navigate().GoToUrl(absoluteUrl);
2920
}

src/Components/test/E2ETest/ServerExecutionTests/CircuitGracefulTerminationTests.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public CircuitGracefulTerminationTests(
2626
ITestOutputHelper output)
2727
: base(browserFixture, serverFixture, output)
2828
{
29+
// The browser won't send the disconnection message if it's headless
30+
browserFixture.EnsureNotHeadless = true;
2931
}
3032

3133
public TaskCompletionSource<object> GracefulDisconnectCompletionSource { get; private set; }
@@ -65,14 +67,15 @@ public async Task ReloadingThePage_GracefullyDisconnects_TheCurrentCircuit()
6567
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages);
6668
}
6769

68-
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/23015")]
70+
[Fact]
6971
public async Task ClosingTheBrowserWindow_GracefullyDisconnects_TheCurrentCircuit()
7072
{
7173
// Arrange & Act
7274
Browser.Close();
7375
await Task.WhenAny(Task.Delay(10000), GracefulDisconnectCompletionSource.Task);
7476

7577
// Assert
78+
Assert.True(GracefulDisconnectCompletionSource.Task.IsCompletedSuccessfully);
7679
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully"), Messages);
7780
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages);
7881
}

src/Components/test/E2ETest/ServerExecutionTests/ComponentHubInvalidEventTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected override async Task InitializeAsync()
3333
Assert.Equal(2, Batches.Count);
3434
}
3535

36-
[Fact]
36+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
3737
public async Task DispatchingAnInvalidEventArgument_DoesNotProduceWarnings()
3838
{
3939
// Arrange
@@ -59,7 +59,7 @@ await Client.ExpectCircuitError(() => Client.HubConnection.SendAsync(
5959
Assert.Contains(Logs, l => (l.LogLevel, l.Exception?.Message) == (LogLevel.Debug, "There was an error parsing the event arguments. EventId: '3'."));
6060
}
6161

62-
[Fact]
62+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
6363
public async Task DispatchingAnInvalidEvent_DoesNotTriggerWarnings()
6464
{
6565
// Arrange
@@ -98,7 +98,7 @@ await Client.ExpectCircuitError(() => Client.HubConnection.SendAsync(
9898
"There is no event handler associated with this event. EventId: '1990'. (Parameter 'eventHandlerId')"));
9999
}
100100

101-
[Fact]
101+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
102102
public async Task DispatchingAnInvalidRenderAcknowledgement_DoesNotTriggerWarnings()
103103
{
104104
// Arrange

src/Components/test/E2ETest/ServerExecutionTests/HeadModificationPrerenderingTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using Xunit;
1010
using Xunit.Abstractions;
1111

12-
namespace Microsoft.AspNetCore.Components.E2ETests.ServerExecutionTests
12+
namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests
1313
{
1414
public class HeadModificationPrerenderingTest : ServerTestBase<BasicTestAppServerSiteFixture<DeferredComponentContentStartup>>
1515
{

src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs

+18-18
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected override async Task InitializeAsync()
3636
Assert.Equal(2, Batches.Count);
3737
}
3838

39-
[Fact]
39+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
4040
public async Task CannotInvokeNonJSInvokableMethods()
4141
{
4242
// Arrange
@@ -57,7 +57,7 @@ await Client.InvokeDotNetMethod(
5757
await ValidateClientKeepsWorking(Client, Batches);
5858
}
5959

60-
[Fact]
60+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
6161
public async Task CannotInvokeNonExistingMethods()
6262
{
6363
// Arrange
@@ -78,7 +78,7 @@ await Client.InvokeDotNetMethod(
7878
await ValidateClientKeepsWorking(Client, Batches);
7979
}
8080

81-
[Fact]
81+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
8282
public async Task CannotInvokeJSInvokableMethodsWithWrongNumberOfArguments()
8383
{
8484
// Arrange
@@ -99,7 +99,7 @@ await Client.InvokeDotNetMethod(
9999
await ValidateClientKeepsWorking(Client, Batches);
100100
}
101101

102-
[Fact]
102+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
103103
public async Task CannotInvokeJSInvokableMethodsEmptyAssemblyName()
104104
{
105105
// Arrange
@@ -120,7 +120,7 @@ await Client.InvokeDotNetMethod(
120120
await ValidateClientKeepsWorking(Client, Batches);
121121
}
122122

123-
[Fact]
123+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
124124
public async Task CannotInvokeJSInvokableMethodsEmptyMethodName()
125125
{
126126
// Arrange
@@ -142,7 +142,7 @@ await Client.InvokeDotNetMethod(
142142
await ValidateClientKeepsWorking(Client, Batches);
143143
}
144144

145-
[Fact]
145+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
146146
public async Task CannotInvokeJSInvokableMethodsWithWrongReferenceId()
147147
{
148148
// Arrange
@@ -182,7 +182,7 @@ await Client.InvokeDotNetMethod(
182182
await ValidateClientKeepsWorking(Client, Batches);
183183
}
184184

185-
[Fact]
185+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
186186
public async Task CannotInvokeJSInvokableMethodsWrongReferenceIdType()
187187
{
188188
// Arrange
@@ -213,7 +213,7 @@ await Client.InvokeDotNetMethod(
213213
await ValidateClientKeepsWorking(Client, Batches);
214214
}
215215

216-
[Fact]
216+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
217217
public async Task ContinuesWorkingAfterInvalidAsyncReturnCallback()
218218
{
219219
// Arrange
@@ -242,7 +242,7 @@ await Client.HubConnection.InvokeAsync(
242242
await ValidateClientKeepsWorking(Client, Batches);
243243
}
244244

245-
[Fact]
245+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
246246
public async Task JSInteropCompletionSuccess()
247247
{
248248
// Arrange
@@ -271,7 +271,7 @@ await Client.HubConnection.InvokeAsync(
271271
Assert.Equal(LogLevel.Debug, entry.LogLevel);
272272
}
273273

274-
[Fact]
274+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
275275
public async Task JSInteropThrowsInUserCode()
276276
{
277277
// Arrange
@@ -304,7 +304,7 @@ await Client.HubConnection.InvokeAsync(
304304
await ValidateClientKeepsWorking(Client, Batches);
305305
}
306306

307-
[Fact]
307+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
308308
public async Task MalformedJSInteropCallbackDisposesCircuit()
309309
{
310310
// Arrange
@@ -339,7 +339,7 @@ await Client.ExpectCircuitErrorAndDisconnect(async () =>
339339
});
340340
}
341341

342-
[Fact]
342+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
343343
public async Task CannotInvokeJSInvokableMethodsWithInvalidArgumentsPayload()
344344
{
345345
// Arrange
@@ -360,7 +360,7 @@ await Client.InvokeDotNetMethod(
360360
await ValidateClientKeepsWorking(Client, Batches);
361361
}
362362

363-
[Fact]
363+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
364364
public async Task CannotInvokeJSInvokableMethodsWithMalformedArgumentPayload()
365365
{
366366
// Arrange
@@ -381,7 +381,7 @@ await Client.InvokeDotNetMethod(
381381
await ValidateClientKeepsWorking(Client, Batches);
382382
}
383383

384-
[Fact]
384+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
385385
public async Task DispatchingEventsWithInvalidPayloadsShutsDownCircuitGracefully()
386386
{
387387
// Arrange
@@ -405,7 +405,7 @@ await Client.ExpectCircuitErrorAndDisconnect(async () =>
405405
});
406406
}
407407

408-
[Fact]
408+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
409409
public async Task DispatchingEventsWithInvalidEventDescriptor()
410410
{
411411
// Arrange
@@ -429,7 +429,7 @@ await Client.ExpectCircuitErrorAndDisconnect(async () =>
429429
});
430430
}
431431

432-
[Fact]
432+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
433433
public async Task DispatchingEventsWithInvalidEventArgs()
434434
{
435435
// Arrange
@@ -461,7 +461,7 @@ await Client.ExpectCircuitErrorAndDisconnect(async () =>
461461
});
462462
}
463463

464-
[Fact]
464+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
465465
public async Task DispatchingEventsWithInvalidEventHandlerId()
466466
{
467467
// Arrange
@@ -495,7 +495,7 @@ await Client.ExpectCircuitErrorAndDisconnect(async () =>
495495
});
496496
}
497497

498-
[Fact]
498+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
499499
public async Task EventHandlerThrowsSyncExceptionTerminatesTheCircuit()
500500
{
501501
// Arrange

src/Components/test/E2ETest/ServerExecutionTests/PrerenderingTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void CanAccessAuthenticationStateDuringStaticPrerendering(string initialU
135135
Browser.Equal($"Hello, {interactiveUsername ?? "anonymous"}!", () => Browser.Exists(By.TagName("h1")).Text);
136136
}
137137

138-
[Fact]
138+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/35449")]
139139
public async Task NoHotReloadListenersAreOrdinarilyRegistered()
140140
{
141141
Navigate("/prerendered/prerendered-transition");

src/Components/test/E2ETest/ServerExecutionTests/RemoteRendererBufferLimitTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public RemoteRendererBufferLimitTest(BasicTestAppServerSiteFixture<ServerStartup
2222
{
2323
}
2424

25-
[Fact]
25+
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
2626
public async Task DispatchedEventsWillKeepBeingProcessed_ButUpdatedWillBeDelayedUntilARenderIsAcknowledged()
2727
{
2828
// Arrange

src/Components/test/E2ETest/ServerExecutionTests/ServerInteropTestDefaultExceptionsBehavior.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public void DotNetExceptionDetailsAreNotLoggedByDefault()
6363
}
6464

6565
string GetExpectedMessage(string method) =>
66-
$"\"There was an exception invoking '{method}' on assembly 'BasicTestApp'. For more details turn on " +
67-
$"detailed exceptions in '{typeof(CircuitOptions).Name}.{nameof(CircuitOptions.DetailedErrors)}'\"";
66+
"\"There was an exception invoking '" + method + "' on assembly 'BasicTestApp'. For more details turn on " +
67+
"detailed exceptions in '" + typeof(CircuitOptions).Name + "." + nameof(CircuitOptions.DetailedErrors) + "'\"";
6868
}
6969
}
7070
}

src/Components/test/E2ETest/Tests/BindTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2022,9 +2022,9 @@ private void ApplyInputValue(string cssSelector, string value)
20222022
// interaction as authentically as SendKeys in other cases.
20232023
var javascript = (IJavaScriptExecutor)Browser;
20242024
javascript.ExecuteScript(
2025-
$"var elem = document.querySelector('{cssSelector}');"
2026-
+ $"elem.value = '{value}';"
2027-
+ "elem.dispatchEvent(new KeyboardEvent('change'));");
2025+
$"document.querySelector('{cssSelector}').value = '{value}'");
2026+
javascript.ExecuteScript(
2027+
$"document.querySelector('{cssSelector}').dispatchEvent(new KeyboardEvent('change'));");
20282028
}
20292029
}
20302030
}

src/Components/test/E2ETest/Tests/ComponentRenderingTestBase.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public void CanUseViewImportsHierarchically()
320320
elem => Assert.Equal(typeof(AssemblyHashAlgorithm).FullName, elem.Text));
321321
}
322322

323-
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/34679")]
323+
[Fact]
324324
public void CanUseComponentAndStaticContentFromExternalNuGetPackage()
325325
{
326326
var appElement = Browser.MountTestComponent<ExternalContentPackage>();
@@ -463,7 +463,7 @@ public void CanUseFocusExtensionToFocusElementPreventScroll()
463463
string getFocusedElementId() => Browser.SwitchTo().ActiveElement().GetAttribute("id");
464464

465465
// A local helper that gets window.PageYOffset
466-
long getPageYOffset() => (long)((IJavaScriptExecutor)Browser).ExecuteScript("return window.pageYOffset");
466+
long getPageYOffset() => (long)((IJavaScriptExecutor)Browser).ExecuteScript("return Math.round(window.pageYOffset)");
467467
}
468468

469469
[Theory]
@@ -725,7 +725,7 @@ public void CanPatchRenderTreeToMatchLatestDOMState()
725725
});
726726
}
727727

728-
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/34857")]
728+
[Fact]
729729
public void CanHandleClearedChild()
730730
{
731731
var appElement = Browser.MountTestComponent<ContentEditable>();

src/Components/test/E2ETest/Tests/EventBubblingTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ private void TriggerCustomBubblingEvent(string elementId, string eventName)
201201
{
202202
var jsExecutor = (IJavaScriptExecutor)Browser;
203203
jsExecutor.ExecuteScript(
204-
$"document.getElementById('{elementId}').dispatchEvent(" +
205-
$" new Event('{eventName}', {{ bubbles: true }})" +
206-
$")");
204+
$"window.testelem = document.getElementById('{elementId}')");
205+
jsExecutor.ExecuteScript(
206+
$"window.testelem.dispatchEvent(new Event('{eventName}', {{ bubbles: true }}))");
207207
}
208208
}
209209
}

src/Components/test/E2ETest/Tests/FormsTest.cs

+6-7
Original file line numberDiff line numberDiff line change
@@ -739,16 +739,15 @@ public void RespectsCustomFieldCssClassProvider()
739739
Browser.Equal("modified invalid-socks", () => socksInput.GetAttribute("class"));
740740
}
741741

742-
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/34857")]
742+
[Fact]
743743
public void NavigateOnSubmitWorks()
744744
{
745745
var app = Browser.MountTestComponent<NavigateOnSubmit>();
746746
var input = app.FindElement(By.Id("text-input"));
747747

748-
input.SendKeys("Enter");
748+
input.SendKeys(Keys.Enter);
749749

750-
var log = Browser.Manage().Logs.GetLog(LogType.Browser);
751-
Assert.DoesNotContain(log, entry => entry.Level == LogLevel.Severe);
750+
Browser.Equal("Choose...", () => Browser.WaitUntilTestSelectorReady().SelectedOption.Text);
752751
}
753752

754753
[Fact]
@@ -809,9 +808,9 @@ private void ApplyInvalidInputDateValue(string cssSelector, string invalidValue)
809808
// interaction as authentically as SendKeys in other cases.
810809
var javascript = (IJavaScriptExecutor)Browser;
811810
javascript.ExecuteScript(
812-
$"var elem = document.querySelector('{cssSelector}');"
813-
+ $"elem.value = {JsonSerializer.Serialize(invalidValue, TestJsonSerializerOptionsProvider.Options)};"
814-
+ "elem.dispatchEvent(new KeyboardEvent('change'));");
811+
$"document.querySelector('{cssSelector}').value = {JsonSerializer.Serialize(invalidValue, TestJsonSerializerOptionsProvider.Options)}");
812+
javascript.ExecuteScript(
813+
$"document.querySelector('{cssSelector}').dispatchEvent(new KeyboardEvent('change'))");
815814
}
816815

817816
private void EnsureAttributeRendering(IWebElement element, string attributeName, bool shouldBeRendered = true)

src/Components/test/E2ETest/Tests/HeadModificationTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using Xunit;
1111
using Xunit.Abstractions;
1212

13-
namespace Microsoft.AspNetCore.Components.E2ETests.Tests
13+
namespace Microsoft.AspNetCore.Components.E2ETest.Tests
1414
{
1515
public class HeadModificationTest : ServerTestBase<ToggleExecutionModeServerFixture<Program>>
1616
{

src/Components/test/E2ETest/Tests/WebAssemblyAuthenticationTests.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ public void AuthenticatedUser_ProfileIncludesDetails_And_AccessToken()
207207
},
208208
payload.Scopes.OrderBy(id => id));
209209

210-
var currentTime = DateTimeOffset.Parse(Browser.Exists(By.Id("current-time")).Text, CultureInfo.InvariantCulture);
211-
var tokenExpiration = DateTimeOffset.Parse(Browser.Exists(By.Id("access-token-expires")).Text, CultureInfo.InvariantCulture);
210+
// The browser formats the text using the current language, so the following parsing relies on
211+
// the server being set to an equivalent culture. This should be true in our test scenarios.
212+
var currentTime = DateTimeOffset.Parse(Browser.Exists(By.Id("current-time")).Text, CultureInfo.CurrentCulture);
213+
var tokenExpiration = DateTimeOffset.Parse(Browser.Exists(By.Id("access-token-expires")).Text, CultureInfo.CurrentCulture);
212214
Assert.True(currentTime.AddMinutes(50) < tokenExpiration);
213215
Assert.True(currentTime.AddMinutes(60) >= tokenExpiration);
214216
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
// This is set to -1 to allow the usage of an
3-
// unlimited ammount of threads.
4-
"maxParallelThreads": -1,
52
"diagnosticMessages": true,
6-
"longRunningTestSeconds": 30
3+
"longRunningTestSeconds": 30,
4+
"parallelizeAssembly": false,
5+
"parallelizeTestCollections": false
76
}

0 commit comments

Comments
 (0)