github.com/covergates/covergates@v0.2.2-0.20201009050117-42ef8a19fb95/web/tests/e2e/custom-commands/openHomepage.js (about) 1 /** 2 * A basic Nightwatch custom command 3 * which demonstrates usage of ES6 async/await instead of using callbacks. 4 * The command name is the filename and the exported "command" function is the command. 5 * 6 * Example usage: 7 * browser.openHomepage(); 8 * 9 * For more information on writing custom commands see: 10 * https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands 11 * 12 */ 13 module.exports = { 14 command: async function () { 15 // Other Nightwatch commands are available via "this" 16 // .init() simply calls .url() command with the value of the "launch_url" setting 17 this.init(); 18 this.waitForElementVisible('#app'); 19 20 const result = await this.elements('css selector', '#app ul'); 21 this.assert.strictEqual(result.value.length, 3); 22 } 23 };