Skip to content

Instantly share code, notes, and snippets.

@stephenash
Last active August 18, 2017 21:38
Show Gist options
  • Select an option

  • Save stephenash/977e39c2db921d6daa37fedad37ee5a7 to your computer and use it in GitHub Desktop.

Select an option

Save stephenash/977e39c2db921d6daa37fedad37ee5a7 to your computer and use it in GitHub Desktop.

Revisions

  1. stephenash revised this gist Aug 18, 2017. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion wdio.conf.js
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ exports.config = {
    // directory is where your package.json resides, so `wdio` will be called from there.
    //
    specs: [
    './test.js'
    './test/specs/**/*.js'
    ],
    // Patterns to exclude.
    exclude: [
    @@ -123,6 +123,15 @@ exports.config = {
    "services": [
    "selenium-standalone"
    ],

    seleniumArgs: {
    version: '3.4.0'
    },

    seleniumInstallArgs: {
    version: '3.4.0'
    },

    // 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
  2. stephenash created this gist Aug 18, 2017.
    68 changes: 68 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    # Selenium Standalone 6.7 issue

    This error occurs when running [email protected] with the
    webdriverio's standalone service (most recent version).
    "wdio-selenium-standalone-service": "~0.0.9",


    ## To repro
    * install npm, node
    01H5G8WPacclocal:test bills$ node -v
    v7.10.0
    01H5G8WPacclocal:test bills$ npm -v
    4.2.0
    * cd test-selenium-standalone
    * npm install
    * node_modules/.bin/wdio
    * **Expect**: no errors
    * **Actual**: errors

    ```
    01H5G8WPacclocal:test bills$ npm install selenium-standalone
    [email protected] /Users/bills/git/test
    └── [email protected]
    npm WARN [email protected] No repository field.
    01H5G8WPacclocal:test bills$ wdio
    [12:42:42] COMMAND POST "/wd/hub/session"
    [12:42:42] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"browserName":"chrome","chromeOptions":{"args":["disable-infobars","incognito"],"mobileEmulation":{"deviceMetrics":{"width":360,"height":640,"pixelRatio":3},"userAgent":"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36"}},"platform_tag":"","build":"defaultbuild 2017-8-18 13:00","tunnelIdentifier":"pandora.fciis.net","loggingPrefs":{"browser":"ALL","driver":"ALL"},"_":"1 more keys: [\"requestOrigins\"]"}}
    ERROR: unknown error: cannot parse capability: chromeOptions
    from unknown error: cannot parse mobileEmulation
    from unknown error: 'width' must be an integer
    (Driver info: chromedriver=2.31.488774 (7e15618d1bf16df8bf0ecf2914ed1964a387ba0b),platform=Mac OS X 10.11.6 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 32 milliseconds
    Build info: version: '3.5.0', revision: '8def36e068', time: '2017-08-10T23:00:22.093Z'
    System info: host: '01H5G8WPacclocal.local', ip: '207.66.231.212', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_111'
    Driver info: driver.version: unknown
    chrome
    Error
    ```



    ## Prove it works in [email protected]
    * edit package.json --- replace [email protected] -> [email protected]
    * npm install selenium-standalone
    * wdio
    * **Expect**: no errors
    * **Actual**: no errors

    ```
    01H5G8WPacclocal:test bills$ npm install selenium-standalone
    [email protected] /Users/bills/git/test
    └── [email protected]
    npm WARN [email protected] No repository field.
    01H5G8WPacclocal:test bills$ wdio
    [12:51:16] COMMAND POST "/wd/hub/session"
    [12:51:16] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"browserName":"chrome","chromeOptions":{"args":["disable-infobars","incognito"],"mobileEmulation":{"deviceMetrics":{"width":360,"height":640,"pixelRatio":3},"userAgent":"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36"}},"platform_tag":"","build":"defaultbuild 2017-8-18 13:00","tunnelIdentifier":"pandora.fciis.net","loggingPrefs":{"browser":"ALL","driver":"ALL"},"_":"1 more keys: [\"requestOrigins\"]"}}
    [12:51:18] INFO SET SESSION ID 2292a059-a204-4f3d-a59e-ee99b977f3bd
    [12:51:18] RESULT {"mobileEmulationEnabled":true,"hasTouchScreen":true,"platform":"MAC","acceptSslCerts":true,"webStorageEnabled":true,"browserName":"chrome","takesScreenshot":true,"javascriptEnabled":true,"setWindowRect":true,"unexpectedAlertBehaviour":"","applicationCacheEnabled":false,"rotatable":false,"networkConnectionEnabled":true,"chrome":{"chromedriverVersion":"2.31.488774 (7e15618d1bf16df8bf0ecf2914ed1964a387ba0b)","userDataDir":"/var/folders/4g/pkjhwt757jn5y18v5dsldw2r0000gp/T/.org.chromium.Chromium.R2MvnK"},"takesHeapSnapshot":true,"pageLoadStrategy":"normal","unhandledPromptBehavior":"","databaseEnabled":false,"handlesAlerts":true,"version":"60.0.3112.101","browserConnectionEnabled":false,"nativeEvents":true,"webdriver.remote.sessionid":"2292a059-a204-4f3d-a59e-ee99b977f3bd","locationContextEnabled":true,"cssSelectorsEnabled":true}
    [12:51:18] COMMAND POST "/wd/hub/session/2292a059-a204-4f3d-a59e-ee99b977f3bd/url"
    [12:51:18] DATA {"url":"http://www.google.com/"}
    [12:51:18] COMMAND DELETE "/wd/hub/session/2292a059-a204-4f3d-a59e-ee99b977f3bd"
    [12:51:18] DATA {}
    ```

    49 changes: 49 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    {
    "name": "test",
    "version": "1.0.1",
    "description": "GUI tests ",
    "main": "test.js",
    "directories": {
    "test": "test"
    },
    "publishConfig": {
    "registry": "https://npm.accretivetg.com"
    },
    "public": false,
    "license": "ISC",
    "dependencies": {
    "babel-cli": "^6.22.2",
    "babel-plugin-module-resolver": "^2.5.0",
    "babel-preset-es2015": "^6.22.0",
    "babel-register": "^6.23.0",
    "chai": "^3.5.0",
    "console-group": "0.3.3",
    "grunt": "^0.4.0",
    "geckodriver": "^1.6.0",
    "http-status-codes": "^1.1.6",
    "junit-merge": "^1.1.0",
    "lodash": "^4.17.4",
    "mocha": "^3.1.2",
    "request": "^2.81.0",
    "request-promise-native": "^1.0.3",
    "selenium-standalone": "6.7.0",
    "selenium-webdriver": "^3.4.0",
    "wdio-allure-addons-reporter": "0.0.4",
    "wdio-allure-reporter": "~0.1.2",
    "wdio-junit-reporter": "^0.3.0",
    "wdio-mocha-framework": "~0.5.10",
    "wdio-sauce-service": "~0.4.0",
    "wdio-selenium-standalone-service": "~0.0.9",
    "wdio-selenium-standalone-grid-service": "0.0.2",
    "wdio-spec-reporter": "0.1.0",
    "webdriverio": "^4.8.0",
    "yargs": "^7.0.2"
    },
    "devDependencies": {
    "babel-eslint": "^7.1.1",
    "chromedriver": "^2.29.0",
    "eslint": "^3.16.1",
    "wdio-dot-reporter": "0.0.9",
    "wdio-mocha-framework": "^0.5.11"
    }
    }
    1 change: 1 addition & 0 deletions test.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    browser.url('http://www.google.com');
    254 changes: 254 additions & 0 deletions wdio.conf.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,254 @@
    exports.config = {

    //
    // ==================
    // Specify Test Files
    // ==================
    // Define which test specs should run. The pattern is relative to the directory
    // from which `wdio` was called. Notice that, if you are calling `wdio` from an
    // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
    // directory is where your package.json resides, so `wdio` will be called from there.
    //
    specs: [
    './test.js'
    ],
    // Patterns to exclude.
    exclude: [
    // 'path/to/excluded/files'
    ],
    //
    // ============
    // Capabilities
    // ============
    // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
    // time. Depending on the number of capabilities, WebdriverIO launches several test
    // sessions. Within your capabilities you can overwrite the spec and exclude options in
    // order to group specific specs to a specific capability.
    //
    // First, you can define how many instances should be started at the same time. Let's
    // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
    // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
    // files and you set maxInstances to 10, all spec files will get tested at the same time
    // and 30 processes will get spawned. The property handles how many capabilities
    // from the same test should run tests.
    //
    maxInstances: 10,
    //
    // If you have trouble getting all important capabilities together, check out the
    // Sauce Labs platform configurator - a great tool to configure your capabilities:
    // https://docs.saucelabs.com/reference/platforms-configurator
    //
    "capabilities": [
    {
    "browserName": "chrome",
    "chromeOptions": {
    "args": [
    "disable-infobars",
    "incognito"
    ],
    "mobileEmulation": {
    "deviceMetrics": {
    "width": 360,
    "height": 640,
    "pixelRatio": 3
    },
    "userAgent": "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36"
    }
    },
    "platform_tag": "",
    "build": "defaultbuild 2017-8-18 13:00",
    "tunnelIdentifier": "pandora.fciis.net"
    }
    ],
    //
    // ===================
    // Test Configurations
    // ===================
    // 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: 'verbose',
    //
    // Enables colors for log output.
    coloredLogs: true,
    //
    // 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: 'http://www.google.com',
    //
    // Default timeout for all waitFor* commands.
    waitforTimeout: 10000,
    //
    // Default timeout in milliseconds for request
    // if Selenium Grid doesn't send response
    connectionRetryTimeout: 90000,
    //
    // 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"
    ],
    // 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
    //
    // Make sure you have the wdio adapter package for the specific framework installed
    // before running any tests.
    framework: 'mocha',
    //
    // Test reporter for stdout.
    // The only one supported by default is 'dot'
    // see also: http://webdriver.io/guide/testrunner/reporters.html
    reporters: ['dot'],

    //
    // Options to be passed to Mocha.
    // See the full list at http://mochajs.org/
    mochaOpts: {
    ui: 'bdd'
    },
    //
    // =====
    // Hooks
    // =====
    // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
    // it and to build services around it. You can either apply a single function or an array of
    // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
    // resolved to continue.
    /**
    * 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 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
    */
    // beforeSession: function (config, capabilities, specs) {
    // },
    /**
    * 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
    */
    // before: function (capabilities, specs) {
    // },
    //
    /**
    * Hook that gets executed before the suite starts
    * @param {Object} suite suite details
    */
    // beforeSuite: function (suite) {
    // },
    /**
    * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
    * beforeEach in Mocha)
    */
    // beforeHook: function () {
    // },
    /**
    * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
    * afterEach in Mocha)
    */
    // afterHook: function () {
    // },
    /**
    * Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
    * @param {Object} test test details
    */
    // beforeTest: function (test) {
    // },
    /**
    * 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) {
    // },
    /**
    * 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) {
    // },
    /**
    * 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.
    * @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. It is not
    * possible to defer the end of the process using a promise.
    * @param {Object} exitCode 0 - success, 1 - fail
    */
    // onComplete: function(exitCode) {
    // }
    }