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) • 691 B
JavaScript
const { checkSingleElement } = require('./utils/elements')
module.exports = {
detect: function (command) {
return !!command.isNotVisible
},
perform: async function (grunt, target, client, command, options) {
const isNotVisible = command.isNotVisible
grunt.log.ok('Checking if "' + isNotVisible + '" is not visible.')
if (options.singleElementSelections) {
await checkSingleElement(client, isNotVisible)
}
return client.$(isNotVisible)
.then(element => element.isDisplayed(element))
.then(function (value) {
if (value !== false) {
throw new Error('"' + isNotVisible + '" is visible.')
}
})
}
}