1

I'm brand new to Protractor and I'm having trouble running the tests of my app on Travis CI. It gives me this error:

[22:54:04] E/protractor - Could not find Angular on page http://localhost:4200/about : retries looking for angular exceeded
About ✗ should have correct feature heading - Failed: Error: Angular could not be found on the page http://localhost:4200/about.If this is not an Angular application, you may need to turn off waiting for Angular.

My test file contains

describe('About', () => {

  beforeEach(async () => {
    return await browser.get('/about');
  });

  it('should have correct feature heading', () => {
    expect(element(by.css('rio-about-page h2')).getText()).toEqual('ABOUT US');
  });

});

My travis.yml file contains this

script:
 - ng test --watch false
 - npm run prod:server &
 - npm run prod:client &
 - npm run e2e

and package.json contains

"prod:client": "ng serve --proxy-config proxy.conf.json",
"prod:server": "cross-env NODE_ENV=production PORT=3000 node server/node-server.js",
"e2e": "protractor",

It runs properly locally if I start up the app and api servers first. So it seems like the test just needs to wait until the api and app servers are ready, but I'm not sure how to make that happen.

I tried setting framework to "jasmine2" from this question, but it didn't work.

I also checked the encoding of my index.html file according to this question and it was fine.

I also locally tried changing the e2e command in travis.yml to

ng e2e --serve

This gave me the following warnings. The tests did not run and the process did not terminate

webpack: Compiled with warnings. (node:20625) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module 'protractor/node_modules/webdriver-manager/built/lib/cmds/update' from '/Users/Dan/work/bernierebuttals/gba' (node:20625) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Community
  • 1
  • 1
Dan Cancro
  • 1,401
  • 5
  • 24
  • 53
  • 1
    Take a look at https://github.com/angular/protractor/blob/master/docs/timeouts.md – Gunderson Feb 13 '17 at 18:44
  • @Gunderson That did it. Thanks!! I hadn't seen that setting used in any of the examples and my app didn't seem special but I guess its being bigger than the examples mattered. Besides that setting, do my travis.yml and package.json scripts look okay? I'm happy it's working now but it seems that `ng e2e` should work. – Dan Cancro Feb 13 '17 at 20:33
  • Glad it helped! Unfortunately I have no experience with Travis or Angular CLI, so I can't speak to that config =/ sorry – Gunderson Feb 14 '17 at 11:55

0 Answers0