Attempt to use the local ChromeDriver first (#1653)

This commit is contained in:
Matthew Leibowitz 2021-03-13 06:01:15 +02:00 коммит произвёл GitHub
Родитель ec4f45adc3
Коммит d8515272c4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 12 добавлений и 3 удалений

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

@ -36,6 +36,7 @@ var UNSUPPORTED_TESTS = Argument ("unsupportedTests", "");
var THROW_ON_TEST_FAILURE = Argument ("throwOnTestFailure", true);
var NUGET_DIFF_PRERELEASE = Argument ("nugetDiffPrerelease", false);
var COVERAGE = Argument ("coverage", false);
var CHROMEWEBDRIVER = Argument ("chromedriver", EnvironmentVariable ("CHROMEWEBDRIVER"));
var PLATFORM_SUPPORTS_VULKAN_TESTS = (IsRunningOnWindows () || IsRunningOnLinux ()).ToString ();
var SUPPORT_VULKAN_VAR = Argument ("supportVulkan", EnvironmentVariable ("SUPPORT_VULKAN") ?? PLATFORM_SUPPORTS_VULKAN_TESTS);
@ -325,7 +326,10 @@ Task ("tests-wasm")
Arguments = "server.py",
WorkingDirectory = pubDir,
});
DotNetCoreRun("./utils/WasmTestRunner/WasmTestRunner.csproj", "http://localhost:8000/ -o ./tests/SkiaSharp.Wasm.Tests/TestResults/");
DotNetCoreRun("./utils/WasmTestRunner/WasmTestRunner.csproj",
"http://localhost:8000/ " +
"-o ./tests/SkiaSharp.Wasm.Tests/TestResults/ " +
(string.IsNullOrEmpty(CHROMEWEBDRIVER) ? "" : $"-d {CHROMEWEBDRIVER}"));
} catch {
failedTests++;
} finally {

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

@ -678,7 +678,7 @@ stages:
vmImage: $(VM_IMAGE_LINUX)
packages: $(MANAGED_LINUX_PACKAGES) ninja-build
target: tests-wasm
additionalArgs: --skipExternals="all" --throwOnTestFailure=$(THROW_ON_TEST_FAILURE) --coverage=false
additionalArgs: --skipExternals="all" --throwOnTestFailure=$(THROW_ON_TEST_FAILURE) --coverage=false --chromedriver=$(CHROMEWEBDRIVER)
shouldPublish: false
requiredArtifacts:
- native_wasm_linux

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

@ -14,6 +14,8 @@ namespace WasmTestRunner
private const string DefaultUrl = "http://localhost:5000/";
private const string ResultsFileName = "TestResults.xml";
public static string ChromeDriverPath { get; set; }
public static string OutputPath { get; set; } = Directory.GetCurrentDirectory();
public static int Timeout { get; set; } = 30;
@ -30,6 +32,7 @@ namespace WasmTestRunner
{
var p = new OptionSet
{
{ "d|driver=", "the path to the ChromeDriver executable. Default is use the local version.", v => ChromeDriverPath = v },
{ "o|output=", "the path to the test results file. Default is the current directory.", v => OutputPath = v },
{ "t|timeout=", "the number of seconds to wait before timing out. Default is 30.", (int v) => Timeout = v },
{ "no-headless", "do not use a headless browser.", v => UseHeadless = false },
@ -105,7 +108,9 @@ namespace WasmTestRunner
options.AddArgument("window-size=1024x768");
using var service = ChromeDriverService.CreateDefaultService();
using var service = string.IsNullOrEmpty(ChromeDriverPath)
? ChromeDriverService.CreateDefaultService()
: ChromeDriverService.CreateDefaultService(ChromeDriverPath);
using var driver = new ChromeDriver(service, options);
driver.Url = Url;