Skip to content

Commit

Permalink
Fix selenium-standalone invocation (#41592)
Browse files Browse the repository at this point in the history
* Fix selenium-standalone invocation

* Revert "[Blazor] Updates selenium dependencies (#41557)"

This reverts commit 21257b0.
  • Loading branch information
captainsafia authored May 9, 2022
1 parent 19964bf commit 10a1346
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 115 deletions.
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@
<MicrosoftPlaywrightVersion>1.17.3</MicrosoftPlaywrightVersion>
<PollyExtensionsHttpVersion>3.0.0</PollyExtensionsHttpVersion>
<PollyVersion>7.2.3</PollyVersion>
<SeleniumSupportVersion>4.1.1</SeleniumSupportVersion>
<SeleniumWebDriverChromeDriverVersion>100.0.4896.6000</SeleniumWebDriverChromeDriverVersion>
<SeleniumWebDriverVersion>4.1.1</SeleniumWebDriverVersion>
<SeleniumSupportVersion>4.1.0</SeleniumSupportVersion>
<SeleniumWebDriverChromeDriverVersion>98.0.4758.10200</SeleniumWebDriverChromeDriverVersion>
<SeleniumWebDriverVersion>4.1.0</SeleniumWebDriverVersion>
<SerilogExtensionsLoggingVersion>1.4.0</SerilogExtensionsLoggingVersion>
<SerilogSinksFileVersion>4.0.0</SerilogSinksFileVersion>
<StackExchangeRedisVersion>2.2.4</StackExchangeRedisVersion>
Expand Down
4 changes: 1 addition & 3 deletions src/Components/ComponentsNoDeps.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@
"src\\Components\\benchmarkapps\\Wasm.Performance\\TestApp\\Wasm.Performance.TestApp.csproj",
"src\\Components\\test\\E2ETest\\Microsoft.AspNetCore.Components.E2ETests.csproj",
"src\\Components\\test\\testassets\\BasicTestApp\\BasicTestApp.csproj",
"src\\Components\\test\\testassets\\ComponentsApp.App\\ComponentsApp.App.csproj",
"src\\Components\\test\\testassets\\ComponentsApp.Server\\ComponentsApp.Server.csproj",
"src\\Components\\test\\testassets\\GlobalizationWasmApp\\GlobalizationWasmApp.csproj",
"src\\Components\\test\\testassets\\LazyTestContentPackage\\LazyTestContentPackage.csproj",
"src\\Components\\test\\testassets\\TestContentPackage\\TestContentPackage.csproj",
"src\\Components\\test\\testassets\\TestServer\\Components.TestServer.csproj"
]
}
}
}
2 changes: 1 addition & 1 deletion src/Components/test/E2ETest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "MIT",
"dependencies": {
"sauce-connect-launcher": "^1.3.1",
"selenium-standalone": "^8.1.2"
"selenium-standalone": "^7.1.0"
},
"devDependencies": {
"@types/node": "^13.1.7",
Expand Down
192 changes: 96 additions & 96 deletions src/Components/test/E2ETest/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Shared/E2ETesting/E2ETesting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<PropertyGroup>
<_PackageJsonLinesContent>@(_PackageJsonLines)</_PackageJsonLinesContent>
<_PackageJsonSeleniumPackage>&quot;selenium-standalone&quot;: &quot;^8.1.2&quot;</_PackageJsonSeleniumPackage>
<_PackageJsonSeleniumPackage>&quot;selenium-standalone&quot;: &quot;^7.1.0&quot;</_PackageJsonSeleniumPackage>
</PropertyGroup>

<Error
Expand Down
12 changes: 3 additions & 9 deletions src/Shared/E2ETesting/SeleniumStandaloneServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static async Task<SeleniumStandaloneServer> GetInstanceAsync(ITestOutputH
private static async Task InitializeInstance(ITestOutputHelper output)
{
var port = FindAvailablePort();
var uri = new UriBuilder("http", "localhost", port).Uri;
var uri = new UriBuilder("http", "localhost", port, "/wd/hub").Uri;

var seleniumConfigPath = typeof(SeleniumStandaloneServer).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
Expand All @@ -111,7 +111,7 @@ private static async Task InitializeInstance(ITestOutputHelper output)
var psi = new ProcessStartInfo
{
FileName = "npm",
Arguments = $"run selenium-standalone start -- --config \"{seleniumConfigPath}\" {chromeDriverArg} -- --host localhost --port {port}",
Arguments = $"run selenium-standalone start -- --config \"{seleniumConfigPath}\" {chromeDriverArg} -- -port {port}",
RedirectStandardOutput = true,
RedirectStandardError = true,
};
Expand Down Expand Up @@ -178,13 +178,7 @@ private static async Task InitializeInstance(ITestOutputHelper output)
// Log
void LogOutput(object sender, DataReceivedEventArgs e)
{
try
{
logOutput.TryAdd(e.Data);
}
catch (Exception)
{
}
logOutput.TryAdd(e.Data);

// We avoid logging on the output here because it is unreliable. We can only log in the diagnostics sink.
lock (_diagnosticsMessageSink)
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/E2ETesting/WaitAssert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult>
// tests running concurrently might use the DefaultTimeout in their current assertion, which is fine.
TestRunFailed = true;

var innerHtml = driver.FindElement(By.CssSelector(":first-child"))?.GetAttribute("innerHTML");
var innerHtml = driver.FindElement(By.CssSelector(":first-child")).GetAttribute("innerHTML");

var fileId = $"{Guid.NewGuid():N}.png";
var screenShotPath = Path.Combine(Path.GetFullPath(E2ETestOptions.Instance.ScreenShotsPath), fileId);
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/E2ETesting/selenium-config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"drivers": {
"chrome": {
"version" : "100.0.4896.60"
"version" : "99.0.4844.35"
}
},
"ignoreExtraDrivers": true
Expand Down

0 comments on commit 10a1346

Please sign in to comment.