grunt-html-dom-snapshot
Version:
Takes snapshots of the HTML markup on web pages - their immediate DOM content - and screenshots of their viewport - how they look like.
25 lines (21 loc) • 669 B
JavaScript
const { checkSingleElement } = require('./utils/elements')
module.exports = {
detect: function (command) {
return !!command.isVisible
},
perform: async function (grunt, target, client, command, options) {
const isVisible = command.isVisible
grunt.log.ok('Checking if "' + isVisible + '" is visible.')
if (options.singleElementSelections) {
await checkSingleElement(client, isVisible)
}
return client.$(isVisible)
.then(element => element.isDisplayed(element))
.then(function (value) {
if (value !== true) {
throw new Error('"' + isVisible + '" is not visible.')
}
})
}
}