Skip to content

Commit e9812ca

Browse files
Harrus1683prantlf
authored andcommitted
feat: Add a new instruction clickIfVisible
To be able to close random appearing dialog.
1 parent a1cd59a commit e9812ca

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

tasks/html-dom-snapshot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const nodeCleanup = require('node-cleanup')
1717
const instructions = [
1818
'setViewport', 'url', 'go', 'scroll', 'clearValue', 'setValue', 'addValue',
1919
'selectOptionByIndex', 'selectOptionByValue', 'moveCursor',
20-
'click', 'keys', 'wait', 'hasAttribute', 'hasClass', 'hasValue',
20+
'click', 'clickIfVisible', 'keys', 'wait', 'hasAttribute', 'hasClass', 'hasValue',
2121
'hasText', 'hasInnerHtml', 'hasOuterHtml',
2222
'isEnabled', 'isExisting', 'isFocused', 'isSelected', 'isVisible',
2323
'isVisibleWithinViewport', 'isNotEnabled', 'isNotExisting',
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict'
2+
3+
module.exports = {
4+
detect: function (command) {
5+
return !!command.clickIfVisible;
6+
},
7+
8+
perform: function (grunt, target, client, command) {
9+
console.log('target "' + target + '".');
10+
const clickIfVisible = command.clickIfVisible;
11+
client.isVisible(clickIfVisible).then(function(value) {
12+
if (value === true) {
13+
grunt.verbose.writeln('ClickIfVisible on "' + clickIfVisible + '".');
14+
return client.click(clickIfVisible);
15+
}else{
16+
grunt.verbose.writeln('ClickIfVisible on "' + clickIfVisible + '" skipped because control is not visible.');
17+
18+
}
19+
});
20+
}
21+
}

tasks/instructions/hasOuterHtml.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module.exports = {
44
detect: function (command) {
5-
return !!command.hasInnhasOuterHtmlerHtml
5+
return !!command.hasOuterHtml
66
},
77

88
perform: function (grunt, target, client, command) {

0 commit comments

Comments
 (0)