Skip to content

Instantly share code, notes, and snippets.

@asciidisco
Last active February 23, 2016 10:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asciidisco/8377479 to your computer and use it in GitHub Desktop.
Save asciidisco/8377479 to your computer and use it in GitHub Desktop.
Reuse tests or navigation functions across DalekJS files
module.exports = {
loginLocal: function (test) {
test
.open('http://thefalloftheeleventh.com')
.type('[name="user"]', 'John Smith')
.type('[name="pass"]', 'tardis')
.click('button[type="submit"]')
.done();
},
killLocalStorage: function (test) {
test
.execute(function () {
window.localstorage.clear();
})
.wait(500)
.done();
}
};
var fns = require('./functions');
module.exports = {
'clear browser storage': fns.killLocalStorage,
'login': fns.loginLocal,
'a test': function (test) {
test
.click('#aLink')
.assert.text('#aText', 'Lorem ipsum...')
.done();
},
'clear storage on end': fns.killLocalStorage
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment