如何运行两个不同的wdio.config.js文件一个接一个
How to run two different wdio.config.js file one after another
我目前有两个配置不同的 wdio.config.js 文件。我怎么 运行 一个接一个?可能吗?
这就是我在代码中定义的方式:
第一个config.js
const { join } = require('path');
require('@babel/register')
exports.config = {
maxInstances: 3,
runner: 'local',
//
specs: [
'./tests/specs/**/*.spec.js'
],
//
exclude: [
// 'path/to/excluded/files'
],
//
//
baseUrl: 'http://localhost:9174/',
capabilities: {
chromeBrowser: {
capabilities: {
browserName: 'chrome'
}
},
App: {
port: 4723,
capabilities: {
platformName: 'iOS',
'appium:platformVersion': '12.4',
'appium:orientation': 'PORTRAIT',
'appium:noReset': true,
'appium:newCommandTimeout': 240,
"appium:platformName": "iOS",
"appium:deviceName": "iPhone 8",
"appium:bundleId": "com.app.debug",
}
},
},
services: ['appium'],
/* appium: {
args: {
address: '127.0.0.1',
}
}, */
//
//logLevel: 'trace',
//
//deprecationWarnings: true,
//
//bail: 0,
//
waitforTimeout: 20000,
//
//connectionRetryTimeout: 90000,
//
//connectionRetryCount: 3,
//
services: ['selenium-standalone'],
//
//framework: 'jasmine',
/* jasmineNodeOpts:
{
// Jasmine default timeout
defaultTimeoutInterval: 60000,
expectationResultHandler(passed, assertion)
{
// do something
}, */
//
//
}
秒config.js
const { join } = require('path');
require('@babel/register')
exports.config = {
runner: 'local',
//
specs: [
'./tests/specs/**/*.common.js'
],
//
exclude: [
// 'path/to/excluded/files'
],
//
//
capabilities: {
App: {
port: 4724,
capabilities: {
platformName: 'iOS',
'appium:platformVersion': '13.2',
'appium:orientation': 'PORTRAIT',
'appium:noReset': true,
'appium:newCommandTimeout': 240,
"appium:deviceName": "iPhone 11",
"appium:bundleId": "com.xyz.debug",
}
}
},
services: ['appium'],
/* appium: {
args: {
address: '127.0.0.1',
}
}, */
//
//logLevel: 'trace',
//
//deprecationWarnings: true,
//
//bail: 0,
//
waitforTimeout: 20000,
//
//connectionRetryTimeout: 90000,
//
//connectionRetryCount: 3,
//
services: ['selenium-standalone'],
//
//framework: 'jasmine',
/* jasmineNodeOpts:
{
// Jasmine default timeout
defaultTimeoutInterval: 60000,
expectationResultHandler(passed, assertion)
{
// do something
}, */
//
//
}
和我的 package.json 文件:
{
"type": "module",
"name": "appium-boilerplate",
"version": "5.3.1",
"description": "Run end to end tests with using the webapp and the mobile app",
"scripts": {
"android.sauce.rdc.app": "./node_modules/.bin/wdio ./config/saucelabs/wdio.android.rdc.app.conf.js",
"consumer.app": "./node_modules/.bin/wdio ./config/wdio.consumer.app.conf.js",
"android.browser": "./node_modules/.bin/wdio ./config/wdio.android.browser.conf.js",
"ios.app": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js",
"ios.sauce.rdc.app": "./node_modules/.bin/wdio ./config/saucelabs/wdio.ios.rdc.app.conf.js",
"ios.browser": "./node_modules/.bin/wdio ./wdio.conf.js",
"real.browser": "./node_modules/.bin/wdio ./config/wdio.browser.conf.js",
"lint": "eslint config tests",
"build": "babel --presets es2015 -d lib/ src"
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"esm": "^3.2.25"
},
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/preset-env": "^7.7.6",
"@babel/preset-react": "^7.7.4",
"@babel/register": "^7.7.4",
"@babel/traverse": "^7.5.5",
"@babel/types": "^7.5.5",
"@wdio/appium-service": "^5.12.1",
"@wdio/cli": "^5.12.4",
"@wdio/jasmine-framework": "^5.16.15",
"@wdio/local-runner": "^5.16.15",
"@wdio/mocha-framework": "^5.16.15",
"@wdio/sauce-service": "^5.12.1",
"@wdio/selenium-standalone-service": "5.6.4",
"@wdio/spec-reporter": "^5.16.11",
"@wdio/sync": "^5.16.15",
"appium": "^1.13.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.2",
"chromedriver": "^78.0.1",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-wdio": "^5.12.1",
"mocha": "^6.2.2",
"node-fetch": "^2.3.0",
"spectron": "^9.0.0",
"wdio-chromedriver-service": "^5.0.2",
"webdriverio": "^5.12.4"
}
}
我想 运行 第一个然后第二个用一个命令。我怎样才能做到这一点?
为两个配置文件创建单独的测试命令。然后在 package.json 中添加一个新脚本,两个测试命令都由 && 分隔。
(或)
使用 gulp 或 grunt 任务。
我遇到了同样的情况。我在这种情况下使用了 shell 脚本文件。
对于MAC和Linux:创建run.sh
文件,然后使用命令sh run.sh
#!/bin/bash
npm run android.sauce.rdc.app
npm run consumer.app
npm run ...
对于 Windows:创建 run.bat
文件,然后 运行 它。
npm run android.sauce.rdc.app
npm run consumer.app
npm run ...
我目前有两个配置不同的 wdio.config.js 文件。我怎么 运行 一个接一个?可能吗?
这就是我在代码中定义的方式:
第一个config.js
const { join } = require('path');
require('@babel/register')
exports.config = {
maxInstances: 3,
runner: 'local',
//
specs: [
'./tests/specs/**/*.spec.js'
],
//
exclude: [
// 'path/to/excluded/files'
],
//
//
baseUrl: 'http://localhost:9174/',
capabilities: {
chromeBrowser: {
capabilities: {
browserName: 'chrome'
}
},
App: {
port: 4723,
capabilities: {
platformName: 'iOS',
'appium:platformVersion': '12.4',
'appium:orientation': 'PORTRAIT',
'appium:noReset': true,
'appium:newCommandTimeout': 240,
"appium:platformName": "iOS",
"appium:deviceName": "iPhone 8",
"appium:bundleId": "com.app.debug",
}
},
},
services: ['appium'],
/* appium: {
args: {
address: '127.0.0.1',
}
}, */
//
//logLevel: 'trace',
//
//deprecationWarnings: true,
//
//bail: 0,
//
waitforTimeout: 20000,
//
//connectionRetryTimeout: 90000,
//
//connectionRetryCount: 3,
//
services: ['selenium-standalone'],
//
//framework: 'jasmine',
/* jasmineNodeOpts:
{
// Jasmine default timeout
defaultTimeoutInterval: 60000,
expectationResultHandler(passed, assertion)
{
// do something
}, */
//
//
}
秒config.js
const { join } = require('path');
require('@babel/register')
exports.config = {
runner: 'local',
//
specs: [
'./tests/specs/**/*.common.js'
],
//
exclude: [
// 'path/to/excluded/files'
],
//
//
capabilities: {
App: {
port: 4724,
capabilities: {
platformName: 'iOS',
'appium:platformVersion': '13.2',
'appium:orientation': 'PORTRAIT',
'appium:noReset': true,
'appium:newCommandTimeout': 240,
"appium:deviceName": "iPhone 11",
"appium:bundleId": "com.xyz.debug",
}
}
},
services: ['appium'],
/* appium: {
args: {
address: '127.0.0.1',
}
}, */
//
//logLevel: 'trace',
//
//deprecationWarnings: true,
//
//bail: 0,
//
waitforTimeout: 20000,
//
//connectionRetryTimeout: 90000,
//
//connectionRetryCount: 3,
//
services: ['selenium-standalone'],
//
//framework: 'jasmine',
/* jasmineNodeOpts:
{
// Jasmine default timeout
defaultTimeoutInterval: 60000,
expectationResultHandler(passed, assertion)
{
// do something
}, */
//
//
}
和我的 package.json 文件:
{
"type": "module",
"name": "appium-boilerplate",
"version": "5.3.1",
"description": "Run end to end tests with using the webapp and the mobile app",
"scripts": {
"android.sauce.rdc.app": "./node_modules/.bin/wdio ./config/saucelabs/wdio.android.rdc.app.conf.js",
"consumer.app": "./node_modules/.bin/wdio ./config/wdio.consumer.app.conf.js",
"android.browser": "./node_modules/.bin/wdio ./config/wdio.android.browser.conf.js",
"ios.app": "./node_modules/.bin/wdio ./config/wdio.ios.app.conf.js",
"ios.sauce.rdc.app": "./node_modules/.bin/wdio ./config/saucelabs/wdio.ios.rdc.app.conf.js",
"ios.browser": "./node_modules/.bin/wdio ./wdio.conf.js",
"real.browser": "./node_modules/.bin/wdio ./config/wdio.browser.conf.js",
"lint": "eslint config tests",
"build": "babel --presets es2015 -d lib/ src"
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"esm": "^3.2.25"
},
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/preset-env": "^7.7.6",
"@babel/preset-react": "^7.7.4",
"@babel/register": "^7.7.4",
"@babel/traverse": "^7.5.5",
"@babel/types": "^7.5.5",
"@wdio/appium-service": "^5.12.1",
"@wdio/cli": "^5.12.4",
"@wdio/jasmine-framework": "^5.16.15",
"@wdio/local-runner": "^5.16.15",
"@wdio/mocha-framework": "^5.16.15",
"@wdio/sauce-service": "^5.12.1",
"@wdio/selenium-standalone-service": "5.6.4",
"@wdio/spec-reporter": "^5.16.11",
"@wdio/sync": "^5.16.15",
"appium": "^1.13.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.2",
"chromedriver": "^78.0.1",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-wdio": "^5.12.1",
"mocha": "^6.2.2",
"node-fetch": "^2.3.0",
"spectron": "^9.0.0",
"wdio-chromedriver-service": "^5.0.2",
"webdriverio": "^5.12.4"
}
}
我想 运行 第一个然后第二个用一个命令。我怎样才能做到这一点?
为两个配置文件创建单独的测试命令。然后在 package.json 中添加一个新脚本,两个测试命令都由 && 分隔。
(或)
使用 gulp 或 grunt 任务。
我遇到了同样的情况。我在这种情况下使用了 shell 脚本文件。
对于MAC和Linux:创建run.sh
文件,然后使用命令sh run.sh
#!/bin/bash
npm run android.sauce.rdc.app
npm run consumer.app
npm run ...
对于 Windows:创建 run.bat
文件,然后 运行 它。
npm run android.sauce.rdc.app
npm run consumer.app
npm run ...