Skip to content

Instantly share code, notes, and snippets.

@MattiSG
Last active November 7, 2015 17:40
Show Gist options
  • Save MattiSG/0874220df30c98ee149f to your computer and use it in GitHub Desktop.
Save MattiSG/0874220df30c98ee149f to your computer and use it in GitHub Desktop.
Upgrade Watai test suites from v0.6 to v0.7
#!/usr/bin/env node
// Partially upgrades a Watai test suite from v0.6 to v0.7 syntax.
// Usage: node upgrade-watai-06-07.js path/to/test/suite/folder [another/test/suite [another/suite …]]
// Only renames files.
var fs = require('fs');
process.argv.splice(0, 2);
var RENAMES = {
feature: 'scenario',
Feature: 'Scenario',
widget: 'component',
Widget: 'Component',
data: 'fixture',
Data: 'Fixture',
};
process.argv.forEach(function(dir) {
fs.readdirSync(dir).forEach(function(oldName) {
for (var previous in RENAMES) {
var newName = oldName.replace(previous, RENAMES[previous]);
if (oldName != newName) {
fs.renameSync(dir + oldName, dir + newName);
console.log(oldName, '->', newName);
}
}
});
});
console.log('All filenames are now v≥0.7-compliant.')
console.log('You still need to:')
console.log('• Rename `scenario` to `steps` in your Scenario files.')
console.log('• Rename the `Flow` views to `Verbose` in your config file.')
console.log('• Switch all async config to promises.')
console.log('For more info: <https://github.com/MattiSG/Watai/wiki/Upgrading-from-v0.6-to-v0.7>')
console.log('Thanks for using Watai! :)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment