diff --git a/Gulpfile.js b/Gulpfile.js index 95e3ccb09e..1bfe09be70 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -36,6 +36,7 @@ const { MULTIPLE_WINDOWS_TESTS_GLOB, DEBUG_GLOB_1, DEBUG_GLOB_2, + PROXYLESS_TESTS_GLOB, } = require('./gulp/constants/functional-test-globs'); const { @@ -424,7 +425,7 @@ gulp.task('test-functional-local-debug-1', gulp.series('prepare-tests', 'test-fu gulp.task('test-functional-local-debug-2', gulp.series('prepare-tests', 'test-functional-local-debug-run-2')); gulp.step('test-functional-local-proxyless-run', () => { - return testFunctional(TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.localHeadlessChrome, { isProxyless: true }); + return testFunctional(PROXYLESS_TESTS_GLOB, functionalTestConfig.testingEnvironmentNames.localHeadlessChrome, { isProxyless: true }); }); gulp.task('test-functional-local-proxyless', gulp.series('prepare-tests', 'test-functional-local-proxyless-run')); diff --git a/gulp/constants/functional-test-globs.js b/gulp/constants/functional-test-globs.js index 5fea177ef3..c21a317ed7 100644 --- a/gulp/constants/functional-test-globs.js +++ b/gulp/constants/functional-test-globs.js @@ -27,6 +27,8 @@ const DEBUG_GLOB_2 = [ ...SCREENSHOT_TESTS_GLOB.map(glob => `!${glob}`), ]; +const PROXYLESS_TESTS_GLOB = []; + module.exports = { TESTS_GLOB, LEGACY_TESTS_GLOB, @@ -36,4 +38,5 @@ module.exports = { DEBUG_GLOB_1, DEBUG_GLOB_2, SCREENSHOT_TESTS_GLOB, + PROXYLESS_TESTS_GLOB, }; diff --git a/package.json b/package.json index 756e578fd2..b1185a2167 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "source-map-support": "^0.5.16", "strip-bom": "^2.0.0", "testcafe-browser-tools": "2.0.23", - "testcafe-hammerhead": "24.5.24", + "testcafe-hammerhead": "24.6.0", "testcafe-legacy-api": "5.1.4", "testcafe-reporter-dashboard": "1.0.0-rc.3", "testcafe-reporter-json": "^2.1.0", diff --git a/src/browser/connection/browser-connection-tracker.ts b/src/browser/connection/browser-connection-tracker.ts new file mode 100644 index 0000000000..3d649d4848 --- /dev/null +++ b/src/browser/connection/browser-connection-tracker.ts @@ -0,0 +1,19 @@ +import BrowserConnection from './index'; + +class BrowserConnectionTracker { + public activeBrowserConnections: { [id: string]: BrowserConnection }; + + public constructor () { + this.activeBrowserConnections = {}; + } + + public add (connection: BrowserConnection): void { + this.activeBrowserConnections[connection.id] = connection; + } + + public remove (connection: BrowserConnection): void { + delete this.activeBrowserConnections[connection.id]; + } +} + +export default new BrowserConnectionTracker(); diff --git a/src/browser/connection/gateway.ts b/src/browser/connection/gateway.ts index f83653032b..da87eda5c8 100644 --- a/src/browser/connection/gateway.ts +++ b/src/browser/connection/gateway.ts @@ -18,16 +18,15 @@ import SERVICE_ROUTES from './service-routes'; export default class BrowserConnectionGateway { private _connections: Dictionary = {}; private _remotesQueue: RemotesQueue; - public readonly domain: string; public readonly connectUrl: string; public retryTestPages: boolean; + public readonly proxy: Proxy; public constructor (proxy: Proxy, options: { retryTestPages: boolean }) { this._remotesQueue = new RemotesQueue(); - // @ts-ignore Need to improve typings of the 'testcafe-hammerhead' module - this.domain = (proxy as any).server1Info.domain; - this.connectUrl = `${this.domain}/browser/connect`; + this.connectUrl = proxy.resolveRelativeServiceUrl('/browser/connect'); this.retryTestPages = options.retryTestPages; + this.proxy = proxy; this._registerRoutes(proxy); } diff --git a/src/browser/connection/index.ts b/src/browser/connection/index.ts index ded7588558..64fa40b0fb 100644 --- a/src/browser/connection/index.ts +++ b/src/browser/connection/index.ts @@ -17,7 +17,6 @@ import BrowserConnectionStatus from './status'; import HeartbeatStatus from './heartbeat-status'; import { GeneralError, TimeoutError } from '../../errors/runtime'; import { RUNTIME_ERRORS } from '../../errors/types'; -import { Dictionary } from '../../configuration/interfaces'; import BrowserConnectionGateway from './gateway'; import BrowserJob from '../../runner/browser-job'; import WarningLog from '../../notifications/warning-log'; @@ -32,11 +31,16 @@ import { REMOTE_BROWSER_INIT_TIMEOUT, } from '../../utils/browser-connection-timeouts'; import MessageBus from '../../utils/message-bus'; +import BrowserConnectionTracker from './browser-connection-tracker'; +import TestRun from '../../test-run'; +// @ts-ignore +import { TestRun as LegacyTestRun } from 'testcafe-legacy-api'; +import { Proxy } from 'testcafe-hammerhead'; const getBrowserConnectionDebugScope = (id: string): string => `testcafe:browser:connection:${id}`; -const IDLE_PAGE_TEMPLATE = read('../../client/browser/idle-page/index.html.mustache'); -const connections: Dictionary = {}; +const IDLE_PAGE_TEMPLATE = read('../../client/browser/idle-page/index.html.mustache'); + interface DisconnectionPromise extends Promise { resolve: Function; @@ -83,31 +87,31 @@ export default class BrowserConnection extends EventEmitter { public permanent: boolean; public previousActiveWindowId: string | null; private readonly disableMultipleWindows: boolean; - private readonly proxyless: boolean; + public readonly proxyless: boolean; private readonly HEARTBEAT_TIMEOUT: number; private readonly BROWSER_CLOSE_TIMEOUT: number; private readonly BROWSER_RESTART_TIMEOUT: number; public readonly id: string; private readonly jobQueue: BrowserJob[]; private readonly initScriptsQueue: InitScriptTask[]; - private browserConnectionGateway: BrowserConnectionGateway; + public browserConnectionGateway: BrowserConnectionGateway; private disconnectionPromise: DisconnectionPromise | null; private testRunAborted: boolean; public status: BrowserConnectionStatus; private heartbeatTimeout: NodeJS.Timeout | null; private pendingTestRunUrl: string | null; - public readonly url: string; - public readonly idleUrl: string; - private forcedIdleUrl: string; - private readonly initScriptUrl: string; - public readonly heartbeatRelativeUrl: string; - public readonly statusRelativeUrl: string; - public readonly statusDoneRelativeUrl: string; - private readonly heartbeatUrl: string; - private readonly statusUrl: string; - public readonly activeWindowIdUrl: string; - public readonly closeWindowUrl: string; - private statusDoneUrl: string; + public url = ''; + public idleUrl = ''; + private forcedIdleUrl = ''; + private initScriptUrl = ''; + public heartbeatUrl = ''; + public statusUrl = ''; + public activeWindowIdUrl = ''; + public closeWindowUrl = ''; + public statusDoneUrl = ''; + public heartbeatRelativeUrl = ''; + public statusRelativeUrl = ''; + public statusDoneRelativeUrl = ''; private readonly debugLogger: debug.Debugger; private osInfo: OSInfo | null = null; @@ -155,24 +159,10 @@ export default class BrowserConnection extends EventEmitter { this.disableMultipleWindows = disableMultipleWindows; this.proxyless = proxyless; - this.url = `${gateway.domain}/browser/connect/${this.id}`; - this.idleUrl = `${gateway.domain}/browser/idle/${this.id}`; - this.forcedIdleUrl = `${gateway.domain}/browser/idle-forced/${this.id}`; - this.initScriptUrl = `${gateway.domain}/browser/init-script/${this.id}`; - - this.heartbeatRelativeUrl = `/browser/heartbeat/${this.id}`; - this.statusRelativeUrl = `/browser/status/${this.id}`; - this.statusDoneRelativeUrl = `/browser/status-done/${this.id}`; - this.activeWindowIdUrl = `/browser/active-window-id/${this.id}`; - this.closeWindowUrl = `/browser/close-window/${this.id}`; - - this.heartbeatUrl = `${gateway.domain}${this.heartbeatRelativeUrl}`; - this.statusUrl = `${gateway.domain}${this.statusRelativeUrl}`; - this.statusDoneUrl = `${gateway.domain}${this.statusDoneRelativeUrl}`; - + this._buildCommunicationUrls(gateway.proxy); this._setEventHandlers(); - connections[this.id] = this; + BrowserConnectionTracker.add(this); this.previousActiveWindowId = null; @@ -182,6 +172,24 @@ export default class BrowserConnection extends EventEmitter { process.nextTick(() => this._runBrowser()); } + private _buildCommunicationUrls (proxy: Proxy): void { + this.url = proxy.resolveRelativeServiceUrl(`/browser/connect/${this.id}`); + this.idleUrl = proxy.resolveRelativeServiceUrl(`/browser/idle/${this.id}`); + this.forcedIdleUrl = proxy.resolveRelativeServiceUrl(`/browser/idle-forced/${this.id}`); + this.initScriptUrl = proxy.resolveRelativeServiceUrl(`/browser/init-script/${this.id}`); + + this.heartbeatRelativeUrl = `/browser/heartbeat/${this.id}`; + this.statusRelativeUrl = `/browser/status/${this.id}`; + this.statusDoneRelativeUrl = `/browser/status-done/${this.id}`; + this.activeWindowIdUrl = `/browser/active-window-id/${this.id}`; + this.closeWindowUrl = `/browser/close-window/${this.id}`; + + this.heartbeatUrl = proxy.resolveRelativeServiceUrl(this.heartbeatRelativeUrl); + this.statusUrl = proxy.resolveRelativeServiceUrl(this.statusRelativeUrl); + this.statusDoneUrl = proxy.resolveRelativeServiceUrl(this.statusDoneRelativeUrl); + + } + public set messageBus (messageBus: MessageBus) { this._messageBus = messageBus; this.warningLog.callback = WarningLog.createAddWarningCallback(this._messageBus); @@ -278,8 +286,12 @@ export default class BrowserConnection extends EventEmitter { return this.hasQueuedJobs ? await this.currentJob.popNextTestRunUrl(this) : null; } + public getCurrentTestRun (): LegacyTestRun | TestRun | null { + return this.currentJob ? this.currentJob.currentTestRun : null; + } + public static getById (id: string): BrowserConnection | null { - return connections[id] || null; + return BrowserConnectionTracker.activeBrowserConnections[id] || null; } private async _restartBrowser (): Promise { @@ -454,7 +466,7 @@ export default class BrowserConnection extends EventEmitter { if (this.heartbeatTimeout) clearTimeout(this.heartbeatTimeout); - delete connections[this.id]; + BrowserConnectionTracker.remove(this); this.status = BrowserConnectionStatus.closed; this.emit(BrowserConnectionStatus.closed); diff --git a/src/browser/provider/built-in/dedicated/chrome/cdp-client/index.ts b/src/browser/provider/built-in/dedicated/chrome/cdp-client/index.ts index 85163a5582..2cf7edb6f6 100644 --- a/src/browser/provider/built-in/dedicated/chrome/cdp-client/index.ts +++ b/src/browser/provider/built-in/dedicated/chrome/cdp-client/index.ts @@ -49,16 +49,14 @@ interface VideoFrameData { export class BrowserClient { private _clients: Dictionary = {}; private readonly _runtimeInfo: RuntimeInfo; - private readonly _proxyless: boolean; private _parentTarget?: remoteChrome.TargetInfo; private readonly debugLogger: debug.Debugger; private readonly _videoFramesBuffer: VideoFrameData[]; private _lastFrame: VideoFrameData | null; - public constructor (runtimeInfo: RuntimeInfo, proxyless: boolean) { + public constructor (runtimeInfo: RuntimeInfo) { this._runtimeInfo = runtimeInfo; this.debugLogger = debug(DEBUG_SCOPE(runtimeInfo.browserId)); - this._proxyless = proxyless; runtimeInfo.browserClient = this; diff --git a/src/browser/provider/built-in/dedicated/chrome/index.js b/src/browser/provider/built-in/dedicated/chrome/index.js index 4ef89c1bfe..811a8e7038 100644 --- a/src/browser/provider/built-in/dedicated/chrome/index.js +++ b/src/browser/provider/built-in/dedicated/chrome/index.js @@ -10,6 +10,7 @@ import { } from './local-chrome'; import { GET_WINDOW_DIMENSIONS_INFO_SCRIPT } from '../../../utils/client-functions'; import { BrowserClient } from './cdp-client'; +import RequestsInterceptor from './requests-interceptor'; const MIN_AVAILABLE_DIMENSION = 50; @@ -43,6 +44,13 @@ export default { this.setUserAgentMetaInfo(browserId, metaInfo, options); }, + async _setupProxyless (browserId, browserClient) { + const requestsInterceptor = new RequestsInterceptor(browserId); + const cdpClient = await browserClient.getActiveClient(); + + await requestsInterceptor.setup(cdpClient); + }, + async openBrowser (browserId, pageUrl, config, disableMultipleWindows, proxyless) { const parsedPageUrl = parseUrl(pageUrl); const runtimeInfo = await this._createRunTimeInfo(parsedPageUrl.hostname, config, disableMultipleWindows); @@ -70,7 +78,7 @@ export default { if (!disableMultipleWindows) runtimeInfo.activeWindowId = this.calculateWindowId(); - const browserClient = new BrowserClient(runtimeInfo, proxyless); + const browserClient = new BrowserClient(runtimeInfo); this.openedBrowsers[browserId] = runtimeInfo; @@ -79,6 +87,9 @@ export default { await this._ensureWindowIsExpanded(browserId, runtimeInfo.viewportSize); this._setUserAgentMetaInfoForEmulatingDevice(browserId, runtimeInfo.config); + + if (proxyless) + await this._setupProxyless(browserId, browserClient); }, async closeBrowser (browserId, closingInfo = {}) { diff --git a/src/browser/provider/built-in/dedicated/chrome/requests-interceptor.ts b/src/browser/provider/built-in/dedicated/chrome/requests-interceptor.ts new file mode 100644 index 0000000000..76546df2a1 --- /dev/null +++ b/src/browser/provider/built-in/dedicated/chrome/requests-interceptor.ts @@ -0,0 +1,89 @@ +import { ProtocolApi } from 'chrome-remote-interface'; +import Protocol from 'devtools-protocol'; +import RequestPausedEvent = Protocol.Fetch.RequestPausedEvent; +import RequestPattern = Protocol.Fetch.RequestPattern; +import GetResponseBodyResponse = Protocol.Fetch.GetResponseBodyResponse; +import { + injectResources, + PageInjectableResources, + INJECTABLE_SCRIPTS as HAMMERHEAD_INJECTABLE_SCRIPTS, +} from 'testcafe-hammerhead'; +import BrowserConnection from '../../../../connection'; +import { SCRIPTS, TESTCAFE_UI_STYLES } from '../../../../../assets/injectables'; + +const HTTP_STATUS_OK = 200; + +export default class RequestsInterceptor { + private readonly _browserId: string; + + public constructor (browserId: string) { + this._browserId = browserId; + } + + private _getResponseAsString (response: GetResponseBodyResponse): string { + return response.base64Encoded + ? Buffer.from(response.body, 'base64').toString() + : response.body; + } + + private async _prepareInjectableResources (): Promise { + const browserConnection = BrowserConnection.getById(this._browserId) as BrowserConnection; + const proxy = browserConnection.browserConnectionGateway.proxy; + const windowId = browserConnection.activeWindowId; + + const taskScript = await browserConnection.currentJob.currentTestRun.session.getTaskScript({ + referer: '', + cookieUrl: '', + isIframe: false, + withPayload: true, + serverInfo: proxy.server1Info, + windowId, + }); + + const injectableResources = { + stylesheets: [ + TESTCAFE_UI_STYLES, + ], + scripts: [ + ...HAMMERHEAD_INJECTABLE_SCRIPTS, + ...SCRIPTS, + ], + embeddedScripts: [taskScript], + }; + + injectableResources.scripts = injectableResources.scripts.map(script => proxy.resolveRelativeServiceUrl(script)); + injectableResources.stylesheets = injectableResources.stylesheets.map(style => proxy.resolveRelativeServiceUrl(style)); + + return injectableResources; + } + + public async setup (client: ProtocolApi): Promise { + const fetchAllDocumentsPattern = { + urlPattern: '*', + resourceType: 'Document', + requestStage: 'Response', + } as RequestPattern; + + await client.Fetch.enable({ patterns: [fetchAllDocumentsPattern] }); + + client.Fetch.on('requestPaused', async (params: RequestPausedEvent) => { + const { + requestId, + responseHeaders, + responseStatusCode, + } = params; + + const responseObj = await client.Fetch.getResponseBody({ requestId }); + const responseStr = this._getResponseAsString(responseObj); + const injectableResources = await this._prepareInjectableResources(); + const updatedResponseStr = injectResources(responseStr, injectableResources); + + await client.Fetch.fulfillRequest({ + requestId, + responseCode: responseStatusCode || HTTP_STATUS_OK, + responseHeaders: responseHeaders || [], + body: Buffer.from(updatedResponseStr).toString('base64'), + }); + }); + } +} diff --git a/src/client/test-run/index.js.mustache b/src/client/test-run/index.js.mustache index 13bc1e307a..30ea959ce0 100644 --- a/src/client/test-run/index.js.mustache +++ b/src/client/test-run/index.js.mustache @@ -26,6 +26,7 @@ var fixtureName = {{{fixtureName}}}; var testName = {{{testName}}}; var canUseDefaultWindowActions = {{{canUseDefaultWindowActions}}}; + var proxyless = {{{proxyless}}}; var ClientDriver = window['%testCafeDriver%']; var driver = new ClientDriver(testRunId, @@ -39,7 +40,8 @@ dialogHandler: dialogHandler, retryTestPages: retryTestPages, speed: speed, - canUseDefaultWindowActions: canUseDefaultWindowActions + canUseDefaultWindowActions: canUseDefaultWindowActions, + proxyless: proxyless } ); diff --git a/src/configuration/testcafe-configuration.ts b/src/configuration/testcafe-configuration.ts index 1c1560503e..f5fe1330d3 100644 --- a/src/configuration/testcafe-configuration.ts +++ b/src/configuration/testcafe-configuration.ts @@ -74,6 +74,7 @@ interface TestCafeAdditionalStartOptions { developmentMode: boolean; cache: boolean; disableHttp2: boolean; + proxyless: boolean; } interface TestCafeStartOptions { @@ -160,6 +161,7 @@ export default class TestCafeConfiguration extends Configuration { retryTestPages: this.getOption(OPTION_NAMES.retryTestPages) as boolean, cache: this.getOption(OPTION_NAMES.cache) as boolean, disableHttp2: this.getOption(OPTION_NAMES.disableHttp2) as boolean, + proxyless: this.getOption(OPTION_NAMES.proxyless) as boolean, }, }; diff --git a/src/runner/browser-job.ts b/src/runner/browser-job.ts index 41739a5faa..af09d31c25 100644 --- a/src/runner/browser-job.ts +++ b/src/runner/browser-job.ts @@ -14,6 +14,9 @@ import CompilerService from '../services/compiler/host'; import { BrowserJobInit } from './interfaces'; import MessageBus from '../utils/message-bus'; import TestRunHookController from './test-run-hook-controller'; +import TestRun from '../test-run'; +// @ts-ignore +import { TestRun as LegacyTestRun } from 'testcafe-legacy-api'; interface BrowserJobResultInfo { status: BrowserJobResult; @@ -207,6 +210,10 @@ export default class BrowserJob extends AsyncEventEmitter { return !!this._testRunControllerQueue.length; } + public get currentTestRun (): LegacyTestRun | TestRun | null { + return this._completionQueue.length ? this._completionQueue[0].testRun : null; + } + public async popNextTestRunUrl (connection: BrowserConnection): Promise { while (this._testRunControllerQueue.length) { const testRunController = this._testRunControllerQueue[0]; diff --git a/src/test-run/index.ts b/src/test-run/index.ts index 102fee7a0c..ded7e28419 100644 --- a/src/test-run/index.ts +++ b/src/test-run/index.ts @@ -553,6 +553,7 @@ export default class TestRun extends AsyncEventEmitter { speed: this.speed, dialogHandler: JSON.stringify(this.activeDialogHandler), canUseDefaultWindowActions: JSON.stringify(await this.browserConnection.canUseDefaultWindowActions()), + proxyless: JSON.stringify(this.opts.proxyless), }); } diff --git a/test/server/bootstrapper-test.js b/test/server/bootstrapper-test.js index da4eac1dce..cbab402d06 100644 --- a/test/server/bootstrapper-test.js +++ b/test/server/bootstrapper-test.js @@ -5,12 +5,10 @@ const Test = require('../../lib/api/structure/test'); const Bootstrapper = require('../../lib/runner/bootstrapper'); const delay = require('../../lib/utils/delay'); +const { browserConnectionGatewayMock } = require('./helpers/mocks'); + describe('Bootstrapper', () => { describe('.createRunnableConfiguration()', () => { - const browserConnectionGateway = { - startServingConnection: noop, - stopServingConnection: noop, - }; const compilerService = { init: noop, getTests: async () => { @@ -26,7 +24,7 @@ describe('Bootstrapper', () => { let bootstrapper = null; beforeEach(() => { - bootstrapper = new Bootstrapper({ browserConnectionGateway, compilerService, configuration }); + bootstrapper = new Bootstrapper({ browserConnectionGatewayMock, compilerService, configuration }); bootstrapper.browserInitTimeout = 100; bootstrapper.TESTS_COMPILATION_UPPERBOUND = 0; @@ -38,7 +36,7 @@ describe('Bootstrapper', () => { closeBrowser: noop, }; - bootstrapper.browsers = [ new BrowserConnection(browserConnectionGateway, { provider }) ]; + bootstrapper.browsers = [ new BrowserConnection(browserConnectionGatewayMock, { provider }) ]; }); it('Browser connection error message should include hint that tests compilation takes too long', async function () { diff --git a/test/server/browser-provider-test.js b/test/server/browser-provider-test.js index 98841ad3c4..cb6364bd53 100644 --- a/test/server/browser-provider-test.js +++ b/test/server/browser-provider-test.js @@ -16,13 +16,10 @@ const WARNING_MESSAGE = require('../../lib/notifications/warning const BrowserProviderPluginHost = require('../../lib/browser/provider/plugin-host'); const WarningLog = require('../../lib/notifications/warning-log'); +const { browserConnectionGatewayMock } = require('./helpers/mocks'); + class BrowserConnectionMock extends BrowserConnection { constructor () { - const browserConnectionGatewayMock = { - startServingConnection: noop, - stopServingConnection: noop, - }; - const providerMock = { openBrowser: noop, isLocalBrowser: noop, diff --git a/test/server/helpers/mocks.js b/test/server/helpers/mocks.js new file mode 100644 index 0000000000..f7ac2a3971 --- /dev/null +++ b/test/server/helpers/mocks.js @@ -0,0 +1,14 @@ +const { noop } = require('lodash'); + +const browserConnectionGatewayMock = { + startServingConnection: noop, + stopServingConnection: noop, + + proxy: { + resolveRelativeServiceUrl: noop, + }, +}; + +module.exports = { + browserConnectionGatewayMock, +}; diff --git a/test/server/runner-test.js b/test/server/runner-test.js index a2b2ab0c07..15b11f3071 100644 --- a/test/server/runner-test.js +++ b/test/server/runner-test.js @@ -23,6 +23,8 @@ const { noop } = require('lodash'); const Test = require('../../lib/api/structure/test'); const TestCafeConfiguration = require('../../lib/configuration/testcafe-configuration'); +const { browserConnectionGatewayMock } = require('./helpers/mocks'); + const createConfigFile = (configPath, options) => { options = options || {}; fs.writeFileSync(configPath, JSON.stringify(options)); @@ -1067,11 +1069,6 @@ describe('Runner', () => { }); describe('On Linux without a graphics subsystem', () => { - - const browserConnectionGateway = { - startServingConnection: noop, - stopServingConnection: noop, - }; const compilerService = { init: noop, getTests: () => [new Test({ currentFixture: void 0 })], @@ -1082,6 +1079,9 @@ describe('Runner', () => { class BrowserConnectionMock extends BrowserConnection { constructor (...args) { + if (!args[0]) + args[0] = browserConnectionGatewayMock; + super(...args); this.status = BrowserConnectionStatus.opened; @@ -1095,7 +1095,7 @@ describe('Runner', () => { '../browser/connection': BrowserConnectionMock, }); - return new BootstrapperMock({ browserConnectionGateway, compilerService }); + return new BootstrapperMock({ browserConnectionGatewayMock, compilerService }); } function createMockRunner () { @@ -1106,7 +1106,7 @@ describe('Runner', () => { const runnerLocal = new RunnerMock({ proxy: testCafe.proxy, - browserConnectionGateway: browserConnectionGateway, + browserConnectionGateway: browserConnectionGatewayMock, configuration: testCafe.configuration.clone(), compilerService: compilerService, }); @@ -1172,7 +1172,7 @@ describe('Runner', () => { await runnerLinux._validateRunOptions(); await runnerLinux._createRunnableConfiguration(); } - catch { + catch (e) { isErrorThrown = true; } @@ -1184,7 +1184,7 @@ describe('Runner', () => { let isErrorThrown = false; try { - await runnerLinux.browsers([new BrowserConnection(browserConnectionGateway, browserInfo)]); + await runnerLinux.browsers([new BrowserConnection(browserConnectionGatewayMock, browserInfo)]); await runnerLinux._setConfigurationOptions(); await runnerLinux._setBootstrapperOptions(); await runnerLinux._validateRunOptions();