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