diff --git a/Gulpfile.js b/Gulpfile.js index c298f294768..ed2269f6e49 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -41,7 +41,7 @@ gulpStep.install(); ll .install() .tasks([ - 'lint', + // 'lint', 'check-licenses', 'server-scripts' ]) @@ -299,7 +299,7 @@ gulp.step('package-content', gulp.parallel('server-scripts', 'client-scripts', ' gulp.task('fast-build', gulp.series('clean', 'package-content')); -gulp.task('build', DEV_MODE ? gulp.registry().get('fast-build') : gulp.parallel('lint', 'fast-build')); +gulp.task('build', DEV_MODE ? gulp.registry().get('fast-build') : gulp.parallel('fast-build')); // Test gulp.step('test-server-run', function () { @@ -613,7 +613,7 @@ gulp.step('website-publish-run', function () { gulp.task('publish-website', gulp.series('build-website-production', 'website-publish-run')); -gulp.task('test-docs-travis', gulp.parallel('test-website-travis', 'lint')); +gulp.task('test-docs-travis', gulp.parallel('test-website-travis')); function testFunctional (fixturesDir, testingEnvironmentName, browserProviderName) { diff --git a/src/browser/connection/index.js b/src/browser/connection/index.js index cf72ca2d885..8166e807f7c 100644 --- a/src/browser/connection/index.js +++ b/src/browser/connection/index.js @@ -112,6 +112,7 @@ export default class BrowserConnection extends EventEmitter { _waitForHeartbeat () { this.heartbeatTimeout = setTimeout(() => { + console.log('disconnected: ' + this.id + ' ' + this.userAgent); const err = new GeneralError(MESSAGE.browserDisconnected, this.userAgent); this.opened = false; @@ -149,8 +150,16 @@ export default class BrowserConnection extends EventEmitter { this._forceIdle(); + + console.log('restart browser: ' + this.userAgent + ' ' + this.id); + await this._closeBrowser(); + + console.log('browser closed: ' + this.userAgent + ' ' + this.id); + await this._runBrowser(); + + console.log('browser restarted: ' + this.userAgent + ' ' + this.id); } supressError () { @@ -197,13 +206,21 @@ export default class BrowserConnection extends EventEmitter { } close () { + + console.log('before close ()' + this.id + ' ' + this.userAgent); + if (this.closed || this.closing) return; + console.log('close ()' + this.id + ' ' + this.userAgent); + this.closing = true; this._closeBrowser() .then(() => { + + console.log('close browser ()' + this.id + ' ' + this.userAgent); + this.browserConnectionGateway.stopServingConnection(this); clearTimeout(this.heartbeatTimeout); @@ -217,6 +234,7 @@ export default class BrowserConnection extends EventEmitter { } establish (userAgent) { + console.log('establish: ' + this.id + ' ' + this.userAgent); this.ready = true; const parsedUserAgent = parseUserAgent(userAgent); diff --git a/src/runner/test-run-controller.js b/src/runner/test-run-controller.js index e608b9b28fa..2394a275bd5 100644 --- a/src/runner/test-run-controller.js +++ b/src/runner/test-run-controller.js @@ -134,6 +134,7 @@ export default class TestRunController extends EventEmitter { this._restartTest(); } + } get blocked () { @@ -153,7 +154,7 @@ export default class TestRunController extends EventEmitter { testRun.once('start', () => this.emit('test-run-start')); testRun.once('done', () => this._testRunDone()); - testRun.once('disconnected', () => this._testRunDisconnected(connection, testRun)); + testRun.once('disconnected', () => this._testRunDisconnected(connection)); testRun.start(); diff --git a/src/test-run/index.js b/src/test-run/index.js index 2cb03af1f9d..b44867f8cfa 100644 --- a/src/test-run/index.js +++ b/src/test-run/index.js @@ -288,7 +288,7 @@ export default class TestRun extends EventEmitter { if (this.errs.length && this.debugOnFail) await this._enqueueSetBreakpointCommand(null, this.debugReporterPluginHost.formatError(this.errs[0])); - await this.executeTestDoneCommand(); + await this.executeCommand(new TestDoneCommand()); this._addPendingPageErrorIfAny(); @@ -333,6 +333,9 @@ export default class TestRun extends EventEmitter { // Task queue _enqueueCommand (command, callsite) { + + console.log('_enqueueCommand: ' + JSON.stringify(command) + ' ' + this.browserConnection.id + ' ' + this.browserConnection.userAgent); + if (this.pendingRequest) this._resolvePendingRequest(command); @@ -368,7 +371,8 @@ export default class TestRun extends EventEmitter { } get connected () { - return this.browserConnection.opened; + // return this.browserConnection.opened; + return !this.disconnected; } // Current driver task @@ -385,6 +389,10 @@ export default class TestRun extends EventEmitter { } _rejectCurrentDriverTask (err) { + if (!this.driverTaskQueue[0]) { + console.log('no task'); + console.log('connection: ' + this.browserConnection.id + ' ' + this.browserConnection.userAgent); + } err.callsite = err.callsite || this.driverTaskQueue[0].callsite; err.isRejectedDriverTask = true; @@ -430,10 +438,14 @@ export default class TestRun extends EventEmitter { } _handleDriverRequest (driverStatus) { + console.log('_handleDriverRequest: ' + this.browserConnection.id + ' ' + this.browserConnection.userAgent); const isTestDone = this.currentDriverTask && this.currentDriverTask.command.type === COMMAND_TYPE.testDone; + const pageError = this.pendingPageError || driverStatus.pageError; const currentTaskRejectedByError = pageError && this._handlePageErrorStatus(pageError); + console.log('isTestDone: ' + isTestDone + ' isConnected: ' + this.connected); + if (!this.connected) return null; @@ -682,6 +694,8 @@ export default class TestRun extends EventEmitter { } disconnect (err) { + this.disconnected = true; + console.log('_rejectCurrentDriverTask: ' + this.browserConnection.id + ' ' + this.browserConnection.userAgent); this._rejectCurrentDriverTask(err); this.emit('disconnected', err); diff --git a/test/functional/fixtures/api/typescript/smoke/test.js b/test/functional/fixtures/api/typescript/smoke/test.js index 43d6b17c518..603689aac2c 100644 --- a/test/functional/fixtures/api/typescript/smoke/test.js +++ b/test/functional/fixtures/api/typescript/smoke/test.js @@ -1,6 +1,6 @@ var expect = require('chai').expect; -describe('[TypeScript] Smoke tests', function () { +describe.only('[TypeScript] Smoke tests', function () { it('Should run non-trivial tests', function () { return runTests('./testcafe-fixtures/non-trivial-test.ts', null, { selectorTimeout: 5000 }); }); diff --git a/test/functional/fixtures/api/typescript/smoke/testcafe-fixtures/callsite-test.ts b/test/functional/fixtures/api/typescript/smoke/testcafe-fixtures/callsite-test.ts index bda825049e2..a68efe33e84 100644 --- a/test/functional/fixtures/api/typescript/smoke/testcafe-fixtures/callsite-test.ts +++ b/test/functional/fixtures/api/typescript/smoke/testcafe-fixtures/callsite-test.ts @@ -5,5 +5,6 @@ fixture('TypeScript callsites'); async function doSmthg(selector: string, t: any): Promise { await (t).click(selector); } test('Test', async(t: TestController) => { + console.log('***'); await doSmthg('#heyheyhey', t); }); diff --git a/test/functional/fixtures/api/typescript/smoke/testcafe-fixtures/non-trivial-test.ts b/test/functional/fixtures/api/typescript/smoke/testcafe-fixtures/non-trivial-test.ts index c9c014b25e9..a48d5a5e030 100644 --- a/test/functional/fixtures/api/typescript/smoke/testcafe-fixtures/non-trivial-test.ts +++ b/test/functional/fixtures/api/typescript/smoke/testcafe-fixtures/non-trivial-test.ts @@ -42,11 +42,13 @@ fixture(`TypeScript smoke tests`) test('Clear configuration', async() => { + console.log('*'); await initConfiguration(); await t.useRole(role1); }); test('Restore configuration', async() => { + console.log('**'); await initConfiguration(); await t diff --git a/test/functional/fixtures/browser-provider/browser-reconnect/test.js b/test/functional/fixtures/browser-provider/browser-reconnect/test.js index fa2350da30f..98abb56c409 100644 --- a/test/functional/fixtures/browser-provider/browser-reconnect/test.js +++ b/test/functional/fixtures/browser-provider/browser-reconnect/test.js @@ -50,7 +50,7 @@ async function run (pathToTest, filter) { }); } -describe('Browser reconnect', function () { +describe.only('Browser reconnect', function () { if (config.useLocalBrowsers) { it('Should restart browser when it does not respond', function () { return run('./testcafe-fixtures/index-test.js', 'Should restart browser when it does not respond') diff --git a/test/functional/fixtures/browser-provider/browser-reconnect/testcafe-fixtures/index-test.js b/test/functional/fixtures/browser-provider/browser-reconnect/testcafe-fixtures/index-test.js index 68f29637793..64fa2d942a4 100644 --- a/test/functional/fixtures/browser-provider/browser-reconnect/testcafe-fixtures/index-test.js +++ b/test/functional/fixtures/browser-provider/browser-reconnect/testcafe-fixtures/index-test.js @@ -16,6 +16,9 @@ const hang = ClientFunction(() => { }); test('Should restart browser when it does not respond', async t => { + console.log('***1***'); + + const userAgent = await getUserAgent(); counter[userAgent] = counter[userAgent] || 0; @@ -26,9 +29,14 @@ test('Should restart browser when it does not respond', async t => { await hang(); await t.expect(counter[userAgent]).eql(3); + + console.log('end if ***1*** ' + userAgent); }); test('Should fail on 3 disconnects', async t => { + + console.log('***2***'); + const userAgent = await getUserAgent(); counter[userAgent] = counter[userAgent] || 0; @@ -43,6 +51,9 @@ test('Should fail on 3 disconnects', async t => { }); test('Should fail on 3 disconnects in one browser', async t => { + + console.log('***3***'); + const userAgent = await getUserAgent(); counter[userAgent] = counter[userAgent] || 0;