schlechtenburg/tests/e2e/custom-commands/openHomepage.js

24 lines
773 B
JavaScript
Raw Normal View History

2020-05-19 11:45:14 +00:00
/**
* A basic Nightwatch custom command
* which demonstrates usage of ES6 async/await instead of using callbacks.
* The command name is the filename and the exported "command" function is the command.
*
* Example usage:
* browser.openHomepage();
*
* For more information on writing custom commands see:
* https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands
*
*/
module.exports = {
async command() {
// Other Nightwatch commands are available via "this"
// .init() simply calls .url() command with the value of the "launch_url" setting
this.init();
this.waitForElementVisible('#app');
const result = await this.elements('css selector', '#app ul');
this.assert.strictEqual(result.value.length, 3);
},
};