@nightwatch/nightwatch-inspector
Version:
Nightwatch Inspector that allows you to tests command directly from the browser
27 lines (20 loc) • 780 B
JavaScript
/* eslint-disable no-undef */
/**
* TRY NIGHTWATCH COMMANDS
*/
const tryNightwatchCommandId = 'tryNightwatchCommand';
const nightwatchCommandId = 'nightwatchCommand';
function tryNightwatchCommand() {
const nightwatchCommandElement = document.getElementById(nightwatchCommandId);
const nightwatchCommand = nightwatchCommandElement.value;
webSocket.send(nightwatchCommand);
// setting explore mode false when trying out nightwatch commands
sendMessageToBackground('EXPLORE_MODE', false);
}
document.getElementById(tryNightwatchCommandId).addEventListener('click', tryNightwatchCommand);
document.getElementById(nightwatchCommandId).addEventListener('keydown', function(e) {
if (e.key === 'Enter') {
e.preventDefault();
tryNightwatchCommand();
}
});