Skip to content

Instantly share code, notes, and snippets.

@psatler
Last active June 5, 2020 21:39
Show Gist options
  • Save psatler/a3d0f6f4ce9efa8432bf5574c728819d to your computer and use it in GitHub Desktop.
Save psatler/a3d0f6f4ce9efa8432bf5574c728819d to your computer and use it in GitHub Desktop.
Basic configuration for using WebdriverIO along wtih Cucumber and Appium
  • I'm using Nodejs 12.16.1 both locally and on the AWS Device Farm.

  • Same thing goes to the Appium version. Both locally and on AWS, the version I'm using is 1.17.1

  • Regarding webdriverio, and as shown at this gist below, I'm using "webdriverio": "^6.1.7". This is installed on AWS Device Farm at the install phase by running npm install.

  • webdriverio shared configs

exports.config = {
    port: 4723,
    runner: 'local',
    baseUrl: 'http://localhost',
    path: '/wd/hub',
    specs: [
        './features/**/*.feature',
    ],
    logLevel: 'trace',
    bail: 0,
    waitforTimeout: 50000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    framework: 'cucumber',
    reporters: ['spec'],
    mochaOpts: {
        ui: 'bdd',
        timeout: 60000
    },
    // If you are using Cucumber you need to specify the location of your step definitions.
    // See also: https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-cucumber-framework#cucumberopts-options
    cucumberOpts: {
        require: [
            './steps/**/*.js',
        ],        // <string[]> (file/dir) require files before executing features
        backtrace: false,   // <boolean> show full backtrace for errors
        requireModule: [],  // <string[]> ("module") require MODULE files (repeatable)
        // requireModule: ['@babel/register'],
        dryRun: false,      // <boolean> invoke formatters without executing steps
        failFast: false,    // <boolean> abort the run on first failure
        format: ['pretty'], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
        snippets: true,     // <boolean> hide step definition snippets for pending steps
        source: true,       // <boolean> hide source uris
        profile: [],        // <string[]> (name) specify the profile to use
        strict: false,      // <boolean> fail if there are any undefined or pending steps
        tags: [],           // <string[]> (expression) only execute the features or scenarios with tags matching the expression
        timeout: 60000,     // <number> timeout for step definitions
        ignoreUndefinedDefinitions: false, // <boolean> Enable this config to treat undefined definitions as warnings.
    },
  };
  • config capabilities for AWS
const { config } = require('./wdio.shared.conf');

config.capabilities = [{
  maxInstances: 1,
}];

exports.config = config;
  • a piece of the package.json showing the dependencies I currently have for the project
{   
  ...
  
    "dependencies": {
    "@wdio/cli": "^6.1.11",
    "@wdio/cucumber-framework": "^6.1.8",
    "@wdio/local-runner": "^6.1.11",
    "@wdio/appium-service": "^6.1.0",
    "@wdio/spec-reporter": "^6.1.9",
    "@wdio/sync": "^6.1.8",
    "appium": "^1.17.1",
    "appium-doctor": "^1.15.1",
    "webdriverio": "^6.1.7",
    "glob": "^7.1.6"
  },
  "devDependencies": {
    "chromedriver": "^81.0.0",
    "npm-bundle": "^3.0.3",
    "npm-pack-zip": "^1.2.7",
    "wdio-chromedriver-service": "^6.0.3"
  },
  
  ...
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment