-
Notifications
You must be signed in to change notification settings - Fork 7
Upgrading from v0.5 to v0.6
-
partialLinkText
selector type is nowa
-
this.field = value
->this.setField(value)().then(function(field) { … })
(note the double call onsetField
) -
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.
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.