Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Upgrading from v0.5 to v0.6

Matti Schneider edited this page Sep 4, 2013 · 3 revisions

Upgrade from Watai 0.5 to 0.6

Widget elements

  • partialLinkText selector type is now a

WD syntax in actions

  • this.field = value -> this.setField(value)().then(function(field) { … }) (note the double call on setField)

  • element.submit() -> driver.submit(element)

  • The two above can be more elegantly chained as:

    // before: this.field = value; return this.field.submit();

    // after: return this.setField(value)() .then(driver.submit.bind(driver));

  • Local actions called must have double parens call:

    function() {

    • return ClockWidget.getCurrentHour();
    • return ClockWidget.getCurrentHour()(); }
  • You ABSOLUTELY need to return from ALL actions, as they are all promises and need to be chained for proper ordering.

Widgets and Features

The enclosing curly braces are now automatically added. You must remove them for your tests to run under Watai v0.6.

Use the following script to automatically upgrade your tests:

#!/bin/bash

disableSpaceAsSeparator() {
	OLDIFS=$IFS
	IFS=$(echo -en "\n\b")
}

restoreSeparators() {
	IFS=$OLDIFS
}

disableSpaceAsSeparator

for file in `ls -1 "$1"`
do
	mv "$1${file}" "$1${file}~"
	grep -v '^[{}]$' "$1${file}~" | sed 's/^//g' > "$1${file}"
done

restoreSeparators

Save this in a file like upgrade.sh and call it by passing it the folder that contains the features and widgets you want to upgrade.

Clone this wiki locally