Fix use of Chrome Headless on Travis macOS builds
This commit is contained in:
parent
94261ded25
commit
5f41779b3e
|
|
@ -9,6 +9,7 @@ addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- libunwind8
|
- libunwind8
|
||||||
|
chrome: stable
|
||||||
mono: none
|
mono: none
|
||||||
os:
|
os:
|
||||||
- linux
|
- linux
|
||||||
|
|
@ -29,6 +30,7 @@ install:
|
||||||
- nvm use 8.9.4
|
- nvm use 8.9.4
|
||||||
- npm install -g selenium-standalone
|
- npm install -g selenium-standalone
|
||||||
- selenium-standalone install
|
- selenium-standalone install
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export TEST_CHROME_BINARY=`which google-chrome-stable`; fi
|
||||||
- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
|
- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
|
||||||
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel Current --version latest --install-dir "$DOTNET_INSTALL_DIR"
|
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel Current --version latest --install-dir "$DOTNET_INSTALL_DIR"
|
||||||
- export PATH="$DOTNET_INSTALL_DIR:$PATH"
|
- export PATH="$DOTNET_INSTALL_DIR:$PATH"
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,16 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Infrastructure
|
||||||
{
|
{
|
||||||
var opts = new ChromeOptions();
|
var opts = new ChromeOptions();
|
||||||
opts.AddArgument("--headless");
|
opts.AddArgument("--headless");
|
||||||
|
|
||||||
|
// On Windows/Linux, we don't need to set opts.BinaryLocation
|
||||||
|
// But for Travis Mac builds we do
|
||||||
|
var binaryLocation = Environment.GetEnvironmentVariable("TEST_CHROME_BINARY");
|
||||||
|
if (!string.IsNullOrEmpty(binaryLocation))
|
||||||
|
{
|
||||||
|
opts.BinaryLocation = binaryLocation;
|
||||||
|
Console.WriteLine($"Set {nameof(ChromeOptions)}.{nameof(opts.BinaryLocation)} to {binaryLocation}");
|
||||||
|
}
|
||||||
|
|
||||||
Browser = new RemoteWebDriver(opts);
|
Browser = new RemoteWebDriver(opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue