Issue with angualr e2e testing

When i do a static page test like for the login page’s heading the testing is good.
But when i when i so testing for actions or pages which needs api response, it is giving out errors.

When i check it on my local machine its all good, all test get passed.
I have even enabled cors for http://localhost:49152, http://localhost:8000 and http://localhost:8000/api

The api is made with laravel.

I have checked there is:

  • no issue with api
  • no issue with webdriver
  • no issue with environments

Versions

  • node.js version to 8.2.0
  • php version to 7.1.6
  • Google Chrome 62.0.3202.94
  • chromedriver_2.33
  • geckodriver-v0.19.1
  • Laravel version 5.5
webpack: Compiled successfully.
[09:14:50] I/update - chromedriver: file exists /home/ubuntu/app.site.com/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.33.zip
[09:14:50] I/update - chromedriver: unzipping chromedriver_2.33.zip
[09:14:50] I/update - chromedriver: setting permissions to 0755 for /home/ubuntu/app.site.com/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.33
[09:14:50] I/update - chromedriver: chromedriver_2.33 up to date
[09:14:50] I/launcher - Running 1 instances of WebDriver
[09:14:50] I/direct - Using ChromeDriver directly...
Jasmine started

  frontend App
    ✓ should render login page
    ✗ test title
      - Failed: No element found using locator: By(css selector, main article h1)
          at elementArrayFinder.getWebElements.then (/home/ubuntu/app.site.com/node_modules/protractor/built/element.js:814:27)
          at ManagedPromise.invokeCallback_ (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:1376:14)
          at TaskQueue.execute_ (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:3084:14)
          at TaskQueue.executeNext_ (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:3067:27)
          at asyncRun (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:2927:27)
          at /home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:668:7
          at <anonymous>
          at process._tickCallback (internal/process/next_tick.js:188:7)Error
          at ElementArrayFinder.applyAction_ (/home/ubuntu/app.site.com/node_modules/protractor/built/element.js:459:27)
          at ElementArrayFinder.(anonymous function).args [as getText] (/home/ubuntu/app.site.com/node_modules/protractor/built/element.js:91:29)
          at ElementFinder.(anonymous function).args [as getText] (/home/ubuntu/app.site.com/node_modules/protractor/built/element.js:831:22)
          at DiplomaPage.getHeading (/home/ubuntu/app.site.com/e2e/diploma.po.ts:17:47)
          at UserContext.it (/home/ubuntu/app.site.com/e2e/app.e2e-spec.ts:47:25)
          at /home/ubuntu/app.site.com/node_modules/jasminewd2/index.js:112:25
          at new ManagedPromise (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:1077:7)
          at ControlFlow.promise (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:2505:12)
          at schedulerExecute (/home/ubuntu/app.site.com/node_modules/jasminewd2/index.js:95:18)
          at TaskQueue.execute_ (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:3084:14)
          at TaskQueue.executeNext_ (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:3067:27)
          at asyncRun (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:2974:25)
          at /home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:668:7
          at <anonymous>
          at process._tickCallback (internal/process/next_tick.js:188:7)
      From: Task: Run it("test title") in control flow
          at UserContext.<anonymous> (/home/ubuntu/app.site.com/node_modules/jasminewd2/index.js:94:19)
          at /home/ubuntu/app.site.com/node_modules/jasminewd2/index.js:64:48
          at ControlFlow.emit (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/events.js:62:21)
          at ControlFlow.shutdown_ (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:2674:10)
          at shutdownTask_.MicroTask (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:2599:53)
          at MicroTask.asyncRun (/home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:2728:9)
          at /home/ubuntu/app.site.com/node_modules/selenium-webdriver/lib/promise.js:668:7
          at <anonymous>
          at process._tickCallback (internal/process/next_tick.js:188:7)
      From asynchronous test: 
      Error
          at Suite.describe (/home/ubuntu/app.site.com/e2e/app.e2e-spec.ts:45:3)
          at Object.<anonymous> (/home/ubuntu/app.site.com/e2e/app.e2e-spec.ts:6:1)
          at Module._compile (module.js:569:30)
          at Module.m._compile (/home/ubuntu/app.site.com/node_modules/ts-node/src/index.ts:392:23)
          at Module._extensions..js (module.js:580:10)
          at Object.require.extensions.(anonymous function) [as .ts] (/home/ubuntu/app.site.com/node_modules/ts-node/src/index.ts:395:12)
          at Module.load (/home/ubuntu/app.site.com/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
          at tryModuleLoad (module.js:466:12)
          at Function.Module._load (module.js:458:3)
          at Module.require (module.js:513:17)
          at require (internal/module.js:11:18)
          at Array.forEach (native)
          at Function.promise (/home/ubuntu/app.site.com/node_modules/protractor/node_modules/q/q.js:682:9)
          at _fulfilled (/home/ubuntu/app.site.com/node_modules/protractor/node_modules/q/q.js:834:54)
          at self.promiseDispatch.done (/home/ubuntu/app.site.com/node_modules/protractor/node_modules/q/q.js:863:30)
          at Promise.promise.promiseDispatch (/home/ubuntu/app.site.com/node_modules/protractor/node_modules/q/q.js:796:13)
          at /home/ubuntu/app.site.com/node_modules/protractor/node_modules/q/q.js:556:49
          at runSingle (/home/ubuntu/app.site.com/node_modules/protractor/node_modules/q/q.js:137:13)
          at flush (/home/ubuntu/app.site.com/node_modules/protractor/node_modules/q/q.js:125:13)
          at _combinedTickCallback (internal/process/next_tick.js:131:7)
          at process._tickCallback (internal/process/next_tick.js:180:9)

**************************************************
*                    Failures                    *
**************************************************

1) frontend App test title
  - Failed: No element found using locator: By(css selector, main article h1)

Executed 2 of 2 specs (1 FAILED) in 10 secs.
[09:15:02] I/launcher - 0 instance(s) of WebDriver still running
[09:15:02] I/launcher - chrome #01 failed 1 test(s)
[09:15:02] I/launcher - overall: 1 failed spec(s)
[09:15:02] E/launcher - Process exited with error code 1

ng e2e --environment=test returned exit code 1

I have found that the e2e testing in circle is not getting api responses but it is getting response while running in localhost

Hello ds-manish,
I’m facing the same problem on my project. end-to-end tests pass on localhost, using an API, but they fail on CircleCI. Did you manage to make them work ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.