Skip to content

Commit

Permalink
install chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Apr 8, 2024
1 parent 008ebae commit 32e0016
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 12 deletions.
1 change: 1 addition & 0 deletions eng/testing/tests.browser.targets
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
<RunScriptCommands Include="if [[ &quot;$SCENARIO&quot; == &quot;WasmTestOnNodeJS&quot; || &quot;$SCENARIO&quot; == &quot;wasmtestonnodejs&quot; ]]; then npm ci; fi" />

<SetScriptCommands Condition="'$(InstallChromeForTests)' == 'true' and '$(ChromeDriverBinaryPath)' != ''" Include="export PREPEND_PATH=$([System.IO.Path]::GetDirectoryName($(ChromeDriverBinaryPath)))" />
<SetScriptCommands Condition="'$(InstallFirefoxForTests)' == 'true' and '$(FirefoxBinaryPath)' != '' and '$(GeckoDriverBinaryPath)' != ''" Include="export PREPEND_PATH=$([System.IO.Path]::GetDirectoryName($(FirefoxBinaryPath))):$([System.IO.Path]::GetDirectoryName($(GeckoDriverBinaryPath)))" />
<SetScriptCommands Condition="'$(IsBrowserWasmProject)' == 'true'" Include="export RuntimeIdentifier=browser-wasm" />
</ItemGroup>
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
Expand Down
60 changes: 48 additions & 12 deletions eng/testing/wasm-provisioning.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,31 @@

<!-- disable by default on unsupported platforms -->
<InstallChromeForTests Condition="'$(InstallChromeForTests)' == '' and '$(ChromeOSIdentifier)' == ''">false</InstallChromeForTests>
<InstallFirefoxForTests Condition="'$(InstallChromeForTests)' == '' and '$(ChromeOSIdentifier)' == ''">false</InstallFirefoxForTests>
<InstallV8ForTests Condition="'$(InstallV8ForTests)' == ''">false</InstallV8ForTests>

<FirefoxDir>$(ArtifactsBinDir)firefox\</FirefoxDir>
<FirefoxStampFile>$([MSBuild]::NormalizePath($(FirefoxDir), '.install-firefox-$(FirefoxRevision).stamp'))</FirefoxStampFile>
<_BrowserStampDir>$(ArtifactsBinDir)\</_BrowserStampDir>

<WasmProvisionAfterTarget Condition="'$(WasmProvisionAfterTarget)' == ''">Build</WasmProvisionAfterTarget>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)ChromeVersions.props" />

<PropertyGroup Condition="'$(BrowserHost)' != 'windows'">
<FirefoxRevision>108.0.1</FirefoxRevision>
<FirefoxRevision>124.0.2</FirefoxRevision>
<GeckoDriverRevision>0.34.0</GeckoDriverRevision>
<FirefoxUrl>https://ftp.mozilla.org/pub/firefox/releases/$(FirefoxRevision)/linux-x86_64/en-US/firefox-$(FirefoxRevision).tar.bz2</FirefoxUrl>
<GeckoDriverUrl>https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v$(GeckoDriverRevision)-linux64.tar.gz</GeckoDriverUrl>
<FirefoxBinaryName>firefox</FirefoxBinaryName>
<GeckoDriverBinaryName>geckodriver</GeckoDriverBinaryName>
<FirefoxDir>$(ArtifactsBinDir)firefox\</FirefoxDir>
<GeckoDriverDir>$(ArtifactsBinDir)geckodriver\</GeckoDriverDir>
<FirefoxStampFile>$([MSBuild]::NormalizePath($(FirefoxDir), '.install-firefox-$(FirefoxRevision).stamp'))</FirefoxStampFile>
<GeckoDriverStampFile>$([MSBuild]::NormalizePath($(GeckoDriverDir), '.install-geckodriver-$(GeckoDriverRevision).stamp'))</GeckoDriverStampFile>
<GeckoDriverBinaryPath>$([MSBuild]::NormalizePath($(GeckoDriverDir)))</GeckoDriverBinaryPath>
<FirefoxBinaryPath>$([MSBuild]::NormalizePath($(FirefoxDir)))</FirefoxBinaryPath>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)ChromeVersions.props" />

<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('linux'))">
<ChromeDirName>chrome-linux</ChromeDirName>
<ChromeDriverDirName>chromedriver_linux64</ChromeDriverDirName>
Expand Down Expand Up @@ -84,12 +92,6 @@
<V8BinaryPath>$([MSBuild]::NormalizePath($(V8Dir), $(V8BinaryName)))</V8BinaryPath>
</PropertyGroup>

<PropertyGroup Condition="'$(BrowserHost)' != 'windows'">
<FirefoxRevision>108.0.1</FirefoxRevision>
<FirefoxUrl>https://ftp.mozilla.org/pub/firefox/releases/$(FirefoxRevision)/linux-x86_64/en-US/firefox-$(FirefoxRevision).tar.bz2</FirefoxUrl>
<FirefoxBinaryName>firefox</FirefoxBinaryName>
</PropertyGroup>

<Target Name="DownloadAndInstallChrome"
AfterTargets="$(WasmProvisionAfterTarget)"
Condition="(!Exists($(ChromeStampFile)) or !Exists($(ChromeBinaryPath))) and '$(InstallChromeForTests)' == 'true'">
Expand Down Expand Up @@ -188,10 +190,13 @@ export __SCRIPT_DIR=%24( cd -- "%24( dirname -- "%24{BASH_SOURCE[0]}" )" &amp;>
<Delete Files="@(_StampFile)" />
<RemoveDir Directories="$(FirefoxDir)" />

<Message Text="** Installing firefox version $(FirefoxRevision), to: $(FirefoxDir). To disable this set the msuild property InstallFirefoxForTests=false ."
Importance="High" />

<DownloadFile SourceUrl="$(FirefoxUrl)" DestinationFolder="$(FirefoxDir)" SkipUnchangedFiles="true">
<Output TaskParameter="DownloadedFile" PropertyName="_DownloadedFile" />
</DownloadFile>
<Exec Command="tar -xf $(_DownloadedFile) -C $(FirefoxDir)"/>
<Exec Command="tar -xf $(_DownloadedFile) -C $(FirefoxDir) --strip-components=1"/>
<Exec Command="rm -rf $(_DownloadedFile)"/>

<PropertyGroup>
Expand All @@ -205,4 +210,35 @@ export __SCRIPT_DIR=%24( cd -- "%24( dirname -- "%24{BASH_SOURCE[0]}" )" &amp;>

<Touch Files="$(FirefoxStampFile)" AlwaysCreate="true" />
</Target>

<Target Name="DownloadAndInstallGeckoDriver"
AfterTargets="$(WasmProvisionAfterTarget)"
Condition="!Exists($(GeckoDriverStampFile)) and '$(InstallFirefoxForTests)' == 'true' and !$([MSBuild]::IsOSPlatform('windows'))">
<ItemGroup>
<_StampFile Include="$(_BrowserStampDir).install-geckodriver*.stamp" />
</ItemGroup>

<Delete Files="@(_StampFile)" />
<RemoveDir Directories="$(GeckoDriverDir)" />

<Message Text="** Installing GeckoDriver version $(GeckoDriverRevision), to: $(GeckoDriverDir). To disable this set the msuild property InstallFirefoxForTests=false ."
Importance="High" />

<DownloadFile SourceUrl="$(GeckoDriverUrl)" DestinationFolder="$(GeckoDriverDir)" SkipUnchangedFiles="true">
<Output TaskParameter="DownloadedFile" PropertyName="_DownloadedFile" />
</DownloadFile>
<Exec Command="tar -xf $(_DownloadedFile) -C $(GeckoDriverDir)"/>
<Exec Command="rm -rf $(_DownloadedFile)"/>

<PropertyGroup>
<_GeckoDriverBinaryPath>$([MSBuild]::NormalizePath($(GeckoDriverDir), $(GeckoDriverBinaryName)))</_GeckoDriverBinaryPath>
</PropertyGroup>

<Error Text="Cannot find GeckoDriver at $(_GeckoDriverBinaryPath) in the downloaded copy"
Condition="!Exists($(_GeckoDriverBinaryPath))" />

<Exec Command="chmod +x $(_GeckoDriverBinaryPath)"/>

<Touch Files="$(GeckoDriverStampFile)" AlwaysCreate="true" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<!-- to see timing and which test aborted the runtime -->
<XunitShowProgress>true</XunitShowProgress>
<WasmXHarnessMaxParallelThreads>1</WasmXHarnessMaxParallelThreads>
<InstallFirefoxForTests>true</InstallFirefoxForTests>
<InstallChromeForTests>false</InstallChromeForTests>
</PropertyGroup>
<!-- Make debugging easier -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
Expand Down

0 comments on commit 32e0016

Please sign in to comment.