topological-nodered-wdio 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/element-check.js +15 -5
package/package.json
CHANGED
package/src/element-check.js
CHANGED
|
@@ -18,6 +18,7 @@ module.exports = function (RED) {
|
|
|
18
18
|
locateUsing,
|
|
19
19
|
locateValue
|
|
20
20
|
)
|
|
21
|
+
await element.waitForDisplayed({timeout: 10000, reverse: false, timeoutMsg: 'unable to find', interval : 2000})
|
|
21
22
|
|
|
22
23
|
if (config.check === 'clickable') {
|
|
23
24
|
node.log = `Check the webelement is clickable, identified using ${locateUsing}: "${locateValue}".`
|
|
@@ -27,26 +28,35 @@ module.exports = function (RED) {
|
|
|
27
28
|
msg.payload = await element.isDisplayed()
|
|
28
29
|
} else if (config.check === 'displayedInView') {
|
|
29
30
|
node.log = `Check the webelement is displayed in view port, identified using ${locateUsing}: "${locateValue}".`
|
|
30
|
-
msg.payload = await
|
|
31
|
+
msg.payload = await element.isDisplayedInViewport()
|
|
31
32
|
} else if (config.check === 'enabled') {
|
|
32
33
|
node.log = `Check the webelement is enabled, identified using ${locateUsing}: "${locateValue}".`
|
|
33
34
|
msg.payload = await element.isEnabled()
|
|
34
35
|
} else if (config.check === 'existing') {
|
|
35
36
|
node.log = `Check the webelement is existing, identified using ${locateUsing}: "${locateValue}".`
|
|
36
|
-
msg.payload = await
|
|
37
|
+
msg.payload = await element.isExisting()
|
|
37
38
|
} else if (config.check === 'focused') {
|
|
38
39
|
node.log = `Check the webelement is focused, identified using ${locateUsing}: "${locateValue}".`
|
|
39
40
|
msg.payload = await element.isFocused()
|
|
40
41
|
} else if (config.check === 'selected') {
|
|
41
42
|
node.log = `Check the webelement is selected, identified using ${locateUsing}: "${locateValue}".`
|
|
42
|
-
msg.payload = await
|
|
43
|
+
msg.payload = await element.isSelected()
|
|
43
44
|
}
|
|
44
45
|
await common.log(node)
|
|
45
46
|
common.successStatus(node)
|
|
46
47
|
node.send(msg)
|
|
47
48
|
} catch (e) {
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
if(e.message == 'unable to find'){
|
|
50
|
+
msg.payload = false
|
|
51
|
+
node.log = `Webelement is NOT displayed, identified using ${locateUsing}: "${locateValue}".`
|
|
52
|
+
await common.log(node)
|
|
53
|
+
common.successStatus(node)
|
|
54
|
+
node.send(msg)
|
|
55
|
+
}
|
|
56
|
+
else{
|
|
57
|
+
await common.log(node)
|
|
58
|
+
common.handleError(e, node, msg)
|
|
59
|
+
}
|
|
50
60
|
}
|
|
51
61
|
})
|
|
52
62
|
}
|