Created
January 31, 2018 15:02
-
-
Save felipebn/bc3ef59e8c30e4263739377fcc53eaa2 to your computer and use it in GitHub Desktop.
Sample nightwatch.js assertion in multiple items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
url: 'http://google.com', | |
elements: { | |
searchBar: { | |
selector: 'input[type=text]' | |
}, | |
btn: { | |
selector: 'input[type=submit]', | |
} | |
}, | |
commands: [ | |
{ | |
assertBtnText: function(index, text){ | |
var i = index + 1 | |
return this.getValue(`input[type=submit]:nth-child(${i})`, function(result){ | |
this.assert.equal(result.value, text) | |
}); | |
} | |
} | |
] | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
'Test': function (client) { | |
var google = client.page.google(); | |
google.navigate() | |
.assert.title('Google') | |
.assert.visible('@searchBar') | |
.setValue('@searchBar', 'nightwatch'); | |
google.assertBtnText(0,"Pesquisa Google") | |
google.assertBtnText(1,"Sinto-me com sorte") | |
client.end(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment