Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 925
user3216983 Avatar asked Mar 07 '14 19:03

user3216983


People also ask

How do you run a protractor test in multiple browsers?

Testing Against Multiple Browsers If you would like to test against multiple browsers, use the multiCapabilities configuration option. Protractor will run tests in parallel against each set of capabilities. Please note that if multiCapabilities is defined, the runner will ignore the capabilities configuration.

What is protractor Conf JS?

Protractor is an end-to-end testing framework for AngularJS applications and works as a solution integrator — combining powerful tools and technologies such as NodeJS, Selenium, web driver, Jasmine, Cucumber and Mocha. It has a bunch of customizations from Selenium to easily create tests for AngularJS applications.


1 Answers

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" ]
       }
    
like image 190
bhantol Avatar answered Nov 15 '22 00:11

bhantol