diff --git a/package.json b/package.json index 40e8dd3..febdc74 100644 --- a/package.json +++ b/package.json @@ -4,21 +4,38 @@ "description": "sampleRV", "main": "myTest.js", "dependencies": { - "chai": "^4.1.2", "selenium-standalone": "^6.8.0", "should": "^12.0.0", "webdriverio": "^4.8.0" }, "devDependencies": { - "chai": "^4.1.2", + "@wdio/cli": "^6.1.22", + "@wdio/local-runner": "^6.1.22", + "@wdio/mocha-framework": "^6.1.19", + "@wdio/spec-reporter": "^6.1.14", + "@wdio/sync": "^6.1.14", + "chai": "^4.2.0", + "chromedriver": "^83.0.0", "mocha": "^3.5.0", + "wdio-chromedriver-service": "^6.0.3", "wdio-mocha-framework": "^0.5.11", "wdio-selenium-standalone-service": "0.0.9", "webdriverio": "^4.8.0" }, "scripts": { - "test": "./node_modules/.bin/wdio wdio.conf.js" + "test": "wdio wdio.conf.js" }, - "author": "", - "license": "ISC" + "author": "Duc Le", + "license": "ISC", + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ducle91/WebDriverIO.git" + }, + "bugs": { + "url": "https://github.com/ducle91/WebDriverIO/issues" + }, + "homepage": "https://github.com/ducle91/WebDriverIO#readme" } diff --git a/wdio.conf.js b/wdio.conf.js index e587e37..e2f48a3 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -1,5 +1,15 @@ exports.config = { - + // + // ==================== + // Runner Configuration + // ==================== + // + // WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or + // on a remote machine). + runner: 'local', + // + // Override default path ('/wd/hub') for chromedriver service. + path: '/', // // ================== // Specify Test Files @@ -10,13 +20,12 @@ exports.config = { // directory is where your package.json resides, so `wdio` will be called from there. // specs: [ - './test/specs/**/*.js' + './test/specs/*.js' ], // Patterns to exclude. exclude: [ // 'path/to/excluded/files' ], - // // ============ // Capabilities @@ -45,7 +54,11 @@ exports.config = { // 5 instances get started at a time. maxInstances: 5, // - browserName: 'chrome' + browserName: 'chrome', + // If outputDir is provided WebdriverIO can capture driver session logs + // it is possible to configure which logTypes to include/exclude. + // excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs + // excludeDriverLogs: ['bugreport', 'server'], }], // // =================== @@ -53,81 +66,67 @@ exports.config = { // =================== // Define all options that are relevant for the WebdriverIO instance here // - // By default WebdriverIO commands are executed in a synchronous way using - // the wdio-sync package. If you still want to run your tests in an async way - // e.g. using promises you can set the sync option to false. - sync: true, - // - // Level of logging verbosity: silent | verbose | command | data | result | error - logLevel: 'silent', - // - // Enables colors for log output. - coloredLogs: true, + // Level of logging verbosity: trace | debug | info | warn | error | silent + logLevel: 'info', + // + // Set specific log levels per logger + // loggers: + // - webdriver, webdriverio + // - @wdio/applitools-service, @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service + // - @wdio/mocha-framework, @wdio/jasmine-framework + // - @wdio/local-runner, @wdio/lambda-runner + // - @wdio/sumologic-reporter + // - @wdio/cli, @wdio/config, @wdio/sync, @wdio/utils + // Level of logging verbosity: trace | debug | info | warn | error | silent + // logLevels: { + // webdriver: 'info', + // '@wdio/applitools-service': 'info' + // }, // // If you only want to run your tests until a specific amount of tests have failed use // bail (default is 0 - don't bail, run all tests). bail: 0, // - // Saves a screenshot to a given path if a command fails. - screenshotPath: './errorShots/', - // - // Set a base URL in order to shorten url command calls. If your url parameter starts - // with "/", then the base url gets prepended. - baseUrl: 'https://internet.frontier.com', + // Set a base URL in order to shorten url command calls. If your `url` parameter starts + // with `/`, the base url gets prepended, not including the path portion of your baseUrl. + // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url + // gets prepended directly. + baseUrl: 'http://localhost', // // Default timeout for all waitFor* commands. - waitforTimeout: 10000, - // - // Default timeout in milliseconds for request - // if Selenium Grid doesn't send response - connectionRetryTimeout: 90000, + waitforTimeout: 25000, // // Default request retries count connectionRetryCount: 3, // - // Initialize the browser instance with a WebdriverIO plugin. The object should have the - // plugin name as key and the desired plugin options as properties. Make sure you have - // the plugin installed before running any tests. The following plugins are currently - // available: - // WebdriverCSS: https://github.com/webdriverio/webdrivercss - // WebdriverRTC: https://github.com/webdriverio/webdriverrtc - // Browserevent: https://github.com/webdriverio/browserevent - // plugins: { - // webdrivercss: { - // screenshotRoot: 'my-shots', - // failedComparisonsRoot: 'diffs', - // misMatchTolerance: 0.05, - // screenWidth: [320,480,640,1024] - // }, - // webdriverrtc: {}, - // browserevent: {} - // }, - // // Test runner services // Services take over a specific job you don't want to take care of. They enhance // your test setup with almost no effort. Unlike plugins, they don't add new // commands. Instead, they hook themselves up into the test process. - services: [ - 'selenium-standalone' - ], + services: ['chromedriver'], + // Framework you want to run your specs with. // The following are supported: Mocha, Jasmine, and Cucumber - // see also: http://webdriver.io/guide/testrunner/frameworks.html + // see also: https://webdriver.io/docs/frameworks.html // // Make sure you have the wdio adapter package for the specific framework installed // before running any tests. framework: 'mocha', // + // The number of times to retry the entire specfile when it fails as a whole + // specFileRetries: 1, + // // Test reporter for stdout. // The only one supported by default is 'dot' - // see also: http://webdriver.io/guide/testrunner/reporters.html - // reporters: ['dot'], + // see also: https://webdriver.io/docs/dot-reporter.html + reporters: ['spec'], + // // Options to be passed to Mocha. // See the full list at http://mochajs.org/ mochaOpts: { ui: 'bdd', - timeout: 60000 + timeout: 99999999999 }, // // ===== @@ -161,42 +160,48 @@ exports.config = { */ // before: function (capabilities, specs) { // }, - // - before: function() { - var chai = require('chai'); - global.expect = chai.expect; - chai.Should(); - } + /** + * 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) { + // }, /** * Hook that gets executed before the suite starts * @param {Object} suite suite details */ // beforeSuite: function (suite) { // }, + /** + * Function to be executed before a test (in Mocha/Jasmine) starts. + */ + // beforeTest: function (test, context) { + // }, /** * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling * beforeEach in Mocha) */ - // beforeHook: function () { + // beforeHook: function (test, context) { // }, /** * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling * afterEach in Mocha) */ - // afterHook: function () { + // afterHook: function (test, context, { error, result, duration, passed, retries }) { // }, /** - * Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts. - * @param {Object} test test details + * Function to be executed after a test (in Mocha/Jasmine). */ - // beforeTest: function (test) { + // afterTest: function(test, context, { error, result, duration, passed, retries }) { // }, + + /** - * Runs before a WebdriverIO command gets executed. - * @param {String} commandName hook command name - * @param {Array} args arguments that command would receive + * Hook that gets executed after the suite has ended + * @param {Object} suite suite details */ - // beforeCommand: function (commandName, args) { + // afterSuite: function (suite) { // }, /** * Runs after a WebdriverIO command gets executed @@ -207,18 +212,6 @@ exports.config = { */ // afterCommand: function (commandName, args, result, error) { // }, - /** - * Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts. - * @param {Object} test test details - */ - // afterTest: function (test) { - // }, - /** - * Hook that gets executed after the suite has ended - * @param {Object} suite suite details - */ - // afterSuite: function (suite) { - // }, /** * Gets executed after all tests are done. You still have access to all global variables from * the test. @@ -237,10 +230,20 @@ exports.config = { // afterSession: function (config, capabilities, specs) { // }, /** - * Gets executed after all workers got shut down and the process is about to exit. It is not - * possible to defer the end of the process using a promise. + * 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.} capabilities list of capabilities details + * @param {} results object containing test results */ - // onComplete: function(exitCode) { - // } + // 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) { + //} }