re-enable upgrade-phonecat-2 tests
This commit is contained in:
parent
2b235fbe65
commit
cb3d3b34c4
|
@ -1,4 +1,4 @@
|
||||||
import { browser } from 'protractor';
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
export var appLang = {
|
export var appLang = {
|
||||||
appIsTs: false,
|
appIsTs: false,
|
||||||
|
@ -35,3 +35,13 @@ export function setProtractorToNg1Mode(): void {
|
||||||
|
|
||||||
// browser.addMockModule('disableNgAnimate', disableNgAnimate);
|
// 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.driver.wait(function() {
|
||||||
|
return element(by.css('.ng-scope')).isPresent();
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
'use strict'; // necessary for es6 output in node
|
'use strict'; // necessary for es6 output in node
|
||||||
|
|
||||||
import { browser, element, by } from 'protractor';
|
import { browser, element, by } from 'protractor';
|
||||||
import { setProtractorToNg1Mode } from '../protractor-helpers';
|
import { setProtractorToNg1Mode, waitForNg1AsyncBootstrap } from '../protractor-helpers';
|
||||||
|
|
||||||
describe('Upgrade Tests', function () {
|
describe('Upgrade Tests', function () {
|
||||||
|
|
||||||
// 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.
|
|
||||||
function waitForNg1AsyncBootstrap() {
|
|
||||||
browser.ignoreSynchronization = true;
|
|
||||||
browser.driver.wait(function() {
|
|
||||||
return element(by.css('.ng-scope')).isPresent();
|
|
||||||
}, 5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('NG1 Auto-bootstrap', function() {
|
describe('NG1 Auto-bootstrap', function() {
|
||||||
|
|
||||||
beforeAll(function () {
|
beforeAll(function () {
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
'use strict'; // necessary for es6 output in node
|
'use strict'; // necessary for es6 output in node
|
||||||
|
|
||||||
import { browser, element, by } from 'protractor';
|
import { browser, element, by } from 'protractor';
|
||||||
|
import { setProtractorToNg1Mode, waitForNg1AsyncBootstrap } from '../protractor-helpers';
|
||||||
|
|
||||||
// Angular E2E Testing Guide:
|
// Angular E2E Testing Guide:
|
||||||
// https://docs.angularjs.org/guide/e2e-testing
|
// https://docs.angularjs.org/guide/e2e-testing
|
||||||
|
|
||||||
describe('PhoneCat Application', function() {
|
describe('PhoneCat Application', function() {
|
||||||
|
|
||||||
beforeAll(function() {
|
|
||||||
setProtractorToNg1Mode();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should redirect `index.html` to `index.html#!/phones', function() {
|
it('should redirect `index.html` to `index.html#!/phones', function() {
|
||||||
browser.get('index.html');
|
browser.get('index.html');
|
||||||
|
setProtractorToNg1Mode();
|
||||||
|
waitForNg1AsyncBootstrap();
|
||||||
expect(browser.getLocationAbsUrl()).toBe('/phones');
|
expect(browser.getLocationAbsUrl()).toBe('/phones');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,6 +19,8 @@ describe('PhoneCat Application', function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
browser.get('index.html#!/phones');
|
browser.get('index.html#!/phones');
|
||||||
|
setProtractorToNg1Mode();
|
||||||
|
waitForNg1AsyncBootstrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should filter the phone list as a user types into the search box', function() {
|
it('should filter the phone list as a user types into the search box', function() {
|
||||||
|
@ -63,12 +64,12 @@ describe('PhoneCat Application', function() {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render phone specific links', function() {
|
fit('should render phone specific links', function() {
|
||||||
let query = element(by.css('input'));
|
let query = element(by.css('input'));
|
||||||
query.sendKeys('nexus');
|
query.sendKeys('nexus');
|
||||||
|
|
||||||
element.all(by.css('.phones li a')).first().click();
|
element.all(by.css('.phones li a')).first().click();
|
||||||
browser.refresh(); // Not sure why this is needed but it is. The route change works fine.
|
waitForNg1AsyncBootstrap(); // Not sure why this is needed but it is. The route change works fine.
|
||||||
expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s');
|
expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -78,6 +79,8 @@ describe('PhoneCat Application', function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
browser.get('index.html#!/phones/nexus-s');
|
browser.get('index.html#!/phones/nexus-s');
|
||||||
|
setProtractorToNg1Mode();
|
||||||
|
waitForNg1AsyncBootstrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display the `nexus-s` page', function() {
|
it('should display the `nexus-s` page', function() {
|
Loading…
Reference in New Issue