Общий конфиг
const { generate } = require('multiple-cucumber-html-reporter');
const { removeSync } = require('fs-extra');
exports.config = {
// ====================
// Runner and framework
// Configuration
// ====================
runner: 'local',
framework: 'cucumber',
sync: false,
logLevel: 'trace',
deprecationWarnings: true,
outputDir: './test-report/output',
bail: 0,
baseUrl: 'http://the-internet.herokuapp.com',
waitforTimeout: 6000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
specs: ['tests/features/**/*.feature'],
reporters: [
'spec',
[
'cucumberjs-json',
{
jsonFolder: '.tmp/json/',
language: 'en',
},
],
],
cucumberOpts: {
requireModule: ['@babel/register'],
backtrace: false,
compiler: [],
dryRun: false,
failFast: false,
format: ['pretty'],
colors: true,
snippets: true,
source: true,
profile: [],
strict: false,
tags: [],
timeout: 100000,
ignoreUndefinedDefinitions: false,
tagExpression: 'not @skip',
},
// ====================
// Appium Configuration
// ====================
services: ['appium'],
appium: {
// For options see
// https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-appium-service
// If you need a logs from appium server, make log equal true.
log: false,
args: {
// For arguments see
// https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-appium-service
},
command: 'appium',
},
port: 4723,
// ====================
// Some hooks
// ====================
/**
* Gets executed once before all workers get launched.
* @param {Object} config wdio configuration object
* @param {Array.<Object>} capabilities list of capabilities details
*/
onPrepare: function() {
// Remove the `.tmp/` folder that holds the json and report files
removeSync('.tmp/');
},
/**
* Gets executed after all workers have shut down and the process is about to exit.
* An error thrown in the `onComplete` hook will result in the test run failing.
* @param {Object} exitCode 0 - success, 1 - fail
* @param {Object} config wdio configuration object
* @param {Array.<Object>} capabilities list of capabilities details
* @param {<Object>} results object containing test results
*/
onComplete: () => {
// Generate the report when it all tests are done
generate({
// Required
// This part needs to be the same path where you store the JSON files
// default = '.tmp/json/'
jsonDir: '.tmp/json/',
reportPath: '.tmp/report/',
saveCollectedJSON: true,
});
},
//This code is responsible for taking the screenshot in case of error and attaching it to the report
afterStep(uri, feature, scenario) {
if (scenario.error) {
driver.takeScreenshot();
}
},
afterScenario() {
driver.reset();
},
afterSession() {
driver.closeApp();
},
};
iOS SL config (я ставлю звезды к ключам API в целях конфиденциальности):
const { config } = require('../wdio.shared.conf');
// ============
// Specs
// ============
config.cucumberOpts.require = ['./tests/steps/**/app*.steps.js'];
// ============
// Capabilities
// ============
config.capabilities = [
{
deviceName: 'iPhone XR',
// The reference to the app
testobject_app_id: '1',
testobject_api_key: '00768686F013470CB81060**********',
// The name of the test for in the cloud
testobject_test_name: 'IOS run',
// Some default settings
platformName: 'iOS',
idleTimeout: 180,
maxInstances: 6,
// testobject_cache_device: true,
noReset: true,
orientation: 'PORTRAIT',
newCommandTimeout: 180,
phoneOnly: true,
tabletOnly: false,
autoWebview: true
},
];
// =========================
// Sauce RDC specific config
// =========================
config.services = ['sauce'];
config.region = 'eu';
// This port was defined in the `wdio.shared.conf.js`
delete config.port;
exports.config = config;
Android SL config:
const { config } = require('../wdio.shared.conf');
// ============
// Specs
// ============
config.cucumberOpts.require = ['./tests/steps/**/app*.steps.js'];
// ============
// Capabilities
// ============
config.capabilities = [
{
deviceName: 'Samsung Galaxy S9',
// The reference to the app
testobject_app_id: '1',
testobject_api_key: '42724CEF3061453C9F45B1**********',
// The name of the test for in the cloud
testobject_test_name: 'Android run',
// Some default settings
platformName: 'Android',
idleTimeout: 180,
maxInstances: 6,
testobject_cache_device: true,
noReset: true,
orientation: 'PORTRAIT',
newCommandTimeout: 180,
phoneOnly: true,
tabletOnly: false,
autoWebview: true
},
];
// =========================
// Sauce RDC specific config
// =========================
config.services = ['sauce'];
config.region = 'eu';
// This port was defined in the `wdio.shared.conf.js`
delete config.port;
exports.config = config;