github.com/covergates/covergates@v0.2.2-0.20201009050117-42ef8a19fb95/web/tests/e2e/custom-commands/openHomepageClass.js (about) 1 /** 2 * A class-based Nightwatch custom command which is a variation of the openHomepage.js command. 3 * The command name is the filename and class needs to contain a "command" method. 4 * 5 * Example usage: 6 * browser.openHomepageClass(); 7 * 8 * For more information on writing custom commands see: 9 * https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands 10 * 11 */ 12 13 const assert = require('assert'); 14 15 module.exports = class { 16 async command() { 17 // Other Nightwatch commands are available via "this.api" 18 this.api.init(); 19 this.api.waitForElementVisible('#app'); 20 21 const result = await this.api.elements('css selector', '#app ul'); 22 assert.strictEqual(result.value.length, 3); 23 } 24 };