Skip to content

Instantly share code, notes, and snippets.

@asciidisco
Created July 9, 2014 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asciidisco/57d5e50e07d2428e808d to your computer and use it in GitHub Desktop.
Save asciidisco/57d5e50e07d2428e808d to your computer and use it in GitHub Desktop.
Fetching a random element
'use strict':
var randomPickMe = function (arr) {
return arr[Math.floor((Math.random()*arr.length))];
};
var elements = ['div', 'p', '.someClass', '#anid', 'span a'];
module.exports = {
'Check random text': function (test) {
test
.open('http://not.arandom.url')
.assert.text(randomPickMe(elements), 'I should fail, because you pick me randomly')
.done();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment