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

chore(test): move plugins tests off of the control flow and remove q #5018

Merged
merged 1 commit into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ var passingTests = [
// 'node built/cli.js spec/suitesConf.js --suite okspec',
// 'node built/cli.js spec/suitesConf.js --suite okmany,okspec',
// 'node built/cli.js spec/plugins/smokeConf.js',
// 'node built/cli.js spec/plugins/multiPluginConf.js',
// 'node built/cli.js spec/plugins/jasminePostTestConf.js',
// 'node built/cli.js spec/plugins/mochaPostTestConf.js',
// 'node built/cli.js spec/plugins/browserGetSyncedConf.js',
// 'node built/cli.js spec/plugins/browserGetUnsyncedConf.js',
// 'node built/cli.js spec/plugins/waitForAngularConf.js',
'node built/cli.js spec/plugins/multiPluginConf.js',
'node built/cli.js spec/plugins/jasminePostTestConf.js',
'node built/cli.js spec/plugins/mochaPostTestConf.js',
'node built/cli.js spec/plugins/browserGetSyncedConf.js',
'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/restartBrowserBetweenTestsConf.js',
Expand Down
22 changes: 14 additions & 8 deletions spec/plugins/browserGetSyncedConf.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var env = require('../environment.js'),
q = require('q');
const env = require('../environment.js');

// Make sure that borwser-related plugin hooks work with browser sync on
exports.config = {
seleniumAddress: env.seleniumAddress,
SELENIUM_PROMISE_MANAGER: false,

framework: 'jasmine',

Expand All @@ -19,20 +19,26 @@ exports.config = {
// Plugin patterns are relative to this directory.
plugins: [{
inline: {
onPageLoad: function() {
return q.delay(5000).then(function() {
protractor.ON_PAGE_LOAD = true;
onPageLoad: async function() {
return await new Promise(resolve => {
setTimeout(() => {
protractor.ON_PAGE_LOAD = true;
resolve();
}, 5000);
});
},
onPageStable: function() {
onPageStable: async function() {
if (protractor.ON_PAGE_LOAD) {
this.addSuccess();
} else {
this.addFailure(
'onPageLoad did not finish before onPageStable began');
}
return q.delay(5000).then(function() {
protractor.ON_PAGE_SYNC = true;
return await new Promise(resolve => {
setTimeout(() => {
protractor.ON_PAGE_SYNC = true;
resolve();
}, 5000);
});
},
teardown: function() {
Expand Down
13 changes: 8 additions & 5 deletions spec/plugins/browserGetUnsyncedConf.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var env = require('../environment.js'),
q = require('q');
const env = require('../environment.js');

// Make sure that borwser-related plugin hooks work with browser sync off
exports.config = {
seleniumAddress: env.seleniumAddress,
SELENIUM_PROMISE_MANAGER: false,

framework: 'jasmine',

Expand All @@ -22,9 +22,12 @@ exports.config = {
setup: function() {
browser.ignoreSynchronization = true;
},
onPageLoad: function() {
return q.delay(5000).then(function() {
protractor.ON_PAGE_LOAD = true;
onPageLoad: async function() {
return await new Promise(resolve => {
setTimeout(() => {
protractor.ON_PAGE_LOAD = true;
resolve();
}, 5000);
});
},
onPageStable: function() {
Expand Down
1 change: 1 addition & 0 deletions spec/plugins/multiPluginConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var env = require('../environment.js');
// A small suite to make sure the full functionality of plugins work
exports.config = {
mockSelenium: true,
SELENIUM_PROMISE_MANAGER: false,

framework: 'jasmine',

Expand Down
3 changes: 2 additions & 1 deletion spec/plugins/postTestConfTemplate.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var env = require('../environment.js');

module.exports = function(framework) {
module.exports = (framework) => {
return {
mockSelenium: true,
SELENIUM_PROMISE_MANAGER: false,

framework: framework,

Expand Down
6 changes: 3 additions & 3 deletions spec/plugins/specs/bigger_spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
describe('check if plugin setup ran', function() {
it('should have set protractor.__BASIC_PLUGIN_RAN', function() {
describe('check if plugin setup ran', () => {
it('should have set protractor.__BASIC_PLUGIN_RAN', () => {
expect(protractor.__BASIC_PLUGIN_RAN_SETUP).toBe(true);
});

it('should have set protractor.__INLINE_PLUGIN_RAN', function() {
it('should have set protractor.__INLINE_PLUGIN_RAN', () => {
expect(protractor.__INLINE_PLUGIN_RAN).toBe(true);
});
});
8 changes: 4 additions & 4 deletions spec/plugins/specs/browser_get_wait_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('category', function() {
it('name', function() {
browser.get('index.html');
browser.waitForAngular();
describe('category', () => {
it('name', async() => {
await browser.get('index.html');
await browser.waitForAngular();
});
});
6 changes: 3 additions & 3 deletions spec/plugins/specs/fail_spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
describe('check if plugin setup ran', function() {
it('should have set protractor.__BASIC_PLUGIN_RAN', function() {
describe('check if plugin setup ran', () => {
it('should have set protractor.__BASIC_PLUGIN_RAN', () => {
expect(protractor.__BASIC_PLUGIN_RAN_SETUP).toBe(true);
});

it('should run multiple tests which fail', function() {
it('should run multiple tests which fail', () => {
expect(true).toBe(false);
});
});
4 changes: 2 additions & 2 deletions spec/plugins/specs/simple_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('category', function() {
it('name', function() {
describe('category', () => {
it('name', () => {
});
});
13 changes: 8 additions & 5 deletions spec/plugins/waitForAngularConf.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var env = require('../environment.js'),
q = require('q');
var env = require('../environment.js');

// A small suite to make sure that the plugin hooks for waitForAngular work
exports.config = {
seleniumAddress: env.seleniumAddress,
SELENIUM_PROMISE_MANAGER: false,

framework: 'jasmine',

Expand All @@ -19,9 +19,12 @@ exports.config = {
// Plugin patterns are relative to this directory.
plugins: [{
inline: {
waitForPromise: function(/* oldURL */) {
return q.delay(5000).then(function() {
protractor.WAIT_FOR_PROMISE = true;
waitForPromise: async function() {
return await new Promise(resolve => {
setTimeout(() => {
protractor.WAIT_FOR_PROMISE = true;
resolve();
}, 5000);
});
},
waitForCondition: function() {
Expand Down
28 changes: 7 additions & 21 deletions testapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.