如何在Cloud Builders中成功运行Protractor e2e测试?

时间:2019-06-11 04:23:37

标签: selenium docker google-cloud-platform protractor continuous-integration

我正在为Angular中的项目设置CI。我们正在使用Google Cloud Platform的Cloud Builder for CI。一切进展顺利,我们可以设置环境,通过npm安装软件包,使用angular-cli构建项目并进行部署。但是问题在于,我们在量角器中的测试用例(e2e)不断出错。我们在这里想念什么?

这是针对使用Google Cloud Builders进行持续集成的情况,我们以无头模式运行量角器,并使用the的铬作为铬的二进制路径

这是我的protractor.conf.js

// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');
const puppeteer = require('puppeteer');
process.env.CHROME_BIN = puppeteer.executablePath()

exports.config = {
  allScriptsTimeout: 1000000,
  specs: [
    './e2e/*.e2e-spec.ts',
    '../e2e/*.e2e-spec.ts'
  ],

  capabilities: {
    // browserName: 'chrome',
    browserName: 'chrome',
    chromeOptions: {
      binary: process.env.CHROME_BIN,
      args: ['--headless', '--disable-gpu', '--no-sandbox', '--disable-extensions', '--disable-dev-shm-usage', '--disable-setuid-sandbox']
    }
  },
  // seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
  // ignoreUncaughtExceptions: true,
  directConnect: true,
  },
};

这是我们在云构建器中遇到的错误

[11:24:12] E/launcher - unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /workspace/node_modules/puppeteer/.local-chromium/linux-662092/chrome-linux/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.44.609551 (5d576e9a44fe4c5b6a07e568f1ebc753f1214634),platform=Linux 4.15.0-1033-gcp x86_64)
[11:24:12] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /workspace/node_modules/puppeteer/.local-chromium/linux-662092/chrome-linux/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

0 个答案:

没有答案