responsive_image_grid/tests/e2e/custom-commands/openHomepageClass.js

25 lines
716 B
JavaScript
Raw Normal View History

2020-06-25 23:29:05 +02:00
/**
* A class-based Nightwatch custom command which is a variation of the openHomepage.js command.
* The command name is the filename and class needs to contain a "command" method.
*
* Example usage:
* browser.openHomepageClass();
*
* For more information on writing custom commands see:
* https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands
*
*/
2020-06-25 23:31:51 +02:00
const assert = require('assert')
2020-06-25 23:29:05 +02:00
module.exports = class {
async command() {
// Other Nightwatch commands are available via "this.api"
2020-06-25 23:31:51 +02:00
this.api.init()
this.api.waitForElementVisible('#app')
2020-06-25 23:29:05 +02:00
2020-06-25 23:31:51 +02:00
const result = await this.api.elements('css selector', '#app ul')
assert.strictEqual(result.value.length, 3)
2020-06-25 23:29:05 +02:00
}
2020-06-25 23:31:51 +02:00
}