如何一个接一个地运行两个不同的wdio.config.js文件 [英] How to run two different wdio.config.js file one after another

查看:132
本文介绍了如何一个接一个地运行两个不同的wdio.config.js文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有两个具有不同配置的wdio.config.js文件.我怎样才能同时运行两个?有可能吗?

I currently have two wdio.config.js files with different configurations. How can i run both one after another? Is it possible?

这就是我在代码中定义的方式:

This is how I am defining in the code:

第一个config.js

first 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

second 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文件:

and my package.json file:

{
  "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"
  }
}

我想用一个命令运行第一个,然后运行第二个.我该如何实现?

I would like to run the first one then the second one with one command. How can i achieve that?

推荐答案

为两个配置文件创建单独的测试命令.然后在package.json中添加一个新脚本,将两个测试命令都用&& ;.分隔.

Create individual test command for both config files. Then add a new script in package.json having both the test commands separated by &&.

https://stackoverflow.com/a/53809731/8903949

(或)

使用gulp或grunt任务.

Use gulp or grunt task.

这篇关于如何一个接一个地运行两个不同的wdio.config.js文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆