From bf3ffba1b0b50bbc6868b992d866f689ba5890fa Mon Sep 17 00:00:00 2001 From: Craig Nishina Date: Fri, 9 Nov 2018 16:09:01 -0800 Subject: [PATCH] chore(test): update provider and capabilities tests off of the control flow (#5021) --- scripts/test.js | 8 ++++---- spec/directConnect/directconnect_spec.js | 18 +++++++++--------- spec/directConnectConf.js | 1 + spec/driverProviderLocalConf.js | 1 + spec/driverProviders/local/local_spec.js | 24 ++++++++++++------------ spec/getCapabilitiesConf.js | 20 ++++++++++---------- 6 files changed, 37 insertions(+), 35 deletions(-) diff --git a/scripts/test.js b/scripts/test.js index bad084f40..a0c29902e 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -29,11 +29,11 @@ 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', - // 'node built/cli.js spec/getCapabilitiesConf.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/controlLockConf.js', // 'node built/cli.js spec/customFramework.js', // 'node built/cli.js spec/noGlobalsConf.js', 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', 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(); }); }); 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/'