topological-nodered-wdio 0.5.0 → 0.5.2

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.
@@ -1,127 +1,127 @@
1
- <script type="text/javascript">
2
- function setExplicitAction() {
3
- let action = $('#node-input-action').val()
4
- $('#actionTime').show()
5
- $('#actionReverse').show()
6
- $('#actionError').show()
7
- if (action === 'until') {
8
- $('#actionTime').hide()
9
- $('#actionReverse').hide()
10
- $('#actionError').hide()
11
- }
12
- }
13
-
14
- RED.nodes.registerType('explicit-wait', {
15
- category: 'Webdriver IO',
16
- color: '#a6bbcf',
17
- defaults: {
18
- name: { value: '' },
19
- locateUsing: { value: 'xpath' },
20
- locateValue: { value: '' },
21
- action: { value: '' },
22
- time: { value: '' },
23
- reverse: { value: 'false' },
24
- error: { value: '' }
25
- },
26
- inputs: 1,
27
- outputs: 1,
28
- icon: 'white-globe.png',
29
- label: function() {
30
- return this.name || 'explicit wait'
31
- },
32
- oneditprepare: function() {
33
- setExplicitAction()
34
- }
35
- })
36
- </script>
37
-
38
- <script type="text/x-red" data-template-name="explicit-wait">
39
- <div class="form-row">
40
- <label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
41
- <select type="text" id="node-input-locateUsing" style="width:70%;">
42
- <option value="id">id</option>
43
- <option value="name">name</option>
44
- <option value="className">Class Name</option>
45
- <option value="css selector">CSS selector</option>
46
- <option value="link text">Link text</option>
47
- <option value="partial link text">Partial link text</option>
48
- <option value="tag name">Tag name</option>
49
- <option value="xpath" selected>XPath</option>
50
- </select>
51
- </div>
52
- <div class="form-row">
53
- <label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
54
- <input id="node-input-locateValue" type="text">
55
- </div>
56
- <div class="form-row">
57
- <label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
58
- <select type="text" id="node-input-action" style="width:70%;" onchange="setExplicitAction()">
59
- <option value="displayed">Wait for Displayed</option>
60
- <option value="enabled">Wait for Enabled</option>
61
- <option value="exists">Wait for Exist</option>
62
- <!-- <option value="until">Wait Until</option> -->
63
- </select>
64
- </div>
65
- <div class="form-row" id="actionTime" >
66
- <label for="node-input-time"><i class="fa fa-tasks"></i> Time to Wait</label>
67
- <input id="node-input-time" type="text" placeholder="in ms">
68
- </div>
69
- <div class="form-row" id="actionReverse" >
70
- <label for="node-input-reverse"><i class="fa fa-tasks"></i> Reverse</label>
71
- <select type="text" id="node-input-reverse" style="width:70%;">
72
- <option value="false">false</option>
73
- <option value="true">true</option>
74
- </select>
75
- </div>
76
- <div class="form-row" id="actionError" >
77
- <label for="node-input-error"><i class="fa fa-tasks"></i> Error Message</label>
78
- <input id="node-input-error" type="text" placeholder="error message">
79
- </div>
80
- <div class="form-row">
81
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
82
- <input id="node-input-name" type="text">
83
- </div>
84
- </script>
85
-
86
- <script type="text/x-red" data-help-name="explicit-wait">
87
- <h3>The Set Timeouts command sets timeout durations associated with the current session.</h3>
88
- <h3>Inputs</h3>
89
- <dl class="message-properties">
90
- <dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
91
- <dd>specifies the type of web element identifier:
92
- <ul>
93
- <li>id</li>
94
- <li>name</li>
95
- <li>CSS selector</li>
96
- <li>Link text</li>
97
- <li>Partial link text</li>
98
- <li>Tag name</li>
99
- <li>XPath</li>
100
- </ul>
101
- <br>
102
- </dd>
103
- <dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
104
- <dd>value passed to the web element identifier (Locate Method)<br></dd>
105
-
106
- <dt><code>msg.reverse</code><span class="property-type">boolean</span></dt>
107
- <dd>If set to true, webdriver will wait for the <i>opposite</i> of the action selected<br></dd>
108
- </dl>
109
-
110
- <h3>Details</h3>
111
- <p><b>Locate Method</b> specifies the method used to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateUsing</code><br></p>
112
- <p><b>Selector</b> value used by the Locate Method to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateValue</code><br></p>
113
- <p><b>Action</b> to perform on the pop-up alert/window:
114
- <ul>
115
- <li>Wait for Displayed</li>
116
- <li>Wait for Enabled</li>
117
- <li>Wait for Exist</li>
118
- <li>Wait Until</li>
119
- </ul>
120
- </p>
121
- <p><b>Time to Wait</b> Set time to wait in milliseconds. <br></p>
122
- <p><b>Reverse</b> If set to true, webdriver will wait for the <i>opposite</i> of the action selected. <br></p>
123
- <p><b>Error Message</b> If an error exists this error message overrides the default error message. <br></p>
124
-
125
-
126
-
1
+ <script type="text/javascript">
2
+ function setExplicitAction() {
3
+ let action = $('#node-input-action').val()
4
+ $('#actionTime').show()
5
+ $('#actionReverse').show()
6
+ $('#actionError').show()
7
+ if (action === 'until') {
8
+ $('#actionTime').hide()
9
+ $('#actionReverse').hide()
10
+ $('#actionError').hide()
11
+ }
12
+ }
13
+
14
+ RED.nodes.registerType('explicit-wait', {
15
+ category: 'Webdriver IO',
16
+ color: '#a6bbcf',
17
+ defaults: {
18
+ name: { value: '' },
19
+ locateUsing: { value: 'xpath' },
20
+ locateValue: { value: '' },
21
+ action: { value: '' },
22
+ time: { value: '' },
23
+ reverse: { value: 'false' },
24
+ error: { value: '' }
25
+ },
26
+ inputs: 1,
27
+ outputs: 1,
28
+ icon: 'white-globe.png',
29
+ label: function() {
30
+ return this.name || 'explicit wait'
31
+ },
32
+ oneditprepare: function() {
33
+ setExplicitAction()
34
+ }
35
+ })
36
+ </script>
37
+
38
+ <script type="text/x-red" data-template-name="explicit-wait">
39
+ <div class="form-row">
40
+ <label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
41
+ <select type="text" id="node-input-locateUsing" style="width:70%;">
42
+ <option value="id">id</option>
43
+ <option value="name">name</option>
44
+ <option value="className">Class Name</option>
45
+ <option value="css selector">CSS selector</option>
46
+ <option value="link text">Link text</option>
47
+ <option value="partial link text">Partial link text</option>
48
+ <option value="tag name">Tag name</option>
49
+ <option value="xpath" selected>XPath</option>
50
+ </select>
51
+ </div>
52
+ <div class="form-row">
53
+ <label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
54
+ <input id="node-input-locateValue" type="text">
55
+ </div>
56
+ <div class="form-row">
57
+ <label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
58
+ <select type="text" id="node-input-action" style="width:70%;" onchange="setExplicitAction()">
59
+ <option value="displayed">Wait for Displayed</option>
60
+ <option value="enabled">Wait for Enabled</option>
61
+ <option value="exists">Wait for Exist</option>
62
+ <!-- <option value="until">Wait Until</option> -->
63
+ </select>
64
+ </div>
65
+ <div class="form-row" id="actionTime" >
66
+ <label for="node-input-time"><i class="fa fa-tasks"></i> Time to Wait</label>
67
+ <input id="node-input-time" type="text" placeholder="in ms">
68
+ </div>
69
+ <div class="form-row" id="actionReverse" >
70
+ <label for="node-input-reverse"><i class="fa fa-tasks"></i> Reverse</label>
71
+ <select type="text" id="node-input-reverse" style="width:70%;">
72
+ <option value="false">false</option>
73
+ <option value="true">true</option>
74
+ </select>
75
+ </div>
76
+ <div class="form-row" id="actionError" >
77
+ <label for="node-input-error"><i class="fa fa-tasks"></i> Error Message</label>
78
+ <input id="node-input-error" type="text" placeholder="error message">
79
+ </div>
80
+ <div class="form-row">
81
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
82
+ <input id="node-input-name" type="text">
83
+ </div>
84
+ </script>
85
+
86
+ <script type="text/x-red" data-help-name="explicit-wait">
87
+ <h3>The Set Timeouts command sets timeout durations associated with the current session.</h3>
88
+ <h3>Inputs</h3>
89
+ <dl class="message-properties">
90
+ <dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
91
+ <dd>specifies the type of web element identifier:
92
+ <ul>
93
+ <li>id</li>
94
+ <li>name</li>
95
+ <li>CSS selector</li>
96
+ <li>Link text</li>
97
+ <li>Partial link text</li>
98
+ <li>Tag name</li>
99
+ <li>XPath</li>
100
+ </ul>
101
+ <br>
102
+ </dd>
103
+ <dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
104
+ <dd>value passed to the web element identifier (Locate Method)<br></dd>
105
+
106
+ <dt><code>msg.reverse</code><span class="property-type">boolean</span></dt>
107
+ <dd>If set to true, webdriver will wait for the <i>opposite</i> of the action selected<br></dd>
108
+ </dl>
109
+
110
+ <h3>Details</h3>
111
+ <p><b>Locate Method</b> specifies the method used to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateUsing</code><br></p>
112
+ <p><b>Selector</b> value used by the Locate Method to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateValue</code><br></p>
113
+ <p><b>Action</b> to perform on the pop-up alert/window:
114
+ <ul>
115
+ <li>Wait for Displayed</li>
116
+ <li>Wait for Enabled</li>
117
+ <li>Wait for Exist</li>
118
+ <li>Wait Until</li>
119
+ </ul>
120
+ </p>
121
+ <p><b>Time to Wait</b> Set time to wait in milliseconds. <br></p>
122
+ <p><b>Reverse</b> If set to true, webdriver will wait for the <i>opposite</i> of the action selected. <br></p>
123
+ <p><b>Error Message</b> If an error exists this error message overrides the default error message. <br></p>
124
+
125
+
126
+
127
127
  </script>
@@ -1,48 +1,48 @@
1
- const common = require('./wdio-common')
2
-
3
- module.exports = function(RED) {
4
- function explicitWait(config) {
5
- RED.nodes.createNode(this, config)
6
- const node = this
7
- common.clearStatus(node)
8
-
9
- node.on('input', async (msg) => {
10
- try {
11
- let locateUsing = config.locateUsing || msg.locateUsing
12
- let locateValue = config.locateValue || msg.locateValue
13
-
14
- let browser = await common.getBrowser(node.context())
15
- let locator = await common.getLocator(
16
- browser,
17
- locateUsing,
18
- locateValue
19
- )
20
-
21
- let time = parseInt(config.time || msg.time)
22
- let reverse = config.reverse === 'true' || msg.reverse
23
- let error = config.error || msg.error
24
-
25
- if (config.action === 'displayed') {
26
- node.log = `Waiting for the element to be displayed for ${time}, identified using ${locateUsing}: "${locateValue}".`
27
- await browser.$(locator).waitForDisplayed({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
28
- } else if (config.action === 'enabled') {
29
- node.log = `Waiting for the element to be enabled for ${time}, identified using ${locateUsing}: "${locateValue}".`
30
- await browser.$(locator).waitForEnabled({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
31
- } else if (config.action === 'exists') {
32
- node.log = `Waiting for the element to be exists for ${time}, identified using ${locateUsing}: "${locateValue}".`
33
- await browser.$(locator).waitForExist({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
34
- } else if (config.action === 'until') {
35
- await browser.$(locator).waitUntil()
36
- }
37
-
38
- await common.log(node)
39
- common.successStatus(node)
40
- node.send(msg)
41
- } catch (e) {
42
- await common.log(node)
43
- common.handleError(e, node, msg)
44
- }
45
- })
46
- }
47
- RED.nodes.registerType('explicit-wait', explicitWait)
48
- }
1
+ const common = require('./wdio-common')
2
+
3
+ module.exports = function(RED) {
4
+ function explicitWait(config) {
5
+ RED.nodes.createNode(this, config)
6
+ const node = this
7
+ common.clearStatus(node)
8
+
9
+ node.on('input', async (msg) => {
10
+ try {
11
+ let locateUsing = config.locateUsing || msg.locateUsing
12
+ let locateValue = config.locateValue || msg.locateValue
13
+
14
+ let browser = await common.getBrowser(node.context())
15
+ let locator = await common.getLocator(
16
+ browser,
17
+ locateUsing,
18
+ locateValue
19
+ )
20
+
21
+ let time = parseInt(config.time || msg.time)
22
+ let reverse = config.reverse === 'true' || msg.reverse
23
+ let error = config.error || msg.error
24
+
25
+ if (config.action === 'displayed') {
26
+ node.log = `Waiting for the element to be displayed for ${time}, identified using ${locateUsing}: "${locateValue}".`
27
+ await browser.$(locator).waitForDisplayed({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
28
+ } else if (config.action === 'enabled') {
29
+ node.log = `Waiting for the element to be enabled for ${time}, identified using ${locateUsing}: "${locateValue}".`
30
+ await browser.$(locator).waitForEnabled({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
31
+ } else if (config.action === 'exists') {
32
+ node.log = `Waiting for the element to be exists for ${time}, identified using ${locateUsing}: "${locateValue}".`
33
+ await browser.$(locator).waitForExist({timeout: time, reverse: reverse, timeoutMsg: error, interval : 2000})
34
+ } else if (config.action === 'until') {
35
+ await browser.$(locator).waitUntil()
36
+ }
37
+
38
+ await common.log(node)
39
+ common.successStatus(node)
40
+ node.send(msg)
41
+ } catch (e) {
42
+ await common.log(node)
43
+ common.handleError(e, node, msg)
44
+ }
45
+ })
46
+ }
47
+ RED.nodes.registerType('explicit-wait', explicitWait)
48
+ }
@@ -1,67 +1,67 @@
1
- <script type="text/javascript">
2
- function setFrameAction() {
3
- let action = $('#node-input-action').val()
4
- $('#actionFrame').hide()
5
- if (action === 'frame') {
6
- $('#actionFrame').show()
7
- }
8
- }
9
-
10
- RED.nodes.registerType('frame-action', {
11
- category: 'Webdriver IO',
12
- color: '#a6bbcf',
13
- defaults: {
14
- name: { value: '' },
15
- action: { value: 'frame' },
16
- frame: { value: '' }
17
- },
18
- inputs: 1,
19
- outputs: 1,
20
- icon: 'white-globe.png',
21
- label: function() {
22
- return this.name || 'frame action'
23
- },
24
- oneditprepare: function() {
25
- setFrameAction()
26
- }
27
- })
28
- </script>
29
-
30
- <script type="text/x-red" data-template-name="frame-action">
31
- <div class="form-row">
32
- <label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
33
- <select type="text" id="node-input-action" style="width:70%;" onchange="setFrameAction()">
34
- <option value="frame">Switch to Frame</option>
35
- <option value="parentFrame">Switch to Parent Frame</option>
36
- </select>
37
- </div>
38
- <div class="form-row" id="actionFrame">
39
- <label for="node-input-frame"><i class="fa fa-tasks"></i> Frame Name</label>
40
- <input id="node-input-frame" type="text" >
41
- </div>
42
- <div class="form-row">
43
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
44
- <input id="node-input-name" type="text">
45
- </div>
46
- </script>
47
-
48
- <script type="text/x-red" data-help-name="frame-action">
49
- <h3>Select the current top-level browsing context or a child/parent browsing context of the current browsing context to use as the current browsing context for subsequent commands</h3>
50
- <h3>Details</h3>
51
- <dl class="message-properties">
52
- <dt>Action: <span class="property-type">select</span></dt>
53
- <dd>
54
- <ul>
55
- <li><b>Switch to Frame</b></li>
56
- <ul>
57
- <li>The Switch To Frame command is used to select the current top-level browsing context or a child browsing context of the current browsing context to use as the current browsing context for subsequent commands.</li>
58
- </ul>
59
- <li><b>Switch to Parent Frame</b></li>
60
- <ul>
61
- <li>The Switch to Parent Frame command sets the current browsing context for future commands to the parent of the current browsing context.</li>
62
- </ul>
63
- </ul>
64
- </dd>
65
- </dl>
66
- </script>
67
-
1
+ <script type="text/javascript">
2
+ function setFrameAction() {
3
+ let action = $('#node-input-action').val()
4
+ $('#actionFrame').hide()
5
+ if (action === 'frame') {
6
+ $('#actionFrame').show()
7
+ }
8
+ }
9
+
10
+ RED.nodes.registerType('frame-action', {
11
+ category: 'Webdriver IO',
12
+ color: '#a6bbcf',
13
+ defaults: {
14
+ name: { value: '' },
15
+ action: { value: 'frame' },
16
+ frame: { value: '' }
17
+ },
18
+ inputs: 1,
19
+ outputs: 1,
20
+ icon: 'white-globe.png',
21
+ label: function() {
22
+ return this.name || 'frame action'
23
+ },
24
+ oneditprepare: function() {
25
+ setFrameAction()
26
+ }
27
+ })
28
+ </script>
29
+
30
+ <script type="text/x-red" data-template-name="frame-action">
31
+ <div class="form-row">
32
+ <label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
33
+ <select type="text" id="node-input-action" style="width:70%;" onchange="setFrameAction()">
34
+ <option value="frame">Switch to Frame</option>
35
+ <option value="parentFrame">Switch to Parent Frame</option>
36
+ </select>
37
+ </div>
38
+ <div class="form-row" id="actionFrame">
39
+ <label for="node-input-frame"><i class="fa fa-tasks"></i> Frame Name</label>
40
+ <input id="node-input-frame" type="text" >
41
+ </div>
42
+ <div class="form-row">
43
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
44
+ <input id="node-input-name" type="text">
45
+ </div>
46
+ </script>
47
+
48
+ <script type="text/x-red" data-help-name="frame-action">
49
+ <h3>Select the current top-level browsing context or a child/parent browsing context of the current browsing context to use as the current browsing context for subsequent commands</h3>
50
+ <h3>Details</h3>
51
+ <dl class="message-properties">
52
+ <dt>Action: <span class="property-type">select</span></dt>
53
+ <dd>
54
+ <ul>
55
+ <li><b>Switch to Frame</b></li>
56
+ <ul>
57
+ <li>The Switch To Frame command is used to select the current top-level browsing context or a child browsing context of the current browsing context to use as the current browsing context for subsequent commands.</li>
58
+ </ul>
59
+ <li><b>Switch to Parent Frame</b></li>
60
+ <ul>
61
+ <li>The Switch to Parent Frame command sets the current browsing context for future commands to the parent of the current browsing context.</li>
62
+ </ul>
63
+ </ul>
64
+ </dd>
65
+ </dl>
66
+ </script>
67
+
@@ -1,38 +1,38 @@
1
- const common = require('./wdio-common')
2
-
3
- module.exports = function(RED) {
4
- function frameAction(config) {
5
- RED.nodes.createNode(this, config)
6
- const node = this
7
- common.clearStatus(node)
8
-
9
- node.on('input', async (msg) => {
10
- try {
11
- let browser = await common.getBrowser(node.context())
12
-
13
- let frame = config.frame || msg.value
14
-
15
- if (config.action === 'frame') {
16
- let checkNumber = Number(frame)
17
- if (!Number.isNaN(checkNumber)) {
18
- node.log = `Switch to frame/iFrame, identified using index: "${frame}".`
19
- await browser.switchToFrame(parseInt(frame))
20
- } else {
21
- node.log = `Switch to frame/iFrame, identified using selector: "${frame}".`
22
- //Need to fix this to find element
23
- await browser.switchToFrame(frame)
24
- }
25
- } else if (config.action === 'parentFrame') {
26
- await browser.switchToParentFrame()
27
- }
28
- await common.log(node)
29
- common.successStatus(node)
30
- node.send(msg)
31
- } catch (e) {
32
- await common.log(node)
33
- common.handleError(e, node, msg)
34
- }
35
- })
36
- }
37
- RED.nodes.registerType('frame-action', frameAction)
38
- }
1
+ const common = require('./wdio-common')
2
+
3
+ module.exports = function(RED) {
4
+ function frameAction(config) {
5
+ RED.nodes.createNode(this, config)
6
+ const node = this
7
+ common.clearStatus(node)
8
+
9
+ node.on('input', async (msg) => {
10
+ try {
11
+ let browser = await common.getBrowser(node.context())
12
+
13
+ let frame = config.frame || msg.value
14
+
15
+ if (config.action === 'frame') {
16
+ let checkNumber = Number(frame)
17
+ if (!Number.isNaN(checkNumber)) {
18
+ node.log = `Switch to frame/iFrame, identified using index: "${frame}".`
19
+ await browser.switchToFrame(parseInt(frame))
20
+ } else {
21
+ node.log = `Switch to frame/iFrame, identified using selector: "${frame}".`
22
+ //Need to fix this to find element
23
+ await browser.switchToFrame(frame)
24
+ }
25
+ } else if (config.action === 'parentFrame') {
26
+ await browser.switchToParentFrame()
27
+ }
28
+ await common.log(node)
29
+ common.successStatus(node)
30
+ node.send(msg)
31
+ } catch (e) {
32
+ await common.log(node)
33
+ common.handleError(e, node, msg)
34
+ }
35
+ })
36
+ }
37
+ RED.nodes.registerType('frame-action', frameAction)
38
+ }