Skip to content

Commit 5b4f300

Browse files
Fix E2E test use of logs (#27114) (#27166)
* Restore support for logs in E2E tests. Fixes #25803 * Revert earlier workaround * Update message in assertion * Remove redundant script references
1 parent efa72d9 commit 5b4f300

File tree

16 files changed

+24
-111
lines changed

16 files changed

+24
-111
lines changed

src/Components/WebAssembly/testassets/HostedInAspNet.Client/wwwroot/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
</head>
77
<body>
88
<app>Loading...</app>
9-
<script src="seleniumworkaround.js"></script>
109
<script src="customJsFileForTests.js"></script>
1110
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
1211

src/Components/WebAssembly/testassets/HostedInAspNet.Client/wwwroot/seleniumworkaround.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Components/WebAssembly/testassets/Wasm.Authentication.Client/wwwroot/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<a class="dismiss">🗙</a>
1919
</div>
2020

21-
<script src="seleniumworkaround.js"></script>
2221
<script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>
2322
<script src="_framework/blazor.webassembly.js"></script>
2423
</body>

src/Components/WebAssembly/testassets/Wasm.Authentication.Client/wwwroot/seleniumworkaround.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public override async Task InitializeAsync()
4343
}
4444
}
4545

46-
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
46+
[Fact]
4747
public void DoesNotStartMultipleConnections()
4848
{
4949
Navigate("/multiple-components");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void RendersContinueAfterReconnect()
7878
Browser.False(() => Browser.Exists(selector).Text == currentValue);
7979
}
8080

81-
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
81+
[Fact]
8282
public void ErrorsStopTheRenderingProcess()
8383
{
8484
Browser.Exists(By.Id("cause-error")).Click();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public void LoggedInUser_OnTheIdP_CanLogInSilently()
306306
ValidateLoggedIn(userName);
307307
}
308308

309-
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
309+
[Fact]
310310
public void CanNotRedirect_To_External_ReturnUrl()
311311
{
312312
Browser.Navigate().GoToUrl(new Uri(new Uri(Browser.Url), "/authentication/login?returnUrl=https%3A%2F%2Fwww.bing.com").AbsoluteUri);

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.Globalization;
6+
using System.Linq;
57
using GlobalizationWasmApp;
68
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure;
79
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
@@ -107,11 +109,10 @@ public void LoadingApp_DynamicallySetLanguageThrows()
107109
var errorUi = Browser.Exists(By.Id("blazor-error-ui"));
108110
Browser.Equal("block", () => errorUi.GetCssValue("display"));
109111

110-
// Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803"
111-
// var expected = "This application's globalization settings requires using the combined globalization data file.";
112-
// var logs = Browser.GetBrowserLogs(LogLevel.Severe).Select(l => l.Message);
113-
// Assert.True(logs.Any(l => l.Contains(expected)),
114-
// $"Expected to see globalization error message in the browser logs: {string.Join(Environment.NewLine, logs)}.");
112+
var expected = "Blazor detected a change in the application's culture that is not supported with the current project configuration.";
113+
var logs = Browser.GetBrowserLogs(LogLevel.Severe).Select(l => l.Message);
114+
Assert.True(logs.Any(l => l.Contains(expected)),
115+
$"Expected to see globalization error message in the browser logs: {string.Join(Environment.NewLine, logs)}.");
115116
}
116117

117118
private void Initialize(CultureInfo culture)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void CanLazyLoadAssemblyWithRoutes()
108108
Assert.True(renderedElement.Displayed);
109109
}
110110

111-
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
111+
[Fact]
112112
public void ThrowsErrorForUnavailableAssemblies()
113113
{
114114
// Navigate to a page with lazy loaded assemblies for the first time

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected override void InitializeAsyncCore()
3232
Assert.Equal("none", errorUi.GetCssValue("display"));
3333
}
3434

35-
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
35+
[Fact]
3636
public void LogsSimpleExceptionsUsingLogger()
3737
{
3838
Browser.Exists(By.Id("throw-simple-exception")).Click();
@@ -44,7 +44,7 @@ public void LogsSimpleExceptionsUsingLogger()
4444
"at BasicTestApp.ErrorComponent.ThrowSimple");
4545
}
4646

47-
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
47+
[Fact]
4848
public void LogsInnerExceptionsUsingLogger()
4949
{
5050
Browser.Exists(By.Id("throw-inner-exception")).Click();
@@ -57,7 +57,7 @@ public void LogsInnerExceptionsUsingLogger()
5757
"at BasicTestApp.ErrorComponent.ThrowInner");
5858
}
5959

60-
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
60+
[Fact]
6161
public void LogsAggregateExceptionsUsingLogger()
6262
{
6363
Browser.Exists(By.Id("throw-aggregate-exception")).Click();
@@ -72,7 +72,7 @@ public void LogsAggregateExceptionsUsingLogger()
7272
"System.InvalidTimeZoneException: Aggregate exception 3");
7373
}
7474

75-
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
75+
[Fact]
7676
public void LogsUsingCustomLogger()
7777
{
7878
Browser.MountTestComponent<LoggingComponent>();

0 commit comments

Comments
 (0)