add hybrid toggle switch to helpers

This commit is contained in:
Filipe Silva 2016-11-09 14:23:59 +00:00
parent cb3d3b34c4
commit 6e5b8a458f
2 changed files with 4 additions and 10 deletions

View File

@ -23,25 +23,18 @@ export function itIf(cond: boolean, name: string, func: (done: DoneFn) => void):
}
}
// TODO Jesus - figure out what's needed here for the new upgrade chapters
// Allow changing bootstrap mode to NG1 for upgrade tests
export function setProtractorToNg1Mode(): void {
browser.rootEl = 'body';
// let disableNgAnimate = function() {
// angular.module('disableNgAnimate', []).run(['$animate', function($animate: any) {
// $animate.enabled(false);
// }]);
// };
// browser.addMockModule('disableNgAnimate', disableNgAnimate);
}
// Protractor doesn't support the UpgradeAdapter's asynchronous
// bootstrap with Angular 1 at the moment. Get around it by
// waiting for an element to get `ng-scope` class.
export function waitForNg1AsyncBootstrap() {
browser.ignoreSynchronization = true;
browser.ng12Hybrid = true;
browser.driver.wait(function() {
return element(by.css('.ng-scope')).isPresent();
}, 5000);
// Use this instead when upgrading to protractor > 4.0.10
// browser.ng12Hybrid = true;
}

View File

@ -51,6 +51,7 @@ describe('Upgrade Tests', function () {
beforeAll(function () {
browser.get('/index-1-2-hybrid-shared-adapter-bootstrap.html');
setProtractorToNg1Mode();
waitForNg1AsyncBootstrap();
});
it('bootstraps as expected', function () {