问题描述
我试图在CircleCI上使用Cucumber框架运行webdriverIO测试,但是在执行测试命令时遇到了问题-
这是我正在使用的circleCI config.yml-
version: 2.1
jobs:
build:
docker:
- image: circleci/node:10-browsers
working_directory: ~/project
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: "Install dependencies"
command: |
npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: "Run tests"
command: |
npm run test
- store_test_results:
path: ./allure-results
这是我的wdio.conf.js-
exports.config = {
//
// ====================
// Runner Configuration
// ====================
//
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
// on a remote machine).
runner: 'local',hostname: 'localhost',port: 4444,specs: [
'./features/**/*.feature'
],// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],maxInstances: 10,capabilities: [{
maxInstances: 5,browserName: 'chrome',acceptInsecureCerts: true
}],logLevel: 'info',bail: 0,baseUrl: 'http://localhost',waitforTimeout: 10000,connectionRetryTimeout: 120000,connectionRetryCount: 3,services: ['selenium-standalone'],capabilities: [{
maxInstances: 5,}],args: {
drivers: {
chrome: { version: '83.0.4103' },}
},framework: 'cucumber',reporters: ['spec','allure'],reporterOptions: {
allure: {
outputDir: './reports/allure-results'
}
},cucumberOpts: {
require: ['./features/step-definitions/steps.js'],backtrace: false,requireModule: ['@babel/register'],dryRun: false,failFast: false,
格式器输出(可重复)
格式:['pretty'],
//隐藏步骤定义片段以供未决步骤使用
片段:是的,
//隐藏源uri
资料来源:是的,
//
}
This is the stack trace of the error I am getting in circleCi-
[0-2] 2020-08-27T14:09:27.770Z ERROR webdriver: session not created: session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59',revision: 'e82be7d358',time: '2018-11-14T08:25:53'
System info: host: 'f5e174502751',ip: '172.19.0.3',os.name: 'Linux',os.arch: 'amd64',os.version: '4.15.0-1077-aws',java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>
at getErrorFromResponseBody (/home/circleci/project/node_modules/webdriver/build/utils.js:121:10)
at WebDriverRequest._request (/home/circleci/project/node_modules/webdriver/build/request.js:149:56)
at process._tickCallback (internal/process/next_tick.js:68:7)
[0-2] 2020-08-27T14:09:27.770Z ERROR @wdio/runner: Error: Failed to create session.
session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59',java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>
at startWebDriverSession (/home/circleci/project/node_modules/webdriver/build/utils.js:45:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
[0-2] Error: Failed to create session.
session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59',java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>
解决方法
这是WebdriverIO用于下载正确版本的Chromedriver的依赖关系的最新回归。 WebdriverIO问题为here。
该问题中建议的一种临时解决方法是告诉selenium-service在wdio配置中使用特定版本的Chromedriver:
services: [
[
"selenium-standalone",{
logPath: "logs",installArgs: {
version: "3.141.5",baseURL: "https://selenium-release.storage.googleapis.com",drivers: {
chrome: {
version: "85.0.4183.83",arch: process.arch,baseURL: "https://chromedriver.storage.googleapis.com",},args: {
version: "3.141.5",],
,
我建议在Chrome浏览器中使用预构建的图像,或者查看它是如何在Dockerfile中构建的,例如https://hub.docker.com/r/atools/chrome-headless
这是一个示例存储库,您可以在其中查看通过https://github.com/mgrybyk/wdio-jasmine-boilerplate管道的测试