5
votes

I have a webpage that requires Google Authentication before proceeding to an angular web page, and I've built some very basic end-to-end tests, which work like a charm in Linux with Chrome Headless:

  1. Finds the username field
  2. Inputs the proper email address, and clicks next
  3. Enters the password to log in
  4. Once it passes Google Authentication, it verifies the title of the page is "Expense"

Here's the final message I get in the Terminal: Executed 3 of 3 specs SUCCESS in 46 secs.

In AWS CodeBuild, though, we are ALSO using a Linux (Ubuntu) container, and that fails every single time.
Here's the first error: ... Jasmine started

  1. Finding the username field
  2. Inputting the proper test email address

0 h1 tags identified Expense App E2E Initial Test Suite index page for Expense should work just fine

  • [31m✗ should sign in correctly with test user·[39m
  • [31m- ·[39m·[31mFailed: No element found using locator: By(css selector, *[id="identifierId"])
  • [39m at elementArrayFinder.getWebElements.then (/codebuild/output/src609592849/src/node_modules/protractor/built/element.js:814:27)

Here's the setup info in protractor.conf.js:

capabilities: {
'browserName': 'chrome',
chromeOptions: {
    args: ["--headless", "--disable-dev-shm-usage", "--no-sandbox", "--disable-gpu", "--window-size=1280x960"]
    }
},
directConnect: true,  // Test scripts communicate directly with Chrome Driver, so they start up and run faster

From the package.json, I'm using: "e2e": "ng e2e --port 4200",

From the buildspec-test.yml, I have the following post_build command: - npm run e2e

Why does Chrome Headless find my webpage on http://localhost:4200 without issue on my local Linux issue, but fails to find it in AWS CodeBuild when they BOTH run Ubuntu Linux? Local version: Ubuntu 18.04.1 LTS AWS CodeBuild version: Ubuntu Ubuntu 14.04.5 LTS (Trusty)

Please let me know, and thanks in advance!

Sincerely,

PW

1
I have the exact same issue. Using the same image to build a container locally and it works fine but on AWS CodeBuild, it takes a long time and errors out with "NoSuchElementError". Have you been able to resolve your issue?muzurB
I am facing exact the same issue, any resolution to that so far?vinicius.olifer
Anyone found any workable solution? It's frustrating really. My errors are basically Angular could not be found on the page which makes no sense since it's an SPA0CDc0d3r

1 Answers

1
votes

Yes, I do have this answer. A friend and coworker (Thanks, Bill T.) was able to create a Docker container with Ubuntu 18.04LTS, and let me run it within AWS CodeBuild, where it worked. This proved the issue: You cannot use headless chrome with the older Ubuntu 14.04.5 LTS. Start with nothing older than Ubuntu 18.04 LTS.