Fix use of Chrome Headless on Travis macOS builds

This commit is contained in:
Steve Sanderson 2018-02-14 13:51:23 +00:00
Родитель bdf243cfe2
Коммит 87b7389850
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -9,6 +9,7 @@ addons:
apt:
packages:
- libunwind8
chrome: stable
mono: none
os:
- linux
@ -29,6 +30,7 @@ install:
- nvm use 8.9.4
- npm install -g selenium-standalone
- selenium-standalone install
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export TEST_CHROME_BINARY=`which google-chrome-stable`; fi
- 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"
- export PATH="$DOTNET_INSTALL_DIR:$PATH"

Просмотреть файл

@ -16,6 +16,16 @@ namespace Microsoft.AspNetCore.Blazor.E2ETest.Infrastructure
{
var opts = new ChromeOptions();
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);
}