Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit cb3d3b3

Browse files
committed
re-enable upgrade-phonecat-2 tests
1 parent 2b235fb commit cb3d3b3

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

public/docs/_examples/protractor-helpers.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { browser } from 'protractor';
1+
import { browser, element, by } from 'protractor';
22

33
export var appLang = {
44
appIsTs: false,
@@ -35,3 +35,13 @@ export function setProtractorToNg1Mode(): void {
3535

3636
// browser.addMockModule('disableNgAnimate', disableNgAnimate);
3737
}
38+
39+
// Protractor doesn't support the UpgradeAdapter's asynchronous
40+
// bootstrap with Angular 1 at the moment. Get around it by
41+
// waiting for an element to get `ng-scope` class.
42+
export function waitForNg1AsyncBootstrap() {
43+
browser.ignoreSynchronization = true;
44+
browser.driver.wait(function() {
45+
return element(by.css('.ng-scope')).isPresent();
46+
}, 5000);
47+
}

public/docs/_examples/upgrade-adapter/e2e-spec.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
'use strict'; // necessary for es6 output in node
22

33
import { browser, element, by } from 'protractor';
4-
import { setProtractorToNg1Mode } from '../protractor-helpers';
4+
import { setProtractorToNg1Mode, waitForNg1AsyncBootstrap } from '../protractor-helpers';
55

66
describe('Upgrade Tests', function () {
77

8-
// Protractor doesn't support the UpgradeAdapter's asynchronous
9-
// bootstrap with Angular 1 at the moment. Get around it by
10-
// waiting for an element to get `ng-scope` class.
11-
function waitForNg1AsyncBootstrap() {
12-
browser.ignoreSynchronization = true;
13-
browser.driver.wait(function() {
14-
return element(by.css('.ng-scope')).isPresent();
15-
}, 5000);
16-
}
17-
188
describe('NG1 Auto-bootstrap', function() {
199

2010
beforeAll(function () {

public/docs/_examples/upgrade-phonecat-2-hybrid/e2e-spec.ts.disabled renamed to public/docs/_examples/upgrade-phonecat-2-hybrid/e2e-spec.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
'use strict'; // necessary for es6 output in node
1+
'use strict'; // necessary for es6 output in node
22

33
import { browser, element, by } from 'protractor';
4+
import { setProtractorToNg1Mode, waitForNg1AsyncBootstrap } from '../protractor-helpers';
45

56
// Angular E2E Testing Guide:
67
// https://docs.angularjs.org/guide/e2e-testing
78

89
describe('PhoneCat Application', function() {
910

10-
beforeAll(function() {
11-
setProtractorToNg1Mode();
12-
});
13-
1411
it('should redirect `index.html` to `index.html#!/phones', function() {
1512
browser.get('index.html');
13+
setProtractorToNg1Mode();
14+
waitForNg1AsyncBootstrap();
1615
expect(browser.getLocationAbsUrl()).toBe('/phones');
1716
});
1817

1918
describe('View: Phone list', function() {
2019

2120
beforeEach(function() {
2221
browser.get('index.html#!/phones');
22+
setProtractorToNg1Mode();
23+
waitForNg1AsyncBootstrap();
2324
});
2425

2526
it('should filter the phone list as a user types into the search box', function() {
@@ -63,12 +64,12 @@ describe('PhoneCat Application', function() {
6364
]);
6465
});
6566

66-
it('should render phone specific links', function() {
67+
fit('should render phone specific links', function() {
6768
let query = element(by.css('input'));
6869
query.sendKeys('nexus');
6970

7071
element.all(by.css('.phones li a')).first().click();
71-
browser.refresh(); // Not sure why this is needed but it is. The route change works fine.
72+
waitForNg1AsyncBootstrap(); // Not sure why this is needed but it is. The route change works fine.
7273
expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s');
7374
});
7475

@@ -78,6 +79,8 @@ describe('PhoneCat Application', function() {
7879

7980
beforeEach(function() {
8081
browser.get('index.html#!/phones/nexus-s');
82+
setProtractorToNg1Mode();
83+
waitForNg1AsyncBootstrap();
8184
});
8285

8386
it('should display the `nexus-s` page', function() {

0 commit comments

Comments
 (0)