WebdriverIO v5.0.0 Release Notes

Release Date: 2018-12-20 // over 5 years ago
  • This version comes with a variety of technical changes that might affect the functionality of 3rd party WebdriverIO packages from the community. If such a package causes problems after the update, please raise an issue in the repository of that package and not in this repository. You can find a list of officially maintained packages here.

    :boom: Breaking Change

    • ๐Ÿ“ฆ moved wdio cli command from webdriverio package to @wdio/cli
    • ๐Ÿ’ป commands are scoped to browser and element - no selector property on commands anymore js // v4 browser.click('#myElem') js // v5 and upwards const elem = $('#myElem') elem.click()
    • no command chaining anymore (in standalone and wdio mode) js // v4 (standalone/async mode) browser .url('https://duckduckgo.com/') .setValue('#search_form_input_homepage', 'WebdriverIO') // ... js // v5 (standalone/async mode) await browser.url('https://duckduckgo.com/') const elem = await browser.$('#search_form_input_homepage') await elem.click() await elem.setValue('WebdriverIO')
    • every protocol command returns a value property instead of raw driver response js // v4 const result = browser.execute(() => 1 + 1) console.log(result) // outputs: // { sessionId: '02aee149a1a421b81598ff2a3b90e33d', // value: 2, // _status: 0 } js // v5 const result = browser.execute(() => 1 + 1) console.log(result) // outputs: 2
    • the remote and multiremote methods to initiate a driver instance now also start the driver session and therefore return a promise (no init command anymore) js // v4 import { remote } from 'webdriverio' const driver = remote({ ... }) driver.init().url('https://webdriver.io').end() js // v5 import { remote } from 'webdriverio' const driver = await remote({ ... }) await driver.url('https://webdriver.io') await driver.deleteSession()
    • command changes: over the years WebdriverIO added more and more commands for different automation protocols without applying a pattern to it which resulted in having a bunch of duplication and inconsistent naming, even though the list looks exhausting, most of the commands that have changed were used internally
      • renamed commands:
        • isVisible โ†’ isDisplayed
        • isVisibleWithinViewport โ†’ isDisplayedInViewport
        • waitForVisible โ†’ waitForDisplayed
        • clearElement โ†’ clearValue
        • moveToObject โ†’ moveTo (element scope only)
        • setCookie, getCookie, deleteCookie โ†’ setCookies, getCookies, deleteCookies
        • getElementSize โ†’ getSize
        • source, getSource โ†’ getPageSource
        • title โ†’ getTitle
        • actions โ†’ performActions (WebDriver protocol only)
        • alertAccept โ†’ acceptAlert
        • alertDismiss โ†’ dismissAlert
        • alertText โ†’ getAlertText, sendAlertText
        • applicationCacheStatus โ†’ getApplicationCacheStatus (JsonWireProtocol only)
        • cookie โ†’ getAllCookies, addCookie, deleteCookie
        • getCssProperty โ†’ getCSSProperty
        • element โ†’ findElement
        • elements โ†’ findElements
        • elementActive โ†’ getActiveElement
        • elementIdAttribute โ†’ getElementAttribute
        • elementIdClear โ†’ elementClear
        • elementIdClick โ†’ elementClick
        • elementIdCssProperty โ†’ getElementCSSValue
        • elementIdDisplayed โ†’ isElementDisplayed
        • elementIdElement โ†’ findElementFromElement
        • elementIdElements โ†’ findElementsFromElement
        • elementIdEnabled โ†’ isElementEnabled
        • elementIdLocation โ†’ getElementLocation
        • elementIdLocationInView โ†’ getElementLocationInView (JsonWireProtocol only)
        • elementIdName โ†’ getElementTagName
        • elementIdProperty โ†’ getElementProperty
        • elementIdRect โ†’ getElementRect
        • elementIdScreenshot โ†’ takeElementScreenshot
        • elementIdSelected โ†’ isElementSelected
        • elementIdSize โ†’ getElementSize (JsonWireProtocol only)
        • elementIdText โ†’ getElementText
        • elementIdValue โ†’ elementSendKeys
        • frame โ†’ switchToFrame
        • frameParent โ†’ switchToParentFrame
        • timeoutsAsyncScript, timeoutsImplicitWait โ†’ setAsyncTimeout, setImplicitTimeout (JsonWireProtocol only)
        • getLocationInView โ†’ getElementLocationInView (JsonWireProtocol only)
        • imeActivate โ†’ activateIME (JsonWireProtocol only)
        • imeActivated โ†’ isIMEActivated (JsonWireProtocol only)
        • imeActiveEngine โ†’ getActiveEngine (JsonWireProtocol only)
        • imeAvailableEngines โ†’ getAvailableEngines (JsonWireProtocol only)
        • imeDeactivated โ†’ deactivateIME (JsonWireProtocol only)
        • localStorage โ†’ getLocalStorage, setLocalStorage, clearLocalStorage, getLocalStorageItem, deleteLocalStorageItem (JsonWireProtocol only)
        • localStorageSize โ†’ getLocalStorageSize (JsonWireProtocol only)
        • sessionStorage โ†’ getSessionStorage, setSessionStorage, clearSessionStorage, getSessionStorageItem, deleteSessionStorageItem (JsonWireProtocol only)
        • sessionStorageSize โ†’ getSessionStorageSize (JsonWireProtocol only)
        • location โ†’ getElementLocation
        • log โ†’ getLogs (JsonWireProtocol only)
        • logTypes โ†’ getLogTypes (JsonWireProtocol only)
        • screenshot โ†’ takeScreenshot
        • session โ†’ getSession, deleteSession (JsonWireProtocol only)
        • sessions โ†’ getSessions
        • submit โ†’ elementSubmit
        • timeouts โ†’ getTimeouts, setTimeouts
        • window, switchToWindow โ†’ switchWindow
        • windowHandle โ†’ closeWindow, getWindowHandle
        • windowHandles โ†’ getWindowHandles
        • windowHandleFullscreen โ†’ fullscreenWindow
        • windowHandleMaximize โ†’ maximizeWindow
        • windowHandlePosition โ†’ setWindowPosition, getWindowPosition (JsonWireProtocol only), setWindowRect, getWindowRect (WebDriver protocol only)
        • windowHandleSize โ†’ setWindowSize, getWindowSize (JsonWireProtocol only), setWindowRect, getWindowRect (WebDriver protocol only)
        • hasFocus โ†’ isFocused
        • end โ†’ deleteSession
        • reload โ†’ reloadSession
        • scroll โ†’ scrollIntoView
        • context โ†’ getContext, switchContext
        • contexts โ†’ getContexts
        • currentActivity โ†’ getCurrentActivity
        • deviceKeyEvent โ†’ sendKeyEvent
        • getAppStrings โ†’ getStrings
        • hideDeviceKeyboard โ†’ hideKeyboard
        • hold โ†’ longPressKeyCode
        • launch โ†’ launchApp
        • performMultiAction โ†’ multiTouchPerform
        • pressKeycode โ†’ pressKeyCode
        • rotate โ†’ rotateDevice
        • setImmediateValue โ†’ setValueImmediate
        • settings โ†’ getSettings, updateSettings
        • strings โ†’ getStrings
        • toggleTouchIdEnrollment โ†’ toggleEnrollTouchId
      • removed commands (Note: there are chances that removed commands will come back if their use case scenario seem to be reasonable.):
        • doDoubleClick, doubleClick - replace with double click command or performActions command
        • dragAndDrop - replace with performActions command
        • leftClick, middleClick, rightClick - replace with performActions command
        • selectByValue - replace with selectByAttribute('value')
        • selectorExecute, selectorExecuteAsync - replace with execute(elem)
        • submit - replace by clicking on submit button
        • getCurrentDeviceActivity - replace by getCurrentActivity
        • release - replace by touchAction command
        • swipe, swipeDown, swipeLeft, swipeRight, swipeUp - replace by touchAction command
        • performTouchAction - replace by touchPerform
        • with no replacements: init, buttonPress, file, chooseFile, uploadFile, endAll, getCommandHistory, waitForSelected, waitForText, waitForValue, getGridNodeDetails, gridProxyDetails, gridTestSession, hold
      • new commands:
        • WebDriver / JsonWireProtocol: minimizeWindow
        • Appium: startRecordingScreen, stopRecordingScreen, isKeyboardShown, getSystemBars, getDisplayDensity, endCoverage, replaceValue, receiveAsyncResponse, gsmCall, gsmSignal, gsmVoice, sendSms, fingerPrint
    • โž• adding custom commands are scoped to the prototype they are being added to

      // v4
      browser.addCommand('myCommand', () => { ... })
      const elem = $('myElem')
      console.log(typeof browser.myCommand) // outputs "function"
      console.log(typeof elem.myCommand) // outputs "function"
      
      // v5
      browser.addCommand('myCommand', () => { ... })
      const elem = $('myElem')
      console.log(typeof browser.myCommand) // outputs "function"
      console.log(typeof elem.myCommand) // outputs "undefined"
      elem.addCommand('myElemCommand', () => { ... })
      console.log(typeof elem.myElemCommand) // outputs "function"
      const elem2 = $('myOtherElem')
      console.log(typeof elem2.myElemCommand) // outputs "undefined"
      
    • spec and suite cli arguments are now passed as an array, e.g.

      // v4
      ./node_modules/.bin/wdio wdio.conf.js --spec ./tests/foobar.js,./tests/baz.js
      

    ./node_modules/.bin/wdio wdio.conf.js --suite FooBar,BarBaz

    ./node_modules/.bin/wdio wdio.conf.js --suite FooBar

      ```js
      // v5
      ./node_modules/.bin/wdio wdio.conf.js --spec ./tests/foobar.js ./tests/baz.js
    
      ./node_modules/.bin/wdio wdio.conf.js --suite FooBar BarBaz
    
      ./node_modules/.bin/wdio wdio.conf.js --suite FooBar
    
    • ๐Ÿ”ง custom configuration for services or reporters are now directly applied to the config list, e.g. js // ... reporters: [ 'spec', [ 'junit', { outputDir: __dirname + '/junit_logs' } ] ], // ...

    :eyeglasses: Spec Compliancy

    • implemented parameter assertions for protocol commands
    • full W3C WebDriver compliancy
    • full Appium and Mobile JSONWire Protocol compliancy
    • ๐Ÿšง simplified protocol command maintenance by defining commands, their parameters and response values within simple json constructs
    • ๐Ÿ‘ instead of switching protocol within a running session, WebdriverIO now determines the supported protocol by the driver based on the create session response

    :rocket: New Feature

    • ๐Ÿ†• new package @wdio/applitools-service for simple visual regression testing with Applitools
    • ๐Ÿ†• new package eslint-plugin-wdio for WebdriverIO specific linting rules for ESLint
    • ๐ŸŽ @wdio/devtools-service now with frontend performance testing capabilities (see example)
    • ๐Ÿ†• new region option to simply run tests on SauceLabs in different datacenters
    • ๐Ÿ’ป debug command now allows to connect the runner with the Chrome DevTools application for more indepth debugging
    • ๐Ÿ“ฆ decoupling of @wdio/sync package from framework adapters so that there is no need to install fibers when you want to run your commands with async/await
    • ๐ŸŒฒ autofetching of all provides log types
    • auto retry mechansim for all command requests
    • auto refetch mechanism for stale elements
    • simplified reattachment to existing sessions with attach functionality
    • โ†” integrated and auto maintained TypeScript definitions
    • โœ… wdio testrunner fails if no spec files were found

    :bug: Bug Fix

    • ๐Ÿ›  fixed loss of scope when chaining elements (e.g. $$('div')[2].$('span').getHTML())
    • โšก๏ธ browser scope with now updated capabilities (browser.capabilities)
    • ๐Ÿ‘Œ improved watch functionality allows to rerun tests without starting a new session all over again
    • ๐Ÿ›  fixed problems with addCommand in multiremote

    ๐Ÿ“š :memo: Documentation

    • ๐Ÿ“š brand new documentation page based on the Docusaurus framework
      • written in a modern web framework called React
      • completely responsive with full support for mobile viewports
    • included blog for WebdriverIO related news and article
    • ๐Ÿ›  fixed links to edit certain documentation pages
    • ๐Ÿ“š documentation page served via HTTPS per default

    :house: Internal

    • complete rearchitecturing of the whole project into a monorepo
    • ๐Ÿ“ฆ moved all protocol commands into a webdriver base package
    • ๐Ÿš€ project sub packages are now released within the @wdio NPM organization
    • ๐Ÿ“ฆ renamed services, reporters and other internal packages (e.g. wdio-sauce-service โ†’ @wdio/sauce-service)
    • โœ‚ removed all e2e tests from project to run as unit tests using Jest with a coverage of ~96%
    • โšก๏ธ update to Babel v7 (latest) as well as various of other dependency updates with security fixes
    • CPU and Memory improvements by reducing amount of IPC calls

    ๐Ÿ’… :nail_care: Polish