protected override async Task <ExitCode> InvokeInternal(ILogger logger)
        {
            var xmlResultsFilePath = Path.Combine(_arguments.OutputDirectory, "testResults.xml");

            File.Delete(xmlResultsFilePath);

            var stdoutFilePath = Path.Combine(_arguments.OutputDirectory, "wasm-console.log");

            File.Delete(stdoutFilePath);

            var logProcessor = new WasmTestMessagesProcessor(xmlResultsFilePath, stdoutFilePath, logger);
            var runner       = new WasmBrowserTestRunner(
                _arguments,
                PassThroughArguments,
                logProcessor,
                logger);

            var(driverService, driver) = GetChromeDriver(logger);
            try
            {
                return(await runner.RunTestsWithWebDriver(driverService, driver));
            }
            finally
            {
                driverService.Dispose();
                driver.Dispose();
            }
        }
Esempio n. 2
0
        protected override async Task <ExitCode> InvokeInternal(ILogger logger)
        {
            var xmlResultsFilePath = Path.Combine(_arguments.OutputDirectory, "testResults.xml");

            File.Delete(xmlResultsFilePath);

            var logProcessor = new WasmTestMessagesProcessor(xmlResultsFilePath, logger);
            var runner       = new WasmBrowserTestRunner(
                _arguments,
                PassThroughArguments,
                logProcessor.Invoke,
                logger);

            using var driver = GetChromeDriver();
            return(await runner.RunTestsWithWebDriver(driver));
        }
        protected override async Task <ExitCode> InvokeInternal(ILogger logger)
        {
            var xmlResultsFilePath = Path.Combine(_arguments.OutputDirectory, "testResults.xml");

            File.Delete(xmlResultsFilePath);

            var stdoutFilePath = Path.Combine(_arguments.OutputDirectory, "wasm-console.log");

            File.Delete(stdoutFilePath);

            var logProcessor = new WasmTestMessagesProcessor(xmlResultsFilePath, stdoutFilePath, logger);
            var runner       = new WasmBrowserTestRunner(
                _arguments,
                PassThroughArguments,
                logProcessor,
                logger);

            (DriverService driverService, IWebDriver driver) = _arguments.Browser switch
            {
                Browser.Chrome => GetChromeDriver(logger),
                Browser.Safari => GetSafariDriver(logger),
                Browser.Firefox => GetFirefoxDriver(logger),
                Browser.Edge => GetEdgeDriver(logger),

                // shouldn't reach here
                _ => throw new ArgumentException($"Unknown browser : {_arguments.Browser}")
            };

            try
            {
                return(await runner.RunTestsWithWebDriver(driverService, driver));
            }
            finally
            {
                driver.Quit();  // Firefox driver hangs if Quit is not issued.
                driverService.Dispose();
                driver.Dispose();
            }
        }