From 7d057bcfc88e27c5a08384d79677dd4cf9463441 Mon Sep 17 00:00:00 2001 From: Craig Nishina Date: Thu, 8 Nov 2018 14:02:56 -0800 Subject: [PATCH 1/3] chore(test): update provider and capabilities tests off of the control flow --- scripts/test.js | 2 +- spec/directConnect/directconnect_spec.js | 18 +++++++++--------- spec/directConnectConf.js | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/test.js b/scripts/test.js index bf37c5557..8e7ef2ffb 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -29,7 +29,7 @@ var passingTests = [ // 'node built/cli.js spec/plugins/browserGetUnsyncedConf.js', // 'node built/cli.js spec/plugins/waitForAngularConf.js', // 'node built/cli.js spec/interactionConf.js', - // 'node built/cli.js spec/directConnectConf.js', + 'node built/cli.js spec/directConnectConf.js', // 'node built/cli.js spec/restartBrowserBetweenTestsConf.js', // 'node built/cli.js spec/driverProviderLocalConf.js', // 'node built/cli.js spec/driverProviderLocalConf.js --useBlockingProxy', diff --git a/spec/directConnect/directconnect_spec.js b/spec/directConnect/directconnect_spec.js index 9ea93849b..a34083f53 100644 --- a/spec/directConnect/directconnect_spec.js +++ b/spec/directConnect/directconnect_spec.js @@ -1,14 +1,14 @@ -describe('direct connect', function() { - it('should instantiate and run', function() { - var usernameInput = element(by.model('username')); - var name = element(by.binding('username')); +describe('direct connect', () => { + it('should instantiate and run', async() => { + const usernameInput = element(by.model('username')); + const name = element(by.binding('username')); - browser.get('index.html#/form'); + await browser.get('index.html#/form'); - expect(name.getText()).toEqual('Anon'); + expect(await name.getText()).toEqual('Anon'); - usernameInput.clear(); - usernameInput.sendKeys('Jane'); - expect(name.getText()).toEqual('Jane'); + await usernameInput.clear(); + await usernameInput.sendKeys('Jane'); + expect(await name.getText()).toEqual('Jane'); }); }); diff --git a/spec/directConnectConf.js b/spec/directConnectConf.js index d344fa0fb..bc0312292 100644 --- a/spec/directConnectConf.js +++ b/spec/directConnectConf.js @@ -3,6 +3,7 @@ var env = require('./environment.js'); // A configuration file running a simple direct connect spec exports.config = { directConnect: true, + SELENIUM_PROMISE_MANAGER: false, framework: 'jasmine', From 8c633599ed081928b0e61c92d4fed58a1cbf0d8c Mon Sep 17 00:00:00 2001 From: Craig Nishina Date: Thu, 8 Nov 2018 14:08:31 -0800 Subject: [PATCH 2/3] driverProviderLocal --- scripts/test.js | 4 ++-- spec/driverProviderLocalConf.js | 1 + spec/driverProviders/local/local_spec.js | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/test.js b/scripts/test.js index 8e7ef2ffb..86882431a 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -31,8 +31,8 @@ var passingTests = [ // 'node built/cli.js spec/interactionConf.js', 'node built/cli.js spec/directConnectConf.js', // 'node built/cli.js spec/restartBrowserBetweenTestsConf.js', - // 'node built/cli.js spec/driverProviderLocalConf.js', - // 'node built/cli.js spec/driverProviderLocalConf.js --useBlockingProxy', + 'node built/cli.js spec/driverProviderLocalConf.js', + 'node built/cli.js spec/driverProviderLocalConf.js --useBlockingProxy', // 'node built/cli.js spec/getCapabilitiesConf.js', // 'node built/cli.js spec/controlLockConf.js', // 'node built/cli.js spec/customFramework.js', diff --git a/spec/driverProviderLocalConf.js b/spec/driverProviderLocalConf.js index 9dfb2d827..f0f062bc0 100644 --- a/spec/driverProviderLocalConf.js +++ b/spec/driverProviderLocalConf.js @@ -3,6 +3,7 @@ var env = require('./environment'); exports.config = { framework: 'jasmine', + SELENIUM_PROMISE_MANAGER: false, specs: [ 'driverProviders/local/*_spec.js' diff --git a/spec/driverProviders/local/local_spec.js b/spec/driverProviders/local/local_spec.js index 2924d2d02..c4cb3497b 100644 --- a/spec/driverProviders/local/local_spec.js +++ b/spec/driverProviders/local/local_spec.js @@ -1,17 +1,17 @@ -describe('local driver provider', function() { - var URL = '/ng2/#/async'; +describe('local driver provider', () => { + const URL = '/ng2/#/async'; - it('should get a page and find an element', function() { - browser.get(URL); - var increment = $('#increment'); - expect(increment).toBeDefined(); + it('should get a page and find an element', async() => { + await browser.get(URL); + const increment = $('#increment'); + expect(await increment.isPresent()).toBeDefined(); }); - it('should get a forked instance, and find an element', function() { - browser.get(URL); - var browser2 = browser.forkNewDriverInstance(); - browser2.get(URL); - var increment = browser2.$('#increment'); - expect(increment).toBeDefined(); + it('should get a forked instance, and find an element', async() => { + await browser.get(URL); + const browser2 = await browser.forkNewDriverInstance().ready; + await browser2.get(URL); + const increment = browser2.$('#increment'); + expect(await increment.isPresent()).toBeDefined(); }); }); From be736b2106c722b84fd9e1bde7385eb36927fcec Mon Sep 17 00:00:00 2001 From: Craig Nishina Date: Thu, 8 Nov 2018 14:15:26 -0800 Subject: [PATCH 3/3] getCapabiities --- scripts/test.js | 2 +- spec/getCapabilitiesConf.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/test.js b/scripts/test.js index 86882431a..187327c70 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -33,7 +33,7 @@ var passingTests = [ // 'node built/cli.js spec/restartBrowserBetweenTestsConf.js', 'node built/cli.js spec/driverProviderLocalConf.js', 'node built/cli.js spec/driverProviderLocalConf.js --useBlockingProxy', - // 'node built/cli.js spec/getCapabilitiesConf.js', + 'node built/cli.js spec/getCapabilitiesConf.js', // 'node built/cli.js spec/controlLockConf.js', // 'node built/cli.js spec/customFramework.js', // 'node built/cli.js spec/noGlobalsConf.js', diff --git a/spec/getCapabilitiesConf.js b/spec/getCapabilitiesConf.js index 50035871f..beaa6b5f7 100644 --- a/spec/getCapabilitiesConf.js +++ b/spec/getCapabilitiesConf.js @@ -1,8 +1,8 @@ -var env = require('./environment.js'); -var q = require('q'); +const env = require('./environment.js'); exports.config = { seleniumAddress: env.seleniumAddress, + SELENIUM_PROMISE_MANAGER: false, // Spec patterns are relative to this directory. specs: [ @@ -10,15 +10,15 @@ exports.config = { ], framework: 'debugprint', - getMultiCapabilities: function() { - var deferred = q.defer(); + getMultiCapabilities: async function() { // Wait for a server to be ready or get capabilities asynchronously. - setTimeout(function() { - deferred.resolve([{ - 'browserName': 'firefox' - }]); - }, 1000); - return deferred.promise; + return await new Promise(resolve => { + setTimeout(() => { + resolve([{ + 'browserName': 'firefox' + }]); + }, 1000); + }); }, baseUrl: env.baseUrl + '/ng1/'