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

fix(plugins): do not force ManagedPromise in plugins.ts #4036

Merged
merged 1 commit into from
Jan 31, 2017
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
1 change: 0 additions & 1 deletion lib/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,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);

Expand Down
10 changes: 8 additions & 2 deletions lib/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -456,8 +457,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);
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions spec/ts/noCF/plugin_spec.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});
29 changes: 29 additions & 0 deletions spec/ts/noCFPluginConf.ts
Original file line number Diff line number Diff line change
@@ -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
};