Skip to content
代码片段 群组 项目
未验证 提交 6d83fee5 编辑于 作者: Pranav K's avatar Pranav K 提交者: GitHub
浏览文件

Only download chrome driver for selenium (#18676)

* Only download chrome driver
上级 b49dd986
No related branches found
No related tags found
无相关合并请求
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
"private": true, "private": true,
"scripts": { "scripts": {
"selenium-standalone": "selenium-standalone", "selenium-standalone": "selenium-standalone",
"prepare": "selenium-standalone install" "prepare": "selenium-standalone install --config ../../../Shared/E2ETesting/selenium-config.json"
}, },
"author": "", "author": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"selenium-standalone": "^6.15.4" "selenium-standalone": "^6.17.0"
} }
} }
...@@ -432,10 +432,10 @@ safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: ...@@ -432,10 +432,10 @@ safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
selenium-standalone@^6.15.4: selenium-standalone@^6.17.0:
version "6.16.0" version "6.17.0"
resolved "https://registry.yarnpkg.com/selenium-standalone/-/selenium-standalone-6.16.0.tgz#ffcf02665c58ff7a7472427ae819ba79c15967ac" resolved "https://registry.yarnpkg.com/selenium-standalone/-/selenium-standalone-6.17.0.tgz#0f24b691836205ee9bc3d7a6f207ebcb28170cd9"
integrity sha512-tl7HFH2FOxJD1is7Pzzsl0pY4vuePSdSWiJdPn+6ETBkpeJDiuzou8hBjvWYWpD+eIVcOrmy3L0R3GzkdHLzDw== integrity sha512-5PSnDHwMiq+OCiAGlhwQ8BM9xuwFfvBOZ7Tfbw+ifkTnOy0PWbZmI1B9gPGuyGHpbQ/3J3CzIK7BYwrQ7EjtWQ==
dependencies: dependencies:
async "^2.6.2" async "^2.6.2"
commander "^2.19.0" commander "^2.19.0"
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
"private": true, "private": true,
"scripts": { "scripts": {
"selenium-standalone": "selenium-standalone", "selenium-standalone": "selenium-standalone",
"prepare": "selenium-standalone install" "prepare": "selenium-standalone install --config ../../Shared/E2ETesting/selenium-config.json"
}, },
"author": "", "author": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"selenium-standalone": "^6.15.4" "selenium-standalone": "^6.17.0"
} }
} }
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
<SeleniumProcessTrackingFolder Condition="'$(SeleniumProcessTrackingFolder)' == ''">$([MSBuild]::EnsureTrailingSlash('$(RepoRoot)'))artifacts\tmp\selenium\</SeleniumProcessTrackingFolder> <SeleniumProcessTrackingFolder Condition="'$(SeleniumProcessTrackingFolder)' == ''">$([MSBuild]::EnsureTrailingSlash('$(RepoRoot)'))artifacts\tmp\selenium\</SeleniumProcessTrackingFolder>
<SeleniumE2ETestsSupported Condition="'$(SeleniumE2ETestsSupported)' == '' and '$(TargetArchitecture)' != 'arm' and '$(OS)' == 'Windows_NT'">true</SeleniumE2ETestsSupported> <SeleniumE2ETestsSupported Condition="'$(SeleniumE2ETestsSupported)' == '' and '$(TargetArchitecture)' != 'arm' and '$(OS)' == 'Windows_NT'">true</SeleniumE2ETestsSupported>
<!-- Config that limits driver to chrome-->
<SeleniumConfigPath>$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory)selenium-config.json))</SeleniumConfigPath>
<!-- We want to enforce prerequisites when we build from the CI or within Visual Studio --> <!-- We want to enforce prerequisites when we build from the CI or within Visual Studio -->
<EnforcedE2EBuildEnvironment Condition="'$(ContinuousIntegrationBuild)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true'">true</EnforcedE2EBuildEnvironment> <EnforcedE2EBuildEnvironment Condition="'$(ContinuousIntegrationBuild)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true'">true</EnforcedE2EBuildEnvironment>
...@@ -39,12 +42,12 @@ ...@@ -39,12 +42,12 @@
<ItemGroup> <ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute"> <AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>Microsoft.AspNetCore.E2ETesting.CI</_Parameter1> <_Parameter1>Microsoft.AspNetCore.E2ETesting.CI</_Parameter1>
<_Parameter2>$(ContinuousIntegrationBuild)</_Parameter2> <_Parameter2>$(ContinuousIntegrationBuild)</_Parameter2>
</AssemblyAttribute> </AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute"> <AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>Microsoft.AspNetCore.E2ETesting.ScreenshotsPath</_Parameter1> <_Parameter1>Microsoft.AspNetCore.E2ETesting.ScreenshotsPath</_Parameter1>
<_Parameter2>$(SeleniumScreenShotsFolderPath)</_Parameter2> <_Parameter2>$(SeleniumScreenShotsFolderPath)</_Parameter2>
</AssemblyAttribute> </AssemblyAttribute>
</ItemGroup> </ItemGroup>
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<PropertyGroup> <PropertyGroup>
<_PackageJsonLinesContent>@(_PackageJsonLines)</_PackageJsonLinesContent> <_PackageJsonLinesContent>@(_PackageJsonLines)</_PackageJsonLinesContent>
<_PackageJsonSeleniumPackage>&quot;selenium-standalone&quot;: &quot;^6.15.4&quot;</_PackageJsonSeleniumPackage> <_PackageJsonSeleniumPackage>&quot;selenium-standalone&quot;: &quot;^6.17.0&quot;</_PackageJsonSeleniumPackage>
</PropertyGroup> </PropertyGroup>
<Error <Error
...@@ -109,6 +109,12 @@ ...@@ -109,6 +109,12 @@
<_Parameter1>Microsoft.AspNetCore.Testing.Selenium.Supported</_Parameter1> <_Parameter1>Microsoft.AspNetCore.Testing.Selenium.Supported</_Parameter1>
<_Parameter2>$(_SeleniumE2ETestsSupportedAttributeValue)</_Parameter2> <_Parameter2>$(_SeleniumE2ETestsSupportedAttributeValue)</_Parameter2>
</AssemblyAttribute> </AssemblyAttribute>
<AssemblyAttribute
Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>Microsoft.AspNetCore.Testing.SeleniumConfigPath</_Parameter1>
<_Parameter2>$(SeleniumConfigPath)</_Parameter2>
</AssemblyAttribute>
</ItemGroup> </ItemGroup>
</Target> </Target>
......
...@@ -86,10 +86,20 @@ namespace Microsoft.AspNetCore.E2ETesting ...@@ -86,10 +86,20 @@ namespace Microsoft.AspNetCore.E2ETesting
var port = FindAvailablePort(); var port = FindAvailablePort();
var uri = new UriBuilder("http", "localhost", port, "/wd/hub").Uri; var uri = new UriBuilder("http", "localhost", port, "/wd/hub").Uri;
var seleniumConfigPath = typeof(SeleniumStandaloneServer).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
.FirstOrDefault(k => k.Key == "Microsoft.AspNetCore.Testing.SeleniumConfigPath")
?.Value;
if (seleniumConfigPath == null)
{
throw new InvalidOperationException("Selenium config path not configured. Does this project import the E2ETesting.targets?");
}
var psi = new ProcessStartInfo var psi = new ProcessStartInfo
{ {
FileName = "npm", FileName = "npm",
Arguments = $"run selenium-standalone start -- -- -port {port}", Arguments = $"run selenium-standalone start -- --config \"{seleniumConfigPath}\" -- -port {port}",
RedirectStandardOutput = true, RedirectStandardOutput = true,
RedirectStandardError = true, RedirectStandardError = true,
}; };
......
{
"drivers": {
"chrome": {}
},
"ignoreExtraDrivers": true
}
\ No newline at end of file
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册