user3216983
user3216983

Reputation: 131

How to run protractor to validate CHROME on AWS

I'm building a SaaS solution using AngularJS / JBOSS, hosted on a AWS EC2 instance; all our functionality is covered by unit and e2e tests. All the tests run fine locally. We can't figure out how to run them on AWS. Our AWS installation includes a headless CHROME, installed according to these instructions:

Steps to Reproduce

  1. Set up chrome/firefox in linux based x86_64 EC2 instance
  2. Launch webdriver-manager start
  3. On a separate terminal window, launch protractor

Observed Behavior 1. The following error is shown on the webdriver terminal:

/usr/local/lib/node_modules/protractor/selenium/chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
06:41:15.140 WARN - Exception thrown

Expected Behavior 1. The protractor test is executed without errors

Additional resources: 1. Protractor configuration file

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',

    specs: ['../test/e2e/**/*.js'],

    // A base URL for your application under test. Calls to browser.get()
    // with relative paths will be prepended with this.
    baseUrl: 'http://localhost:8080/markodojo_solution/#/a3bc8692-5af4-4a4d-b21b-4e6f87dc2a32',

    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        showColors: true,
        isVerbose: true,
        defaultTimeoutInterval: 30000
    },

    //Options to output testreuslts in xml format
    onPrepare: function() {
    // The require statement must be down here, since jasmine-reporters
    // needs jasmine to be in the global and protractor does not guarantee
    // this until inside the onPrepare function.
    require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmine.JUnitXmlReporter('xmloutput', true, true));
  }
};

Thanks in advance for any assistance!

Upvotes: 8

Views: 2479

Answers (1)

bhantol
bhantol

Reputation: 9616

Go with Headless Chrome option

This greatly simplifies the workflow and having to use more system resources.

Follow the broad steps below:

  1. Chrome install. Assuming you already have Chrome installed there. However if not following steps to install Chrome on linux EC2
  2. Change your protractor options to something like below. The important thing is --headless. Additionally keep in mind that headless mode requires the browser size be specified upfront:-

      chromeOptions: {
         args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
       }
    

Upvotes: 1

Related Questions