cleanup upgrade-adapter e2e test

This commit is contained in:
Filipe Silva 2016-11-10 14:58:14 +00:00
parent 03d877dcee
commit c3b9cb3a03
2 changed files with 16 additions and 21 deletions

View File

@ -23,10 +23,20 @@ export function itIf(cond: boolean, name: string, func: (done: DoneFn) => void):
}
}
// protractor.config.js is set to ng2 mode by default, so we must manually
// change it for upgradeAdapter tests
export function setProtractorToNg1Mode(): void {
browser.rootEl = 'body';
}
export function setProtractorToHybridMode() {
setProtractorToNg1Mode();
browser.ng12Hybrid = true;
// remove once waitForNg1AsyncBootstrap() is removed as well
browser.ignoreSynchronization = false;
}
// TODO remove once all update adapter tests are moved to setProtractorToHybridMode
// 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.
@ -36,10 +46,3 @@ export function waitForNg1AsyncBootstrap() {
return element(by.css('.ng-scope')).isPresent();
}, 5000);
}
export function setProtractorToHybridMode() {
setProtractorToNg1Mode();
browser.ng12Hybrid = true;
// remove once waitForNg1AsyncBootstrap() is removed as well
browser.ignoreSynchronization = false;
}

View File

@ -1,15 +1,18 @@
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
import { setProtractorToNg1Mode, waitForNg1AsyncBootstrap, setProtractorToHybridMode } from '../protractor-helpers';
import { setProtractorToHybridMode } from '../protractor-helpers';
describe('Upgrade Tests', function () {
describe('NG1 Auto-bootstrap', function() {
beforeAll(function () {
// setProtractorToHybridMode();
});
fdescribe('NG1 Auto-bootstrap', function() {
beforeAll(function () {
browser.get('/index-ng-app.html');
setProtractorToNg1Mode();
});
it('bootstraps as expected', function () {
@ -22,8 +25,6 @@ describe('Upgrade Tests', function () {
beforeAll(function () {
browser.get('/index-bootstrap.html');
setProtractorToNg1Mode();
waitForNg1AsyncBootstrap();
});
it('bootstraps as expected', function () {
@ -35,7 +36,6 @@ describe('Upgrade Tests', function () {
describe('NG1-2 Hybrid Bootstrap', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-1-2-hybrid-bootstrap.html');
});
@ -48,7 +48,6 @@ describe('Upgrade Tests', function () {
describe('Upgraded static component', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-upgrade-static.html');
});
@ -62,7 +61,6 @@ describe('Upgrade Tests', function () {
describe('Upgraded component with IO', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-upgrade-io.html');
});
@ -81,7 +79,6 @@ describe('Upgrade Tests', function () {
describe('Downgraded static component', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-downgrade-static.html');
});
@ -94,7 +91,6 @@ describe('Upgrade Tests', function () {
describe('Downgraded component with IO', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-downgrade-io.html');
});
@ -117,7 +113,6 @@ describe('Upgrade Tests', function () {
describe('Downgraded component with content projection', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-1-to-2-projection.html');
});
@ -131,7 +126,6 @@ describe('Upgrade Tests', function () {
describe('Upgraded component with transclusion', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-2-to-1-transclusion.html');
});
@ -145,7 +139,6 @@ describe('Upgrade Tests', function () {
describe('Upgrading NG1 Providers', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-1-to-2-providers.html');
});
@ -159,7 +152,6 @@ describe('Upgrade Tests', function () {
describe('Downgrading NG2 Providers', function() {
beforeAll(function () {
setProtractorToHybridMode();
browser.get('/index-2-to-1-providers.html');
});