Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
chore(test): update provider and capabilities tests off of the contro…
Browse files Browse the repository at this point in the history
…l flow (#5021)
  • Loading branch information
cnishina committed Nov 10, 2018
1 parent c0855fc commit bf3ffba
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 35 deletions.
8 changes: 4 additions & 4 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
18 changes: 9 additions & 9 deletions spec/directConnect/directconnect_spec.js
Original file line number Diff line number Diff line change
@@ -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');
});
});
1 change: 1 addition & 0 deletions spec/directConnectConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down
1 change: 1 addition & 0 deletions spec/driverProviderLocalConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var env = require('./environment');
exports.config = {

framework: 'jasmine',
SELENIUM_PROMISE_MANAGER: false,

specs: [
'driverProviders/local/*_spec.js'
Expand Down
24 changes: 12 additions & 12 deletions spec/driverProviders/local/local_spec.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
20 changes: 10 additions & 10 deletions spec/getCapabilitiesConf.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
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: [
'basic/mock*'
],

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/'
Expand Down

0 comments on commit bf3ffba

Please sign in to comment.