tlc-core-automation-framework-v3-wdio-v9
Version:
Background: - We are following multi-layer automation framework architecture using webdriver.io + cucumber + typescript This core framework has been implemented with generic utility functions and cucumber steps, which can be easily consumed by another fra
286 lines • 17 kB
JavaScript
;
// import type {Options} from "@wdio/types";
// import dotenv from "dotenv";
// import {browserHelper} from "./src/e2e/helpers/common-helpers/browser-helper";
// import logger from "./src/e2e/helpers/reporting-helpers/logger";
//
// const chromeOptions = [];
//
// if (process.env.GITLAB) {
// chromeOptions.push('--headless');
// chromeOptions.push('--disable-dev-shm-usage');
// }
//
// // see https://webdriver.io/docs/selenium-standalone-service/
// const drivers = {
// // see https://chromedriver.storage.googleapis.com/ for versions
// chrome: {version: '106.0.5249.61'}
// // chrome: {version: '103.0.5060.134'}
// // chrome: {version: '105.0.5195.19'}
// }
//
// const setupDeviceEmulation = () => {
// const tags = process.env.PLATFORM_TAG || "@desktop";
// const isMobile = tags.includes('@mobile');
// const isTablet = tags.includes('@tablet');
// const isDesktop = tags.includes('@desktop');
// logger.info(`Running tests on : ${tags.split('@')[1]}`)
// if (isMobile) {
// return {'deviceName': 'iPhone XR'}
// } else if (isTablet) {
// return {'deviceName': 'iPad Air'}
// } else if (isDesktop) {
// return undefined;
// }
// };
//
// export const config: Options.Testrunner = {
// autoCompileOpts: {
// autoCompile: true,
// // see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
// // for all available options
// tsNodeOpts: {
// transpileOnly: true,
// project: 'tsconfig.json'
// }
// },
// specs: [
// './src/features/**/*.feature'
// ],
// // Patterns to exclude.
// exclude: [
// // 'path/to/excluded/files'
// ],
// maxInstances: 10,
// capabilities: [{
// maxInstances: 3,
// //
// browserName: 'chrome',
// acceptInsecureCerts: true,
// acceptSslCerts: true,
// 'goog:chromeOptions': {
// args: [
// '--no-sandbox',
// '--disable-dev-shm-usage',
// '--window-size=1920,1080',
// '--ignore-certificate-errors'
// ].concat(chromeOptions),
// mobileEmulation: setupDeviceEmulation(),
// prefs: {
// 'profile.default_content_setting_values.geolocation': false,
// 'profile.password_manager_enabled': false,
// 'credentials_enable_service': false,
// 'password_manager_enabled': false
// }
// }
// }],
//
// logLevel: 'silent',
// bail: 0,
// baseUrl: 'https://the-internet.herokuapp.com',
// pageId: "",
// waitforTimeout: 60000,
// connectionRetryTimeout: 120000,
// connectionRetryCount: 3,
// services: [
// ['selenium-standalone', {
// logPath: 'logs',
// installArgs: {drivers},
// args: {drivers}
// }], 'devtools'
// ],
//
// framework: 'cucumber',
// reporters: ['spec'],
//
// cucumberOpts: {
// // <string[]> (file/dir) require files before executing features
// require: ['./src/e2e/step-definitions/**/*.ts'],
// // <boolean> show full backtrace for errors
// backtrace: false,
// // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
// requireModule: [],
// // <boolean> invoke formatters without executing steps
// dryRun: false,
// // <boolean> abort the run on first failure
// failFast: false,
// // <boolean> hide step definition snippets for pending steps
// snippets: true,
// // <boolean> hide source uris
// source: true,
// // <boolean> fail if there are any undefined or pending steps
// strict: false,
// // <string> (expression) only execute the features or scenarios with tags matching the expression
// tagExpression: '',
// // <number> timeout for step definitions
// timeout: 60000,
// // <boolean> Enable this config to treat undefined definitions as warnings.
// ignoreUndefinedDefinitions: false
// },
//
// /**
// * Gets executed once before all workers get launched.
// * @param {Object} config wdio configuration object
// * @param {Array.<Object>} capabilities list of capabilities details
// */
// // onPrepare: function (config, capabilities) {
// // },
// /**
// * Gets executed before a worker process is spawned and can be used to initialise specific service
// * for that worker as well as modify runtime environments in an async fashion.
// * @param {String} cid capability id (e.g 0-0)
// * @param {[type]} caps object containing capabilities for session that will be spawn in the worker
// * @param {[type]} specs specs to be run in the worker process
// * @param {[type]} args object that will be merged with the main configuration once worker is initialized
// * @param {[type]} execArgv list of string arguments passed to the worker process
// */
// // onWorkerStart: function (cid, caps, specs, args, execArgv) {
// // },
// /**
// * Gets executed just after a worker process has exited.
// * @param {String} cid capability id (e.g 0-0)
// * @param {Number} exitCode 0 - success, 1 - fail
// * @param {[type]} specs specs to be run in the worker process
// * @param {Number} retries number of retries used
// */
// // onWorkerEnd: function (cid, exitCode, specs, retries) {
// // },
// /**
// * Gets executed just before initialising the webdriver session and test framework. It allows you
// * to manipulate configurations depending on the capability or spec.
// * @param {Object} config wdio configuration object
// * @param {Array.<Object>} capabilities list of capabilities details
// * @param {Array.<String>} specs List of spec file paths that are to be run
// * @param {String} cid worker id (e.g. 0-0)
// */
// beforeSession: function (config, capabilities, specs, cid) {
// // console.log(`Initializing before Session`);
// // dotenv.config({path: `env/common.env`})
// // console.log(`Env file loaded successfully`);
// // console.log(`Before session ended`);
// },
// /**
// * Gets executed before test execution begins. At this point you can access to all global
// * variables like `browser`. It is the perfect place to define custom commands.
// * @param {Array.<Object>} capabilities list of capabilities details
// * @param {Array.<String>} specs List of spec file paths that are to be run
// * @param {Object} browser instance of created browser/device session
// */
// // before: function (capabilities, specs) {
// // },
// /**
// * Runs before a WebdriverIO command gets executed.
// * @param {String} commandName hook command name
// * @param {Array} args arguments that command would receive
// */
// // beforeCommand: function (commandName, args) {
// // },
// /**
// * Cucumber Hooks
// *
// * Runs before a Cucumber Feature.
// * @param {String} uri path to feature file
// * @param {GherkinDocument.IFeature} feature Cucumber feature object
// */
// // beforeFeature: function (uri, feature) {
// // },
// /**
// *
// * Runs before a Cucumber Scenario.
// * @param {ITestCaseHookParameter} world world object containing information on pickle and test step
// * @param {Object} context Cucumber World object
// */
// beforeScenario: function (world, context) {
// dotenv.config({path: `env/common.env`})
// logger.info(`Env file loaded successfully`);
// browserHelper.clearBrowserStorage();
// },
// /**
// *
// * Runs before a Cucumber Step.
// * @param {Pickle.IPickleStep} step step data
// * @param {IPickle} scenario scenario pickle
// * @param {Object} context Cucumber World object
// */
// // beforeStep: function (step, scenario, context) {
// // },
// /**
// *
// * Runs after a Cucumber Step.
// * @param {Pickle.IPickleStep} step step data
// * @param {IPickle} scenario scenario pickle
// * @param {Object} result results object containing scenario results
// * @param {boolean} result.passed true if scenario has passed
// * @param {string} result.error error stack if scenario failed
// * @param {number} result.duration duration of scenario in milliseconds
// * @param {Object} context Cucumber World object
// */
// // afterStep: function (step, scenario, result, context) {
// // },
// /**
// *
// * Runs after a Cucumber Scenario.
// * @param {ITestCaseHookParameter} world world object containing information on pickle and test step
// * @param {Object} result results object containing scenario results
// * @param {boolean} result.passed true if scenario has passed
// * @param {string} result.error error stack if scenario failed
// * @param {number} result.duration duration of scenario in milliseconds
// * @param {Object} context Cucumber World object
// */
// // afterScenario: function (world, result, context) {
// // },
// /**
// *
// * Runs after a Cucumber Feature.
// * @param {String} uri path to feature file
// * @param {GherkinDocument.IFeature} feature Cucumber feature object
// */
// // afterFeature: function (uri, feature) {
// // },
//
// /**
// * Runs after a WebdriverIO command gets executed
// * @param {String} commandName hook command name
// * @param {Array} args arguments that command would receive
// * @param {Number} result 0 - command success, 1 - command error
// * @param {Object} error error object if any
// */
// // afterCommand: function (commandName, args, result, error) {
// // },
// /**
// * Gets executed after all tests are done. You still have access to all global variables from
// * the test.
// * @param {Number} result 0 - test pass, 1 - test fail
// * @param {Array.<Object>} capabilities list of capabilities details
// * @param {Array.<String>} specs List of spec file paths that ran
// */
// // after: function (result, capabilities, specs) {
// // },
// /**
// * Gets executed right after terminating the webdriver session.
// * @param {Object} config wdio configuration object
// * @param {Array.<Object>} capabilities list of capabilities details
// * @param {Array.<String>} specs List of spec file paths that ran
// */
// // afterSession: function (config, capabilities, specs) {
// // },
// /**
// * Gets executed after all workers got 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: function(exitCode, config, capabilities, results) {
// // },
// /**
// * Gets executed when a refresh happens.
// * @param {String} oldSessionId session ID of the old session
// * @param {String} newSessionId session ID of the new session
// */
// // onReload: function(oldSessionId, newSessionId) {
// // }
// }
//
//# sourceMappingURL=data:application/json;base64,eyJ2Z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