topological-nodered-wdio 0.4.7 → 0.5.0

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,91 +1,91 @@
1
- <script type="text/javascript">
2
- RED.nodes.registerType('element-check', {
3
- category: 'Webdriver IO',
4
- color: '#a6bbcf',
5
- defaults: {
6
- name: { value: '' },
7
- locateUsing: { value: 'xpath' },
8
- locateValue: { value: '' },
9
- check: { value: 'selected' }
10
- },
11
- inputs: 1,
12
- outputs: 1,
13
- icon: 'white-globe.png',
14
- label: function() {
15
- return this.name || 'element check'
16
- }
17
- })
18
- </script>
19
-
20
- <script type="text/x-red" data-template-name="element-check">
21
- <div class="form-row">
22
- <label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
23
- <select type="text" id="node-input-locateUsing" style="width:70%;">
24
- <option value="id">id</option>
25
- <option value="name">name</option>
26
- <option value="css selector">CSS selector</option>
27
- <option value="link text">Link text</option>
28
- <option value="partial link text">Partial link text</option>
29
- <option value="tag name">Tag name</option>
30
- <option value="xpath" selected>XPath</option>
31
- </select>
32
- </div>
33
- <div class="form-row">
34
- <label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
35
- <input id="node-input-locateValue" type="text">
36
- </div>
37
-
38
- <div class="form-row">
39
- <label for="node-input-check"><i class="fa fa-tasks"></i> Check</label>
40
- <select type="text" id="node-input-check" style="width:70%;">
41
- <option value="clickable">Is Clickable</option>
42
- <option value="displayed">Is Displayed</option>
43
- <option value="displayedInView">Is Displayed in Viewport</option>
44
- <option value="enabled">Is Enabled</option>
45
- <option value="existing">Is Existing</option>
46
- <option value="focused">Is Focused</option>
47
- <option value="selected">Is Selected</option>
48
- </select>
49
- </div>
50
- <div class="form-row">
51
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
52
- <input id="node-input-name" type="text">
53
- </div>
54
- </script>
55
-
56
- <script type="text/x-red" data-help-name="element-check">
57
- <h3>Selected action of the node performs a target web element inside the browser.</h3>
58
- <h3>Inputs</h3>
59
- <dl class="message-properties">
60
-
61
- <dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
62
- <dd>specifies the type of web element identifier:
63
- <ul>
64
- <li>id</li>
65
- <li>name</li>
66
- <li>CSS selector</li>
67
- <li>Link text</li>
68
- <li>Partial link text</li>
69
- <li>Tag name</li>
70
- <li>XPath</li>
71
- </ul>
72
- <br>
73
- </dd>
74
- <dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
75
- <dd>value passed to the web element identifier (Locate Method)<br></dd>
76
-
77
- </dl>
78
-
79
- <h3>Details</h3>
80
- <dl class="message-properties">
81
- <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>
82
- <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>
83
- <p><b>Check</b> specifies the action to be performed on the target web element. Actions includes:
84
- <ul>
85
- <li>Is Element Selected</li>
86
- <li>Is Element Enabled</li>
87
- <li>Is Element Displayed</li>
88
- </ul>
89
- </p>
90
- </dl>
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('element-check', {
3
+ category: 'Webdriver IO',
4
+ color: '#a6bbcf',
5
+ defaults: {
6
+ name: { value: '' },
7
+ locateUsing: { value: 'xpath' },
8
+ locateValue: { value: '' },
9
+ check: { value: 'selected' }
10
+ },
11
+ inputs: 1,
12
+ outputs: 1,
13
+ icon: 'white-globe.png',
14
+ label: function() {
15
+ return this.name || 'element check'
16
+ }
17
+ })
18
+ </script>
19
+
20
+ <script type="text/x-red" data-template-name="element-check">
21
+ <div class="form-row">
22
+ <label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
23
+ <select type="text" id="node-input-locateUsing" style="width:70%;">
24
+ <option value="id">id</option>
25
+ <option value="name">name</option>
26
+ <option value="css selector">CSS selector</option>
27
+ <option value="link text">Link text</option>
28
+ <option value="partial link text">Partial link text</option>
29
+ <option value="tag name">Tag name</option>
30
+ <option value="xpath" selected>XPath</option>
31
+ </select>
32
+ </div>
33
+ <div class="form-row">
34
+ <label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
35
+ <input id="node-input-locateValue" type="text">
36
+ </div>
37
+
38
+ <div class="form-row">
39
+ <label for="node-input-check"><i class="fa fa-tasks"></i> Check</label>
40
+ <select type="text" id="node-input-check" style="width:70%;">
41
+ <option value="clickable">Is Clickable</option>
42
+ <option value="displayed">Is Displayed</option>
43
+ <option value="displayedInView">Is Displayed in Viewport</option>
44
+ <option value="enabled">Is Enabled</option>
45
+ <option value="existing">Is Existing</option>
46
+ <option value="focused">Is Focused</option>
47
+ <option value="selected">Is Selected</option>
48
+ </select>
49
+ </div>
50
+ <div class="form-row">
51
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
52
+ <input id="node-input-name" type="text">
53
+ </div>
54
+ </script>
55
+
56
+ <script type="text/x-red" data-help-name="element-check">
57
+ <h3>Selected action of the node performs a target web element inside the browser.</h3>
58
+ <h3>Inputs</h3>
59
+ <dl class="message-properties">
60
+
61
+ <dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
62
+ <dd>specifies the type of web element identifier:
63
+ <ul>
64
+ <li>id</li>
65
+ <li>name</li>
66
+ <li>CSS selector</li>
67
+ <li>Link text</li>
68
+ <li>Partial link text</li>
69
+ <li>Tag name</li>
70
+ <li>XPath</li>
71
+ </ul>
72
+ <br>
73
+ </dd>
74
+ <dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
75
+ <dd>value passed to the web element identifier (Locate Method)<br></dd>
76
+
77
+ </dl>
78
+
79
+ <h3>Details</h3>
80
+ <dl class="message-properties">
81
+ <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>
82
+ <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>
83
+ <p><b>Check</b> specifies the action to be performed on the target web element. Actions includes:
84
+ <ul>
85
+ <li>Is Element Selected</li>
86
+ <li>Is Element Enabled</li>
87
+ <li>Is Element Displayed</li>
88
+ </ul>
89
+ </p>
90
+ </dl>
91
91
  </script>
@@ -1,62 +1,62 @@
1
- const common = require('./wdio-common')
2
-
3
- module.exports = function (RED) {
4
- function elementCheck(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
- if (config.check === 'clickable') {
22
- node.log = `Check the webelement is clickable, identified using ${locateUsing}: "${locateValue}".`
23
- msg.payload = await browser.$(locator).isClickable()
24
- } else if (config.check === 'displayed') {
25
- node.log = `Check the webelement is displayed, identified using ${locateUsing}: "${locateValue}".`
26
- msg.payload = await browser.$(locator).isDisplayed()
27
- } else if (config.check === 'displayedInView') {
28
- node.log = `Check the webelement is displayed in view port, identified using ${locateUsing}: "${locateValue}".`
29
- msg.payload = await browser.$(locator).isDisplayedInViewport()
30
- } else if (config.check === 'enabled') {
31
- node.log = `Check the webelement is enabled, identified using ${locateUsing}: "${locateValue}".`
32
- msg.payload = await browser.$(locator).isEnabled()
33
- } else if (config.check === 'existing') {
34
- node.log = `Check the webelement is existing, identified using ${locateUsing}: "${locateValue}".`
35
- msg.payload = await browser.$(locator).isExisting()
36
- } else if (config.check === 'focused') {
37
- node.log = `Check the webelement is focused, identified using ${locateUsing}: "${locateValue}".`
38
- msg.payload = await browser.$(locator).isFocused()
39
- } else if (config.check === 'selected') {
40
- node.log = `Check the webelement is selected, identified using ${locateUsing}: "${locateValue}".`
41
- msg.payload = await browser.$(locator).isSelected()
42
- }
43
- await common.log(node)
44
- common.successStatus(node)
45
- node.send(msg)
46
- } catch (e) {
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{
55
- await common.log(node)
56
- common.handleError(e, node, msg)
57
- }
58
- //}
59
- })
60
- }
61
- RED.nodes.registerType('element-check', elementCheck)
62
- }
1
+ const common = require('./wdio-common')
2
+
3
+ module.exports = function (RED) {
4
+ function elementCheck(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
+ if (config.check === 'clickable') {
22
+ node.log = `Check the webelement is clickable, identified using ${locateUsing}: "${locateValue}".`
23
+ msg.payload = await browser.$(locator).isClickable()
24
+ } else if (config.check === 'displayed') {
25
+ node.log = `Check the webelement is displayed, identified using ${locateUsing}: "${locateValue}".`
26
+ msg.payload = await browser.$(locator).isDisplayed()
27
+ } else if (config.check === 'displayedInView') {
28
+ node.log = `Check the webelement is displayed in view port, identified using ${locateUsing}: "${locateValue}".`
29
+ msg.payload = await browser.$(locator).isDisplayedInViewport()
30
+ } else if (config.check === 'enabled') {
31
+ node.log = `Check the webelement is enabled, identified using ${locateUsing}: "${locateValue}".`
32
+ msg.payload = await browser.$(locator).isEnabled()
33
+ } else if (config.check === 'existing') {
34
+ node.log = `Check the webelement is existing, identified using ${locateUsing}: "${locateValue}".`
35
+ msg.payload = await browser.$(locator).isExisting()
36
+ } else if (config.check === 'focused') {
37
+ node.log = `Check the webelement is focused, identified using ${locateUsing}: "${locateValue}".`
38
+ msg.payload = await browser.$(locator).isFocused()
39
+ } else if (config.check === 'selected') {
40
+ node.log = `Check the webelement is selected, identified using ${locateUsing}: "${locateValue}".`
41
+ msg.payload = await browser.$(locator).isSelected()
42
+ }
43
+ await common.log(node)
44
+ common.successStatus(node)
45
+ node.send(msg)
46
+ } catch (e) {
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{
55
+ await common.log(node)
56
+ common.handleError(e, node, msg)
57
+ }
58
+ //}
59
+ })
60
+ }
61
+ RED.nodes.registerType('element-check', elementCheck)
62
+ }
@@ -1,92 +1,92 @@
1
- <script type="text/javascript">
2
- RED.nodes.registerType('execute-script', {
3
- category: 'Webdriver IO',
4
- color: '#a6bbcf',
5
- defaults: {
6
- name: { value: '' },
7
- locateUsing: { value: 'xpath' },
8
- locateValue: { value: '' },
9
- action: { value: 'sync' },
10
- script: { value: '' }
11
- },
12
- inputs: 1,
13
- outputs: 1,
14
- icon: 'white-globe.png',
15
- label: function() {
16
- return this.name || 'execute script'
17
- }
18
- })
19
- </script>
20
-
21
- <script type="text/x-red" data-template-name="execute-script">
22
- <div class="form-row">
23
- <label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
24
- <select type="text" id="node-input-locateUsing" style="width:70%;">
25
- <option value="id">id</option>
26
- <option value="name">name</option>
27
- <option value="css selector">CSS selector</option>
28
- <option value="link text">Link text</option>
29
- <option value="partial link text">Partial link text</option>
30
- <option value="tag name">Tag name</option>
31
- <option value="xpath" selected>XPath</option>
32
- </select>
33
- </div>
34
- <div class="form-row">
35
- <label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
36
- <input id="node-input-locateValue" type="text">
37
- </div>
38
- <div class="form-row">
39
- <label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
40
- <select type="text" id="node-input-action" style="width:70%;">
41
- <option value="sync">Sync</option>
42
- <option value="aSync">Async</option>
43
- </select>
44
- </div>
45
- <div class="form-row">
46
- <label for="node-input-script"><i class="fa fa-tasks"></i> Script</label>
47
- <input id="node-input-script" type="text" placeholder="javascript in string">
48
- </div>
49
- <div class="form-row">
50
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
51
- <input id="node-input-name" type="text">
52
- </div>
53
- </script>
54
-
55
- <script type="text/x-red" data-help-name="execute-script">
56
- <h3>Execute javascript commands on a target web element.</h3>
57
- <h3>Inputs</h3>
58
- <dl class="message-properties">
59
-
60
- <dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
61
- <dd>specifies the type of web element identifier:
62
- <ul>
63
- <li>id</li>
64
- <li>name</li>
65
- <li>CSS selector</li>
66
- <li>Link text</li>
67
- <li>Partial link text</li>
68
- <li>Tag name</li>
69
- <li>XPath</li>
70
- </ul>
71
- <br>
72
- </dd>
73
- <dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
74
- <dd>value passed to the web element identifier (Locate Method)<br></dd>
75
-
76
- <dt><code>msg.script</code><span class="property-type">string</span></dt>
77
- <dd>This is the script that would run in the context frame; the selected web element(Selector) would be passed as an argument.</dd>
78
- </dl>
79
-
80
- <h3>Details</h3>
81
- <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>
82
- <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>
83
- <p><b>Action</b>
84
- <ul>
85
- <li>Sync: executes a JavaScript function in the context of the current browsing context. Selector is passed in as an argument. <code>browser.executeScript(script, args)</code></li>
86
- <li>Async: inject a snippet of JavaScript into the page for asynchronous execution in the context of the currently selected frame. Selector is passed in as argument/ <code>browser.executeAsyncScript(script, args)</code></li>
87
- </ul>
88
- </p>
89
- <p><b>Script</b> The script that would would run in the context browser<br></p>
90
- </script>
91
-
92
-
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('execute-script', {
3
+ category: 'Webdriver IO',
4
+ color: '#a6bbcf',
5
+ defaults: {
6
+ name: { value: '' },
7
+ locateUsing: { value: 'xpath' },
8
+ locateValue: { value: '' },
9
+ action: { value: 'sync' },
10
+ script: { value: '' }
11
+ },
12
+ inputs: 1,
13
+ outputs: 1,
14
+ icon: 'white-globe.png',
15
+ label: function() {
16
+ return this.name || 'execute script'
17
+ }
18
+ })
19
+ </script>
20
+
21
+ <script type="text/x-red" data-template-name="execute-script">
22
+ <div class="form-row">
23
+ <label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
24
+ <select type="text" id="node-input-locateUsing" style="width:70%;">
25
+ <option value="id">id</option>
26
+ <option value="name">name</option>
27
+ <option value="css selector">CSS selector</option>
28
+ <option value="link text">Link text</option>
29
+ <option value="partial link text">Partial link text</option>
30
+ <option value="tag name">Tag name</option>
31
+ <option value="xpath" selected>XPath</option>
32
+ </select>
33
+ </div>
34
+ <div class="form-row">
35
+ <label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
36
+ <input id="node-input-locateValue" type="text">
37
+ </div>
38
+ <div class="form-row">
39
+ <label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
40
+ <select type="text" id="node-input-action" style="width:70%;">
41
+ <option value="sync">Sync</option>
42
+ <option value="aSync">Async</option>
43
+ </select>
44
+ </div>
45
+ <div class="form-row">
46
+ <label for="node-input-script"><i class="fa fa-tasks"></i> Script</label>
47
+ <input id="node-input-script" type="text" placeholder="javascript in string">
48
+ </div>
49
+ <div class="form-row">
50
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
51
+ <input id="node-input-name" type="text">
52
+ </div>
53
+ </script>
54
+
55
+ <script type="text/x-red" data-help-name="execute-script">
56
+ <h3>Execute javascript commands on a target web element.</h3>
57
+ <h3>Inputs</h3>
58
+ <dl class="message-properties">
59
+
60
+ <dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
61
+ <dd>specifies the type of web element identifier:
62
+ <ul>
63
+ <li>id</li>
64
+ <li>name</li>
65
+ <li>CSS selector</li>
66
+ <li>Link text</li>
67
+ <li>Partial link text</li>
68
+ <li>Tag name</li>
69
+ <li>XPath</li>
70
+ </ul>
71
+ <br>
72
+ </dd>
73
+ <dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
74
+ <dd>value passed to the web element identifier (Locate Method)<br></dd>
75
+
76
+ <dt><code>msg.script</code><span class="property-type">string</span></dt>
77
+ <dd>This is the script that would run in the context frame; the selected web element(Selector) would be passed as an argument.</dd>
78
+ </dl>
79
+
80
+ <h3>Details</h3>
81
+ <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>
82
+ <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>
83
+ <p><b>Action</b>
84
+ <ul>
85
+ <li>Sync: executes a JavaScript function in the context of the current browsing context. Selector is passed in as an argument. <code>browser.executeScript(script, args)</code></li>
86
+ <li>Async: inject a snippet of JavaScript into the page for asynchronous execution in the context of the currently selected frame. Selector is passed in as argument/ <code>browser.executeAsyncScript(script, args)</code></li>
87
+ </ul>
88
+ </p>
89
+ <p><b>Script</b> The script that would would run in the context browser<br></p>
90
+ </script>
91
+
92
+
@@ -1,40 +1,40 @@
1
- const common = require('./wdio-common')
2
-
3
- module.exports = function(RED) {
4
- function executeScript(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 element = await common.getElement(
16
- browser,
17
- locateUsing,
18
- locateValue
19
- )
20
-
21
- let script = config.script || msg.script
22
-
23
- if (config.action === 'sync') {
24
- node.log = `Execute synchronous Javascript: "${script}"${element?` By passing the webelement identified using ${locateUsing}: "${locateValue}"`:''}.`
25
- await browser.executeScript(script, Array.from(element))
26
- } else if (config.action === 'aSync') {
27
- node.log = `Execute the asynchronous Javascript: "${script}"${element?` By passing the webelement identified using ${locateUsing}: "${locateValue}"`:''}.`
28
- await browser.executeAsyncScript(script, Array.from(element))
29
- }
30
- await common.log(node)
31
- common.successStatus(node)
32
- node.send(msg)
33
- } catch (e) {
34
- await common.log(node)
35
- common.handleError(e, node, msg)
36
- }
37
- })
38
- }
39
- RED.nodes.registerType('execute-script', executeScript)
40
- }
1
+ const common = require('./wdio-common')
2
+
3
+ module.exports = function(RED) {
4
+ function executeScript(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 element = await common.getElement(
16
+ browser,
17
+ locateUsing,
18
+ locateValue
19
+ )
20
+
21
+ let script = config.script || msg.script
22
+
23
+ if (config.action === 'sync') {
24
+ node.log = `Execute synchronous Javascript: "${script}"${element?` By passing the webelement identified using ${locateUsing}: "${locateValue}"`:''}.`
25
+ await browser.executeScript(script, Array.from(element))
26
+ } else if (config.action === 'aSync') {
27
+ node.log = `Execute the asynchronous Javascript: "${script}"${element?` By passing the webelement identified using ${locateUsing}: "${locateValue}"`:''}.`
28
+ await browser.executeAsyncScript(script, Array.from(element))
29
+ }
30
+ await common.log(node)
31
+ common.successStatus(node)
32
+ node.send(msg)
33
+ } catch (e) {
34
+ await common.log(node)
35
+ common.handleError(e, node, msg)
36
+ }
37
+ })
38
+ }
39
+ RED.nodes.registerType('execute-script', executeScript)
40
+ }