topological-nodered-wdio 0.5.4 → 1.1.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
- function setWindowAction() {
3
- let action = $('#node-input-action').val()
4
- $('#actionValue').hide()
5
- $('#actionIndex').hide()
6
- if (action === 'byName' || action === 'open') {
7
- $('#actionValue').show()
8
- }
9
- if (action == 'byIndex') {
10
- $('#actionIndex').show()
11
- }
12
- }
13
-
14
- RED.nodes.registerType('window-action', {
15
- category: 'Webdriver IO',
16
- color: '#a6bbcf',
17
- defaults: {
18
- name: { value: '' },
19
- action: { value: 'byName' },
20
- value: { value: '' },
21
- index: { value: '' }
22
- },
23
- inputs: 1,
24
- outputs: 1,
25
- icon: 'white-globe.png',
26
- label: function() {
27
- return this.name || 'window action'
28
- },
29
- oneditprepare: function() {
30
- setWindowAction()
31
- }
32
- })
33
- </script>
34
-
35
- <script type="text/x-red" data-template-name="window-action">
36
- <div class="form-row">
37
- <label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
38
- <select type="text" id="node-input-action" style="width:70%;" onchange="setWindowAction()">
39
- <option value="byName">Switch to Window by Name</option>
40
- <option value="byIndex">Switch to Window by Index</option>
41
- <option value="getHandle">Get Window handle</option>
42
- <option value="close">Close Window</option>
43
- <option value="open">Open Window</option>
44
- </select>
45
- </div>
46
- <div class="form-row" id="actionValue">
47
- <label for="node-input-value"><i class="fa fa-tasks"></i> Window Name</label>
48
- <input id="node-input-value" type="text" placeholder="URL or Title of window">
49
- </div>
50
- <div class="form-row" id="actionIndex">
51
- <label for="node-input-index"><i class="fa fa-tasks"></i> Index</label>
52
- <input id="node-input-index" type="text" placeholder="starts 0">
53
- </div>
54
- <div class="form-row">
55
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
56
- <input id="node-input-name" type="text">
57
- </div>
58
- </script>
59
-
60
- <script type="text/x-red" data-help-name="window-action">
61
- <h3>Selected action of the node performs on browser windows.</h3>
62
-
63
- <h3>Inputs</h3>
64
- <dl class="message-properties">
65
- <dt><code>msg.value</code>: <span class="property-type">string</span></dt>
66
- <dd>URL or Title the window to target</dd>
67
- <dt><code>msg.index</code><span class="property-type">string</span></dt>
68
- <dd>zero-based index to target the desired window<br></dd>
69
- </dl>
70
- <h3>Details</h3>
71
- <dl class="message-properties">
72
- <dt>Action: <span class="property-type">Select</span></dt>
73
- <dd>
74
- <ul>
75
- <li><b>Switch to Window by Name</b></li>
76
- <ul>
77
- <li>Use URL or Title to switch to the browser tab/window.</li>
78
- </ul>
79
- <li><b>Switch to Window by Index</b></li>
80
- <ul>
81
- <li>Use a zero-based index to target the browser tab/window</li>
82
- </ul>
83
- <li><b>Get window Handle</b></li>
84
- <li><b>Close Window</b></li>
85
- <li><b>Open Window</b></li>
86
- </ul>
87
- </dd>
88
- </dl>
89
-
90
- </script>
91
-
1
+ <script type="text/javascript">
2
+ function setWindowAction() {
3
+ let action = $('#node-input-action').val()
4
+ $('#actionValue').hide()
5
+ $('#actionIndex').hide()
6
+ if (action === 'byName' || action === 'open') {
7
+ $('#actionValue').show()
8
+ }
9
+ if (action == 'byIndex') {
10
+ $('#actionIndex').show()
11
+ }
12
+ }
13
+
14
+ RED.nodes.registerType('window-action', {
15
+ category: 'Webdriver IO',
16
+ color: '#a6bbcf',
17
+ defaults: {
18
+ name: { value: '' },
19
+ action: { value: 'byName' },
20
+ value: { value: '' },
21
+ index: { value: '' }
22
+ },
23
+ inputs: 1,
24
+ outputs: 1,
25
+ icon: 'white-globe.png',
26
+ label: function() {
27
+ return this.name || 'window action'
28
+ },
29
+ oneditprepare: function() {
30
+ setWindowAction()
31
+ }
32
+ })
33
+ </script>
34
+
35
+ <script type="text/x-red" data-template-name="window-action">
36
+ <div class="form-row">
37
+ <label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
38
+ <select type="text" id="node-input-action" style="width:70%;" onchange="setWindowAction()">
39
+ <option value="byName">Switch to Window by Name</option>
40
+ <option value="byIndex">Switch to Window by Index</option>
41
+ <option value="getHandle">Get Window handle</option>
42
+ <option value="close">Close Window</option>
43
+ <option value="open">Open Window</option>
44
+ </select>
45
+ </div>
46
+ <div class="form-row" id="actionValue">
47
+ <label for="node-input-value"><i class="fa fa-tasks"></i> Window Name</label>
48
+ <input id="node-input-value" type="text" placeholder="URL or Title of window">
49
+ </div>
50
+ <div class="form-row" id="actionIndex">
51
+ <label for="node-input-index"><i class="fa fa-tasks"></i> Index</label>
52
+ <input id="node-input-index" type="text" placeholder="starts 0">
53
+ </div>
54
+ <div class="form-row">
55
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
56
+ <input id="node-input-name" type="text">
57
+ </div>
58
+ </script>
59
+
60
+ <script type="text/x-red" data-help-name="window-action">
61
+ <h3>Selected action of the node performs on browser windows.</h3>
62
+
63
+ <h3>Inputs</h3>
64
+ <dl class="message-properties">
65
+ <dt><code>msg.value</code>: <span class="property-type">string</span></dt>
66
+ <dd>URL or Title the window to target</dd>
67
+ <dt><code>msg.index</code><span class="property-type">string</span></dt>
68
+ <dd>zero-based index to target the desired window<br></dd>
69
+ </dl>
70
+ <h3>Details</h3>
71
+ <dl class="message-properties">
72
+ <dt>Action: <span class="property-type">Select</span></dt>
73
+ <dd>
74
+ <ul>
75
+ <li><b>Switch to Window by Name</b></li>
76
+ <ul>
77
+ <li>Use URL or Title to switch to the browser tab/window.</li>
78
+ </ul>
79
+ <li><b>Switch to Window by Index</b></li>
80
+ <ul>
81
+ <li>Use a zero-based index to target the browser tab/window</li>
82
+ </ul>
83
+ <li><b>Get window Handle</b></li>
84
+ <li><b>Close Window</b></li>
85
+ <li><b>Open Window</b></li>
86
+ </ul>
87
+ </dd>
88
+ </dl>
89
+
90
+ </script>
91
+
@@ -1,43 +1,43 @@
1
- const common = require('./wdio-common')
2
-
3
- module.exports = function(RED) {
4
- function windowAction(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 value = config.value || msg.value
14
- let index = config.index || msg.index
15
-
16
- if (config.action === 'byName') {
17
- node.log = `Switch to the browser window with window title: "${value}".`
18
- await browser.switchWindow(value)
19
- } else if (config.action === 'byIndex') {
20
- node.log = `Switch to the browser window with window index: "${index}".`
21
- let handles = await browser.getWindowHandles()
22
- await browser.switchWindow(handles[index])
23
- } else if (config.action === 'getHandle') {
24
- node.log = `Get all the browser windows.`
25
- msg.payload = await browser.getWindowHandles()
26
- } else if (config.action === 'close') {
27
- node.log = `Close the active browser window.`
28
- await browser.closeWindow()
29
- } else if (config.action === 'open') {
30
- node.log = `Open a new window with url: "${value}".`
31
- await browser.createWindow(value)
32
- }
33
- await common.log(node)
34
- common.successStatus(node)
35
- node.send(msg)
36
- } catch (e) {
37
- await common.log(node)
38
- common.handleError(e, node, msg)
39
- }
40
- })
41
- }
42
- RED.nodes.registerType('window-action', windowAction)
43
- }
1
+ const common = require('./wdio-common')
2
+
3
+ module.exports = function(RED) {
4
+ function windowAction(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 value = config.value || msg.value
14
+ let index = config.index || msg.index
15
+
16
+ if (config.action === 'byName') {
17
+ node.log = `Switch to the browser window with window title: "${value}".`
18
+ await browser.switchWindow(value)
19
+ } else if (config.action === 'byIndex') {
20
+ node.log = `Switch to the browser window with window index: "${index}".`
21
+ let handles = await browser.getWindowHandles()
22
+ await browser.switchWindow(handles[index])
23
+ } else if (config.action === 'getHandle') {
24
+ node.log = `Get all the browser windows.`
25
+ msg.payload = await browser.getWindowHandles()
26
+ } else if (config.action === 'close') {
27
+ node.log = `Close the active browser window.`
28
+ await browser.closeWindow()
29
+ } else if (config.action === 'open') {
30
+ node.log = `Open a new window with url: "${value}".`
31
+ await browser.createWindow(value)
32
+ }
33
+ await common.log(node)
34
+ common.successStatus(node)
35
+ node.send(msg)
36
+ } catch (e) {
37
+ await common.log(node)
38
+ common.handleError(e, node, msg)
39
+ }
40
+ })
41
+ }
42
+ RED.nodes.registerType('window-action', windowAction)
43
+ }