diff --git a/lib/browser.ts b/lib/browser.ts index 65293e1eb..27d65fab0 100644 --- a/lib/browser.ts +++ b/lib/browser.ts @@ -359,7 +359,6 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver { this.ignoreSynchronization = false; this.getPageTimeout = DEFAULT_GET_PAGE_TIMEOUT; this.params = {}; - this.plugins_ = new Plugins({}); this.resetUrl = DEFAULT_RESET_URL; this.debugHelper = new DebugHelper(this); diff --git a/lib/plugins.ts b/lib/plugins.ts index 472cc001f..67a5b155a 100644 --- a/lib/plugins.ts +++ b/lib/plugins.ts @@ -4,6 +4,7 @@ import * as webdriver from 'selenium-webdriver'; import {Config} from './config'; import {ConfigParser} from './configParser'; import {Logger} from './logger'; +import {protractor} from './ptor'; let logger = new Logger('plugins'); @@ -457,8 +458,13 @@ export class Plugins { logError(e); } }; - return promiseType == PromiseType.Q ? q.Promise(resolver) : - new webdriver.promise.Promise(resolver); + if (promiseType == PromiseType.Q) { + return q.Promise(resolver); + } else if (protractor.browser.controlFlowIsEnabled()) { + return new webdriver.promise.Promise(resolver); + } else { + return new Promise(resolver); + } } /** diff --git a/scripts/test.js b/scripts/test.js index d5c458e81..ce0fc84d5 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -39,6 +39,7 @@ var passingTests = [ 'node built/cli.js spec/angular2Conf.js', 'node built/cli.js spec/hybridConf.js', 'node built/cli.js spec/built/noCFSmokeConf.js', + 'node built/cli.js spec/built/noCFPluginConf.js', 'node scripts/driverProviderAttachSession.js', 'node scripts/errorTest.js', // Interactive Element Explorer tasks diff --git a/spec/ts/noCF/plugin_spec.ts b/spec/ts/noCF/plugin_spec.ts new file mode 100644 index 000000000..f9367b8e2 --- /dev/null +++ b/spec/ts/noCF/plugin_spec.ts @@ -0,0 +1,8 @@ +import {browser, protractor} from '../../..'; + +describe('category', function() { + it('name', async function() { + await browser.get('index.html'); + await expect((protractor as any).ON_PAGE_LOAD).toBe(true); + }); +}); diff --git a/spec/ts/noCFPluginConf.ts b/spec/ts/noCFPluginConf.ts new file mode 100644 index 000000000..80ae08e24 --- /dev/null +++ b/spec/ts/noCFPluginConf.ts @@ -0,0 +1,29 @@ +import * as q from 'q'; +import {Config, protractor} from '../..'; +const env = require('../environment.js'); + +export let config: Config = { + seleniumAddress: env.seleniumAddress, + + framework: 'jasmine', + + specs: [ + 'noCF/plugin_spec.js' + ], + + capabilities: env.capabilities, + + baseUrl: env.baseUrl + '/ng1/', + + plugins: [{ + inline: { + onPageLoad: function() { + return q.delay(100).then(function() { + (protractor as any).ON_PAGE_LOAD = true; + }); + } + } + }], + + SELENIUM_PROMISE_MANAGER: false +};