Skip to content

E2E test fixes #35414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c49d8a1
Remove duplicate markup
SteveSandersonMS Aug 16, 2021
7ea7ba6
Workaround for "unexpected string" issue (seems like a Selenium/WebDr…
SteveSandersonMS Aug 16, 2021
76b37b3
Fix some parsing logic
SteveSandersonMS Aug 16, 2021
1b361a9
Workaround for string interpolation bug
SteveSandersonMS Aug 17, 2021
fe0a955
Another interpolation workaround
SteveSandersonMS Aug 17, 2021
10b6ad5
Base href is required for loading initializer modules
SteveSandersonMS Aug 17, 2021
ccfea83
Make namespaces consistent
SteveSandersonMS Aug 17, 2021
162c7c4
Fix NavigateOnSubmitWorks test
SteveSandersonMS Aug 17, 2021
8157768
Fix ClosingTheBrowserWindow_GracefullyDisconnects_TheCurrentCircuit
SteveSandersonMS Aug 17, 2021
5087fd7
Skip all the ignitor tests (they are quarantined anyway, and we'll be…
SteveSandersonMS Aug 17, 2021
9803b5c
Unskip some working tests
SteveSandersonMS Aug 17, 2021
5188c44
Experiment with running E2E tests with less parallelism
SteveSandersonMS Aug 17, 2021
614bb42
Remove a SWA hint that seems wrong
SteveSandersonMS Aug 17, 2021
1bd4469
Fix intermittent issue with subpixel positioning
SteveSandersonMS Aug 17, 2021
4ec3892
Stop using "noreload" optimization to see if it helps with consistency
SteveSandersonMS Aug 18, 2021
6fe8069
Also run the quarantined tests on CI. They all pass locally.
SteveSandersonMS Aug 18, 2021
6832e6d
Skip problematic test
SteveSandersonMS Aug 18, 2021
1236515
Update src/Components/test/E2ETest/ServerExecutionTests/CircuitGracef…
SteveSandersonMS Aug 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .azure/pipelines/components-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ stages:
cancelTimeoutInMinutes: 30
buildArgs: -all -test /p:SkipHelixReadyTests=true /p:SkipIISNewHandlerTests=true /p:SkipIISTests=true
/p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false
/p:RunQuarantinedTests=true
beforeBuild:
- powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1"
displayName: Setup IISExpress test certificates and schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ public static void Navigate(this IWebDriver browser, Uri baseUri, string relativ
{
var absoluteUrl = new Uri(baseUri, relativeUrl);

if (noReload)
{
var existingUrl = browser.Url;
if (string.Equals(existingUrl, absoluteUrl.AbsoluteUri, StringComparison.Ordinal))
{
return;
}
}

browser.Navigate().GoToUrl("about:blank");
browser.Navigate().GoToUrl(absoluteUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public CircuitGracefulTerminationTests(
ITestOutputHelper output)
: base(browserFixture, serverFixture, output)
{
// The browser won't send the disconnection message if it's headless
browserFixture.EnsureNotHeadless = true;
}

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

[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/23015")]
[Fact]
public async Task ClosingTheBrowserWindow_GracefullyDisconnects_TheCurrentCircuit()
{
// Arrange & Act
Browser.Close();
await Task.WhenAny(Task.Delay(10000), GracefulDisconnectCompletionSource.Task);

// Assert
Assert.True(GracefulDisconnectCompletionSource.Task.IsCompletedSuccessfully);
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitTerminatedGracefully"), Messages);
Assert.Contains((Extensions.Logging.LogLevel.Debug, "CircuitDisconnectedPermanently"), Messages);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override async Task InitializeAsync()
Assert.Equal(2, Batches.Count);
}

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

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

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task DispatchingAnInvalidRenderAcknowledgement_DoesNotTriggerWarnings()
{
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.AspNetCore.Components.E2ETests.ServerExecutionTests
namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests
{
public class HeadModificationPrerenderingTest : ServerTestBase<BasicTestAppServerSiteFixture<DeferredComponentContentStartup>>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected override async Task InitializeAsync()
Assert.Equal(2, Batches.Count);
}

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

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

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

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

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

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task CannotInvokeJSInvokableMethodsWithWrongReferenceId()
{
// Arrange
Expand Down Expand Up @@ -182,7 +182,7 @@ await Client.InvokeDotNetMethod(
await ValidateClientKeepsWorking(Client, Batches);
}

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task CannotInvokeJSInvokableMethodsWrongReferenceIdType()
{
// Arrange
Expand Down Expand Up @@ -213,7 +213,7 @@ await Client.InvokeDotNetMethod(
await ValidateClientKeepsWorking(Client, Batches);
}

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task ContinuesWorkingAfterInvalidAsyncReturnCallback()
{
// Arrange
Expand Down Expand Up @@ -242,7 +242,7 @@ await Client.HubConnection.InvokeAsync(
await ValidateClientKeepsWorking(Client, Batches);
}

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

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task JSInteropThrowsInUserCode()
{
// Arrange
Expand Down Expand Up @@ -304,7 +304,7 @@ await Client.HubConnection.InvokeAsync(
await ValidateClientKeepsWorking(Client, Batches);
}

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task MalformedJSInteropCallbackDisposesCircuit()
{
// Arrange
Expand Down Expand Up @@ -339,7 +339,7 @@ await Client.ExpectCircuitErrorAndDisconnect(async () =>
});
}

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

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

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

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

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task DispatchingEventsWithInvalidEventArgs()
{
// Arrange
Expand Down Expand Up @@ -461,7 +461,7 @@ await Client.ExpectCircuitErrorAndDisconnect(async () =>
});
}

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task DispatchingEventsWithInvalidEventHandlerId()
{
// Arrange
Expand Down Expand Up @@ -495,7 +495,7 @@ await Client.ExpectCircuitErrorAndDisconnect(async () =>
});
}

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task EventHandlerThrowsSyncExceptionTerminatesTheCircuit()
{
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void CanAccessAuthenticationStateDuringStaticPrerendering(string initialU
Browser.Equal($"Hello, {interactiveUsername ?? "anonymous"}!", () => Browser.Exists(By.TagName("h1")).Text);
}

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/35449")]
public async Task NoHotReloadListenersAreOrdinarilyRegistered()
{
Navigate("/prerendered/prerendered-transition");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public RemoteRendererBufferLimitTest(BasicTestAppServerSiteFixture<ServerStartup
{
}

[Fact]
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/19666")]
public async Task DispatchedEventsWillKeepBeingProcessed_ButUpdatedWillBeDelayedUntilARenderIsAcknowledged()
{
// Arrange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public void DotNetExceptionDetailsAreNotLoggedByDefault()
}

string GetExpectedMessage(string method) =>
$"\"There was an exception invoking '{method}' on assembly 'BasicTestApp'. For more details turn on " +
$"detailed exceptions in '{typeof(CircuitOptions).Name}.{nameof(CircuitOptions.DetailedErrors)}'\"";
"\"There was an exception invoking '" + method + "' on assembly 'BasicTestApp'. For more details turn on " +
"detailed exceptions in '" + typeof(CircuitOptions).Name + "." + nameof(CircuitOptions.DetailedErrors) + "'\"";
}
}
}
6 changes: 3 additions & 3 deletions src/Components/test/E2ETest/Tests/BindTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2022,9 +2022,9 @@ private void ApplyInputValue(string cssSelector, string value)
// interaction as authentically as SendKeys in other cases.
var javascript = (IJavaScriptExecutor)Browser;
javascript.ExecuteScript(
$"var elem = document.querySelector('{cssSelector}');"
+ $"elem.value = '{value}';"
+ "elem.dispatchEvent(new KeyboardEvent('change'));");
$"document.querySelector('{cssSelector}').value = '{value}'");
javascript.ExecuteScript(
$"document.querySelector('{cssSelector}').dispatchEvent(new KeyboardEvent('change'));");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public void CanUseViewImportsHierarchically()
elem => Assert.Equal(typeof(AssemblyHashAlgorithm).FullName, elem.Text));
}

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

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

[Theory]
Expand Down Expand Up @@ -725,7 +725,7 @@ public void CanPatchRenderTreeToMatchLatestDOMState()
});
}

[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/34857")]
[Fact]
public void CanHandleClearedChild()
{
var appElement = Browser.MountTestComponent<ContentEditable>();
Expand Down
6 changes: 3 additions & 3 deletions src/Components/test/E2ETest/Tests/EventBubblingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ private void TriggerCustomBubblingEvent(string elementId, string eventName)
{
var jsExecutor = (IJavaScriptExecutor)Browser;
jsExecutor.ExecuteScript(
$"document.getElementById('{elementId}').dispatchEvent(" +
$" new Event('{eventName}', {{ bubbles: true }})" +
$")");
$"window.testelem = document.getElementById('{elementId}')");
jsExecutor.ExecuteScript(
$"window.testelem.dispatchEvent(new Event('{eventName}', {{ bubbles: true }}))");
}
}
}
13 changes: 6 additions & 7 deletions src/Components/test/E2ETest/Tests/FormsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,16 +739,15 @@ public void RespectsCustomFieldCssClassProvider()
Browser.Equal("modified invalid-socks", () => socksInput.GetAttribute("class"));
}

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

input.SendKeys("Enter");
input.SendKeys(Keys.Enter);

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

[Fact]
Expand Down Expand Up @@ -809,9 +808,9 @@ private void ApplyInvalidInputDateValue(string cssSelector, string invalidValue)
// interaction as authentically as SendKeys in other cases.
var javascript = (IJavaScriptExecutor)Browser;
javascript.ExecuteScript(
$"var elem = document.querySelector('{cssSelector}');"
+ $"elem.value = {JsonSerializer.Serialize(invalidValue, TestJsonSerializerOptionsProvider.Options)};"
+ "elem.dispatchEvent(new KeyboardEvent('change'));");
$"document.querySelector('{cssSelector}').value = {JsonSerializer.Serialize(invalidValue, TestJsonSerializerOptionsProvider.Options)}");
javascript.ExecuteScript(
$"document.querySelector('{cssSelector}').dispatchEvent(new KeyboardEvent('change'))");
}

private void EnsureAttributeRendering(IWebElement element, string attributeName, bool shouldBeRendered = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.AspNetCore.Components.E2ETests.Tests
namespace Microsoft.AspNetCore.Components.E2ETest.Tests
{
public class HeadModificationTest : ServerTestBase<ToggleExecutionModeServerFixture<Program>>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ public void AuthenticatedUser_ProfileIncludesDetails_And_AccessToken()
},
payload.Scopes.OrderBy(id => id));

var currentTime = DateTimeOffset.Parse(Browser.Exists(By.Id("current-time")).Text, CultureInfo.InvariantCulture);
var tokenExpiration = DateTimeOffset.Parse(Browser.Exists(By.Id("access-token-expires")).Text, CultureInfo.InvariantCulture);
// The browser formats the text using the current language, so the following parsing relies on
// the server being set to an equivalent culture. This should be true in our test scenarios.
var currentTime = DateTimeOffset.Parse(Browser.Exists(By.Id("current-time")).Text, CultureInfo.CurrentCulture);
var tokenExpiration = DateTimeOffset.Parse(Browser.Exists(By.Id("access-token-expires")).Text, CultureInfo.CurrentCulture);
Assert.True(currentTime.AddMinutes(50) < tokenExpiration);
Assert.True(currentTime.AddMinutes(60) >= tokenExpiration);
}
Expand Down
7 changes: 3 additions & 4 deletions src/Components/test/E2ETest/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
// This is set to -1 to allow the usage of an
// unlimited ammount of threads.
"maxParallelThreads": -1,
"diagnosticMessages": true,
"longRunningTestSeconds": 30
"longRunningTestSeconds": 30,
"parallelizeAssembly": false,
"parallelizeTestCollections": false
}
Loading