8
votes

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!

1
Just checking, but... did you install libgconf-2?Thomas Orozco
No I did not. I'll do it now and report back.user3216983
I was not able to install libconf-2, yum install ligcong-2 yields a no package available message. Someone suggested I try to install gconf2 but unfortunately I get the same error. I also tried all possible alternatives that came up from net searches, to no avail!user3216983
Hi.. stuck at the same point you were a year back :) Any pointers on how you proceeded? I'm getting the same error: /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 directoryPankaj Tandon

1 Answers

1
votes

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" ]
       }