如何在AWS上运行量角器来验证CHROME

use*_*983 8 google-chrome amazon-ec2 angularjs selenium-webdriver protractor

我正在使用AngularJS/JBOSS构建SaaS解决方案,该解决方案托管在AWS EC2实例上; 我们所有的功能都包含在单元和e2e测试中.所有测试都在本地运行良好.我们无法弄清楚如何在AWS上运行它们.我们的AWS安装包括无头CHROME,根据以下说明安装:

重现步骤

  1. 在基于linux的x86_64 EC2实例中设置chrome/firefox
  2. 启动webdriver-manager启动
  3. 在单独的终端窗口上,启动量角器

观察到的行为 1. webdriver终端上显示以下错误:

/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
Run Code Online (Sandbox Code Playgroud)

预期行为 1.量角器测试执行无误

其他资源:1.量角器配置文件

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));
  }
};
Run Code Online (Sandbox Code Playgroud)

在此先感谢您的帮助!

bha*_*tol 1

使用无头 Chrome 选项

这极大地简化了工作流程并且不必使用更多的系统资源。

请遵循以下主要步骤:

  1. Chrome 安装。假设你已经安装了 Chrome。但是,如果不按照步骤在 Linux EC2 上安装 Chrome
  2. 将量角器选项更改为如下所示。重要的是--headless。另外请记住,无头模式需要预先指定浏览器大小:-

      chromeOptions: {
         args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
       }
    
    Run Code Online (Sandbox Code Playgroud)