topological-nodered-wdio 0.4.3 → 0.4.4
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 +18 -20
- package/src/explicit-wait.js +5 -5
- package/src/wdio-common.js +2 -3
package/package.json
CHANGED
package/src/element-check.js
CHANGED
|
@@ -12,52 +12,50 @@ module.exports = function (RED) {
|
|
|
12
12
|
let locateValue = config.locateValue || msg.locateValue
|
|
13
13
|
|
|
14
14
|
let browser = await common.getBrowser(node.context())
|
|
15
|
-
|
|
16
|
-
let element = await common.getElement(
|
|
15
|
+
let locator = await common.getLocator(
|
|
17
16
|
browser,
|
|
18
17
|
locateUsing,
|
|
19
18
|
locateValue
|
|
20
|
-
)
|
|
21
|
-
await element.waitForDisplayed({timeout: 10000, reverse: false, timeoutMsg: 'unable to find', interval : 2000})
|
|
19
|
+
)
|
|
22
20
|
|
|
23
21
|
if (config.check === 'clickable') {
|
|
24
22
|
node.log = `Check the webelement is clickable, identified using ${locateUsing}: "${locateValue}".`
|
|
25
|
-
msg.payload = await
|
|
23
|
+
msg.payload = await browser.$(locator).isClickable()
|
|
26
24
|
} else if (config.check === 'displayed') {
|
|
27
25
|
node.log = `Check the webelement is displayed, identified using ${locateUsing}: "${locateValue}".`
|
|
28
|
-
msg.payload = await
|
|
26
|
+
msg.payload = await browser.$(locator).isDisplayed()
|
|
29
27
|
} else if (config.check === 'displayedInView') {
|
|
30
28
|
node.log = `Check the webelement is displayed in view port, identified using ${locateUsing}: "${locateValue}".`
|
|
31
|
-
msg.payload = await
|
|
29
|
+
msg.payload = await browser.$(locator).isDisplayedInViewport()
|
|
32
30
|
} else if (config.check === 'enabled') {
|
|
33
31
|
node.log = `Check the webelement is enabled, identified using ${locateUsing}: "${locateValue}".`
|
|
34
|
-
msg.payload = await
|
|
32
|
+
msg.payload = await browser.$(locator).isEnabled()
|
|
35
33
|
} else if (config.check === 'existing') {
|
|
36
34
|
node.log = `Check the webelement is existing, identified using ${locateUsing}: "${locateValue}".`
|
|
37
|
-
msg.payload = await
|
|
35
|
+
msg.payload = await browser.$(locator).isExisting()
|
|
38
36
|
} else if (config.check === 'focused') {
|
|
39
37
|
node.log = `Check the webelement is focused, identified using ${locateUsing}: "${locateValue}".`
|
|
40
|
-
msg.payload = await
|
|
38
|
+
msg.payload = await browser.$(locator).isFocused()
|
|
41
39
|
} else if (config.check === 'selected') {
|
|
42
40
|
node.log = `Check the webelement is selected, identified using ${locateUsing}: "${locateValue}".`
|
|
43
|
-
msg.payload = await
|
|
41
|
+
msg.payload = await browser.$(locator).isSelected()
|
|
44
42
|
}
|
|
45
43
|
await common.log(node)
|
|
46
44
|
common.successStatus(node)
|
|
47
45
|
node.send(msg)
|
|
48
46
|
} catch (e) {
|
|
49
|
-
if(e.message == 'unable to find'){
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
else{
|
|
47
|
+
// if(e.message == 'unable to find'){
|
|
48
|
+
// msg.payload = false
|
|
49
|
+
// node.log = `Webelement is NOT displayed, identified using ${locateUsing}: "${locateValue}".`
|
|
50
|
+
// await common.log(node)
|
|
51
|
+
// common.successStatus(node)
|
|
52
|
+
// node.send(msg)
|
|
53
|
+
// }
|
|
54
|
+
// else{
|
|
57
55
|
await common.log(node)
|
|
58
56
|
common.handleError(e, node, msg)
|
|
59
57
|
}
|
|
60
|
-
}
|
|
58
|
+
//}
|
|
61
59
|
})
|
|
62
60
|
}
|
|
63
61
|
RED.nodes.registerType('element-check', elementCheck)
|
package/src/explicit-wait.js
CHANGED
|
@@ -12,7 +12,7 @@ module.exports = function(RED) {
|
|
|
12
12
|
let locateValue = config.locateValue || msg.locateValue
|
|
13
13
|
|
|
14
14
|
let browser = await common.getBrowser(node.context())
|
|
15
|
-
let
|
|
15
|
+
let locator = await common.getLocator(
|
|
16
16
|
browser,
|
|
17
17
|
locateUsing,
|
|
18
18
|
locateValue
|
|
@@ -24,15 +24,15 @@ module.exports = function(RED) {
|
|
|
24
24
|
|
|
25
25
|
if (config.action === 'displayed') {
|
|
26
26
|
node.log = `Waiting for the element to be displayed for ${time}, identified using ${locateUsing}: "${locateValue}".`
|
|
27
|
-
await
|
|
27
|
+
await browser.$(locator).waitForDisplayed({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
|
|
28
28
|
} else if (config.action === 'enabled') {
|
|
29
29
|
node.log = `Waiting for the element to be enabled for ${time}, identified using ${locateUsing}: "${locateValue}".`
|
|
30
|
-
await
|
|
30
|
+
await browser.$(locator).waitForEnabled({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
|
|
31
31
|
} else if (config.action === 'exists') {
|
|
32
32
|
node.log = `Waiting for the element to be exists for ${time}, identified using ${locateUsing}: "${locateValue}".`
|
|
33
|
-
await
|
|
33
|
+
await browser.$(locator).waitForExist({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
|
|
34
34
|
} else if (config.action === 'until') {
|
|
35
|
-
await
|
|
35
|
+
await browser.$(locator).waitUntil()
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
await common.log(node)
|
package/src/wdio-common.js
CHANGED
|
@@ -70,7 +70,7 @@ module.exports.getElementId = async (browser, using, value) => {
|
|
|
70
70
|
return elementId
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
module.exports.
|
|
73
|
+
module.exports.getLocator = async (browser, using, value) => {
|
|
74
74
|
let locator = ''
|
|
75
75
|
switch (using) {
|
|
76
76
|
case 'id':
|
|
@@ -101,8 +101,7 @@ module.exports.getElement = async (browser, using, value) => {
|
|
|
101
101
|
locator = value
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
return element
|
|
104
|
+
return locator
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
module.exports.handleError = (e, node, msg) => {
|