Skip to content

Commit d14e273

Browse files
John Luopranavkm
andauthored
[5.0.0-rc2] Backport Fix chrome/selenium tests (#25330) (#25840)
* Fix chrome/selenium tests (#25330) * Revert "Disable failing/hanging tests due to Chrome/Selenium issue (#25323)" This reverts commit 332f150. * Update Selenium to latest * Update API * Try specifying a version * Update Selenium to 4.0.0-beta5 * Disable browser log tests * Fix components e2e tests and disable blazor standalone template test * Disable tests using browser log * Disable template test * Avoid using .NET formatted strings in tests * Annotate BasicTestApp suggesting that it needs the all globalization data * Culture specific formatting relies on the ICU data carried by the OS. This causes issues in our tests if WebAssembly carries a different set than the OS. Instead updating these tests to use hardcoded strings. * Additionally fixing an issue where some projects in the solution were using tasks from the .dotnet SDK rather than the local copy of the SDK. This was causing issues building locally. Co-authored-by: Pranav K <[email protected]>
1 parent 45dade2 commit d14e273

16 files changed

+74
-51
lines changed

eng/Versions.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,10 @@
237237
<NewtonsoftJsonBsonPackageVersion>1.0.2</NewtonsoftJsonBsonPackageVersion>
238238
<NewtonsoftJsonPackageVersion>12.0.2</NewtonsoftJsonPackageVersion>
239239
<NSwagApiDescriptionClientPackageVersion>13.0.4</NSwagApiDescriptionClientPackageVersion>
240-
<SeleniumSupportPackageVersion>3.12.1</SeleniumSupportPackageVersion>
240+
<SeleniumSupportPackageVersion>4.0.0-alpha05</SeleniumSupportPackageVersion>
241241
<SeleniumWebDriverMicrosoftDriverPackageVersion>17.17134.0</SeleniumWebDriverMicrosoftDriverPackageVersion>
242-
<SeleniumWebDriverChromeDriverPackageVersion>2.43.0</SeleniumWebDriverChromeDriverPackageVersion>
243-
<SeleniumWebDriverPackageVersion>3.12.1</SeleniumWebDriverPackageVersion>
242+
<SeleniumWebDriverChromeDriverPackageVersion>85.0.4183.8300</SeleniumWebDriverChromeDriverPackageVersion>
243+
<SeleniumWebDriverPackageVersion>4.0.0-alpha05</SeleniumWebDriverPackageVersion>
244244
<SerilogExtensionsLoggingPackageVersion>1.4.0</SerilogExtensionsLoggingPackageVersion>
245245
<SerilogSinksFilePackageVersion>4.0.0</SerilogSinksFilePackageVersion>
246246
<StackExchangeRedisPackageVersion>2.0.593</StackExchangeRedisPackageVersion>

eng/targets/CSharp.Common.props

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
<PackageReference Include="MicroBuild.Core" Version="0.3.0" PrivateAssets="All" AllowExplicitReference="true" ExcludeAssets="All" />
1313
</ItemGroup>
1414

15-
<ItemGroup Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(UsingMicrosoftNETSdkBlazorWebAssembly)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
15+
<PropertyGroup>
16+
<_ReferenceLocalRazorSDK
17+
Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(UsingMicrosoftNETSdkBlazorWebAssembly)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != '' OR '$(_RazorSdkImportsMicrosoftNetSdk)' == 'true'">true</_ReferenceLocalRazorSDK>
18+
</PropertyGroup>
19+
20+
<ItemGroup Condition="'$(_ReferenceLocalRazorSDK)' == 'true'">
1621
<!--
1722
Use the Razor SDK as a project reference. The version of the .NET Core SDK we build with often contains a version of the Razor SDK
1823
several versions older than latest. We reference the project to ensure it's built before the other projects that use it. Since this
@@ -25,7 +30,7 @@
2530
UndefineProperties="TargetFramework;TargetFrameworks" />
2631
</ItemGroup>
2732

28-
<ImportGroup Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' OR '$(UsingMicrosoftNETSdkBlazorWebAssembly)' == 'true' OR '$(RazorSdkCurrentVersionProps)' != ''">
33+
<ImportGroup Condition="'$(_ReferenceLocalRazorSDK)' == 'true'">
2934
<Import Project="$(RepoRoot)eng\targets\GetRazorSDKDirectory.props" />
3035
<Import Project="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" />
3136
</ImportGroup>

src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
<SkipTests Condition="'$(SeleniumE2ETestsSupported)' != 'true'">true</SkipTests>
1515
<SkipTests Condition="'$(SeleniumE2ETestsSupported)' == 'true'">false</SkipTests>
1616

17-
<!-- Tests are disabled due to https://github.com/dotnet/aspnetcore/issues/25322 -->
18-
<SkipTests>true</SkipTests>
19-
2017
<!-- Tests do not work on Helix or when bin/ directory is not in project directory due to undeclared dependency on test content. -->
2118
<BaseOutputPath />
2219

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]
46+
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
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.FindElement(selector).Text == currentValue);
7979
}
8080

81-
[Fact]
81+
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
8282
public void ErrorsStopTheRenderingProcess()
8383
{
8484
Browser.FindElement(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]
309+
[Fact(Skip = "Browser logs cannot be retrieved: https://github.com/dotnet/aspnetcore/issues/25803")]
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: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
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;
54
using System.Globalization;
6-
using System.Linq;
75
using GlobalizationWasmApp;
86
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure;
97
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
@@ -18,7 +16,6 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests
1816
// This app covers testing this along with verifying the behavior for fallback culture for localized resources.
1917
public class WebAssemblyICUShardingTest : ServerTestBase<ToggleExecutionModeServerFixture<Program>>
2018
{
21-
private readonly DateTime DisplayTime = new DateTime(2020, 09, 02);
2219
public WebAssemblyICUShardingTest(
2320
BrowserFixture browserFixture,
2421
ToggleExecutionModeServerFixture<Program> serverFixture,
@@ -39,7 +36,7 @@ public void LoadingApp_FrenchLanguage_Works()
3936
Assert.Equal(culture.ToString(), cultureDisplay.Text);
4037

4138
var dateDisplay = Browser.Exists(By.Id("dateTime"));
42-
Assert.Equal(DisplayTime.ToString(culture), dateDisplay.Text);
39+
Assert.Equal("02/09/2020 00:00:00", dateDisplay.Text);
4340

4441
var localizedDisplay = Browser.Exists(By.Id("localizedString"));
4542
Assert.Equal("Bonjour!", localizedDisplay.Text);
@@ -57,7 +54,7 @@ public void LoadingApp_KoreanLanguage_Works()
5754
Assert.Equal(culture.ToString(), cultureDisplay.Text);
5855

5956
var dateDisplay = Browser.Exists(By.Id("dateTime"));
60-
Assert.Equal(DisplayTime.ToString(culture), dateDisplay.Text);
57+
Assert.Equal("2020. 9. 2. 오전 12:00:00", dateDisplay.Text);
6158

6259
var localizedDisplay = Browser.Exists(By.Id("localizedString"));
6360
// The app has a "ko" resx file. This test verifies that we can walk up the culture hierarchy correctly.
@@ -76,7 +73,7 @@ public void LoadingApp_RussianLanguage_Works()
7673
Assert.Equal(culture.ToString(), cultureDisplay.Text);
7774

7875
var dateDisplay = Browser.Exists(By.Id("dateTime"));
79-
Assert.Equal(DisplayTime.ToString(culture), dateDisplay.Text);
76+
Assert.Equal("02.09.2020 00:00:00", dateDisplay.Text);
8077

8178
var localizedDisplay = Browser.Exists(By.Id("localizedString"));
8279
Assert.Equal("Hello", localizedDisplay.Text); // No localized resources for this culture.
@@ -94,7 +91,7 @@ public void LoadingApp_KannadaLanguage_Works()
9491
Assert.Equal(culture.ToString(), cultureDisplay.Text);
9592

9693
var dateDisplay = Browser.Exists(By.Id("dateTime"));
97-
Assert.Equal(DisplayTime.ToString(culture), dateDisplay.Text);
94+
Assert.Equal("2/9/2020 12:00:00 ಪೂರ್ವಾಹ್ನ", dateDisplay.Text);
9895

9996
var localizedDisplay = Browser.Exists(By.Id("localizedString"));
10097
Assert.Equal("ಹಲೋ", localizedDisplay.Text);
@@ -105,15 +102,16 @@ public void LoadingApp_DynamicallySetLanguageThrows()
105102
{
106103
// Arrange
107104
// This verifies that we complain if the app programtically configures a language.
108-
var expected = "This application's globalization settings requires using the combined globalization data file.";
109105
Navigate($"{ServerPathBase}/?culture=fr&dotNetCulture=es", noReload: false);
110106

111107
var errorUi = Browser.Exists(By.Id("blazor-error-ui"));
112108
Browser.Equal("block", () => errorUi.GetCssValue("display"));
113109

114-
var logs = Browser.GetBrowserLogs(LogLevel.Severe).Select(l => l.Message);
115-
Assert.True(logs.Any(l => l.Contains(expected)),
116-
$"Expected to see globalization error message in the browser logs: {string.Join(Environment.NewLine, logs)}.");
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)}.");
117115
}
118116

119117
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
@@ -111,7 +111,7 @@ public void CanLazyLoadAssemblyWithRoutes()
111111
Assert.True(renderedElement.Displayed);
112112
}
113113

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using BasicTestApp;
5-
using Microsoft.AspNetCore.Components.E2ETest;
65
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure;
76
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
87
using Microsoft.AspNetCore.E2ETesting;

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

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

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

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

0 commit comments

Comments
 (0)