topological-nodered-wdio 0.5.4 → 1.0.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,96 +1,96 @@
1
- <script type="text/javascript">
2
- function setValue() {
3
- return $('#node-input-killSession').val()
4
- }
5
- //https://9bbb33aa-ac83-4087-9829-a264f90452fe@chrome.browserless.io:443/webdriver
6
- function setProvider() {
7
- if ($('#node-input-webdriverProvider').val() === 'browserless.io') {
8
- $('#node-input-webdriverUri').attr(
9
- 'placeholder',
10
- 'https://<apikey>:chrome.browserless.io:443/webdriver'
11
- )
12
- $('#node-input-webdriverBrowser').val('chrome')
13
- $('#row-browser').hide()
14
- } else if ($('#node-input-webdriverProvider').val() === 'local') {
15
- $('#row-browser').show()
16
- }
17
- }
18
-
19
- RED.nodes.registerType('new-session', {
20
- category: 'Webdriver IO',
21
- color: '#a6bbcf',
22
- defaults: {
23
- name: { value: '' },
24
- webdriverUri: { value: '' },
25
- webdriverProvider: { value: '' },
26
- webdriverBrowser: { value: '' },
27
- logLevel: { value: 'error' },
28
- killSession: { value: setValue() }
29
- },
30
- inputs: 1,
31
- outputs: 1,
32
- icon: 'white-globe.png',
33
- label: function() {
34
- return this.name || 'new session'
35
- }
36
- })
37
- </script>
38
-
39
- <script type="text/x-red" data-template-name="new-session">
40
- <div class="form-row">
41
- <label for="node-input-webdriverProvider"><i class="fa fa-globe"></i> Webdriver Remote Provider</label>
42
- <select type="text" id="node-input-webdriverProvider" style="width:70%;" onchange="setProvider()">
43
- <option value="browserless.io">browserless.io</option>
44
- <option value="local" selected>Local Webdriver</option>
45
- </select>
46
- </div>
47
- <div class="form-row">
48
- <label for="node-input-webdriverUri"><i class="fa fa-globe"></i> Webdriver Host URI</label>
49
- <input id="node-input-webdriverUri" type="text" placeholder="https://host:port/path">
50
- </div>
51
- <div class="form-row" id="row-browser">
52
- <label for="node-input-webdriverBrowser"><i class="fa fa-globe"></i> Browser</label>
53
- <select type="text" id="node-input-webdriverBrowser" style="width:70%;">
54
- <option value="chrome" selected>Chrome</option>
55
- <option value="chromium">Chromium</option>
56
- <option value="custom">Custom</option>
57
- </select>
58
- </div>
59
- <div class="form-row">
60
- <label for="node-input-logLevel"><i class="fa fa-tasks"></i> Log Level</label>
61
- <select type="text" id="node-input-logLevel" style="width:70%;">
62
- <option value="trace">Trace</option>
63
- <option value="debug">Debug</option>
64
- <option value="info">Info</option>
65
- <option value="warn">Warn</option>
66
- <option value="error" selected>Error</option>
67
- <option value="silent">Silent</option>
68
- </select>
69
- </div>
70
- <div class="form-row">
71
- <label for="node-input-killSession"><i class="fa fa-tasks"></i> Kill existing session on flow deploy</label>
72
- <input id="node-input-killSession" type="checkbox" onclick="setValue()" style="width:auto;">
73
- </div>
74
- <div class="form-row">
75
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
76
- <input id="node-input-name" type="text">
77
- </div>
78
- </script>
79
-
80
- <script type="text/x-red" data-help-name="new-session">
81
- <h3>Creates new session and also sets the "wdio_browser" global variable to the new session object.</h3>
82
- <h3>Inputs</h3>
83
- <dl class="message-properties">
84
- <dt>webdriverProvider: <span class="property-type">string</span></dt>
85
- <dd>Webdriver server name.</dd>
86
- <dt>webdriverUri: <span class="property-type">string</span></dt>
87
- <dd>The string format should be <protocal>://<hotsname>:<port number>/<path>, user 80/8080/443 if it is service based webdriver provider.</dd>
88
- <dd><code>msg.webdriverUri</code> can be used by leaving the webdriverUri field blank.</dd>
89
- <dt>Browser: <span class="property-type">string</span></dt>
90
- <dd>Chrome configs are default. We can pass custom capabilities by selecting Browser as `Custom` and pass `msg.capabilities` to the node.</dd>
91
- <dt>logLevel: <span class="property-type">string</span></dt>
92
- <dd>Select the log level to display the logs on console during run.</dd>
93
- <dt>killSession: <span class="property-type">Bool</span></dt>
94
- <dd>Kill open session during deploy. This would be helpful to debug the changes by not closing the current browser.</dd>
95
- </dl>
96
- </script>
1
+ <script type="text/javascript">
2
+ function setValue() {
3
+ return $('#node-input-killSession').val()
4
+ }
5
+ //https://9bbb33aa-ac83-4087-9829-a264f90452fe@chrome.browserless.io:443/webdriver
6
+ function setProvider() {
7
+ if ($('#node-input-webdriverProvider').val() === 'browserless.io') {
8
+ $('#node-input-webdriverUri').attr(
9
+ 'placeholder',
10
+ 'https://<apikey>:chrome.browserless.io:443/webdriver'
11
+ )
12
+ $('#node-input-webdriverBrowser').val('chrome')
13
+ $('#row-browser').hide()
14
+ } else if ($('#node-input-webdriverProvider').val() === 'local') {
15
+ $('#row-browser').show()
16
+ }
17
+ }
18
+
19
+ RED.nodes.registerType('new-session', {
20
+ category: 'Webdriver IO',
21
+ color: '#a6bbcf',
22
+ defaults: {
23
+ name: { value: '' },
24
+ webdriverUri: { value: '' },
25
+ webdriverProvider: { value: '' },
26
+ webdriverBrowser: { value: '' },
27
+ logLevel: { value: 'error' },
28
+ killSession: { value: setValue() }
29
+ },
30
+ inputs: 1,
31
+ outputs: 1,
32
+ icon: 'white-globe.png',
33
+ label: function() {
34
+ return this.name || 'new session'
35
+ }
36
+ })
37
+ </script>
38
+
39
+ <script type="text/x-red" data-template-name="new-session">
40
+ <div class="form-row">
41
+ <label for="node-input-webdriverProvider"><i class="fa fa-globe"></i> Webdriver Remote Provider</label>
42
+ <select type="text" id="node-input-webdriverProvider" style="width:70%;" onchange="setProvider()">
43
+ <option value="browserless.io">browserless.io</option>
44
+ <option value="local" selected>Local Webdriver</option>
45
+ </select>
46
+ </div>
47
+ <div class="form-row">
48
+ <label for="node-input-webdriverUri"><i class="fa fa-globe"></i> Webdriver Host URI</label>
49
+ <input id="node-input-webdriverUri" type="text" placeholder="https://host:port/path">
50
+ </div>
51
+ <div class="form-row" id="row-browser">
52
+ <label for="node-input-webdriverBrowser"><i class="fa fa-globe"></i> Browser</label>
53
+ <select type="text" id="node-input-webdriverBrowser" style="width:70%;">
54
+ <option value="chrome" selected>Chrome</option>
55
+ <option value="chromium">Chromium</option>
56
+ <option value="custom">Custom</option>
57
+ </select>
58
+ </div>
59
+ <div class="form-row">
60
+ <label for="node-input-logLevel"><i class="fa fa-tasks"></i> Log Level</label>
61
+ <select type="text" id="node-input-logLevel" style="width:70%;">
62
+ <option value="trace">Trace</option>
63
+ <option value="debug">Debug</option>
64
+ <option value="info">Info</option>
65
+ <option value="warn">Warn</option>
66
+ <option value="error" selected>Error</option>
67
+ <option value="silent">Silent</option>
68
+ </select>
69
+ </div>
70
+ <div class="form-row">
71
+ <label for="node-input-killSession"><i class="fa fa-tasks"></i> Kill existing session on flow deploy</label>
72
+ <input id="node-input-killSession" type="checkbox" onclick="setValue()" style="width:auto;">
73
+ </div>
74
+ <div class="form-row">
75
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
76
+ <input id="node-input-name" type="text">
77
+ </div>
78
+ </script>
79
+
80
+ <script type="text/x-red" data-help-name="new-session">
81
+ <h3>Creates new session and also sets the "wdio_browser" global variable to the new session object.</h3>
82
+ <h3>Inputs</h3>
83
+ <dl class="message-properties">
84
+ <dt>webdriverProvider: <span class="property-type">string</span></dt>
85
+ <dd>Webdriver server name.</dd>
86
+ <dt>webdriverUri: <span class="property-type">string</span></dt>
87
+ <dd>The string format should be <protocal>://<hotsname>:<port number>/<path>, user 80/8080/443 if it is service based webdriver provider.</dd>
88
+ <dd><code>msg.webdriverUri</code> can be used by leaving the webdriverUri field blank.</dd>
89
+ <dt>Browser: <span class="property-type">string</span></dt>
90
+ <dd>Chrome configs are default. We can pass custom capabilities by selecting Browser as `Custom` and pass `msg.capabilities` to the node.</dd>
91
+ <dt>logLevel: <span class="property-type">string</span></dt>
92
+ <dd>Select the log level to display the logs on console during run.</dd>
93
+ <dt>killSession: <span class="property-type">Bool</span></dt>
94
+ <dd>Kill open session during deploy. This would be helpful to debug the changes by not closing the current browser.</dd>
95
+ </dl>
96
+ </script>
@@ -1,108 +1,108 @@
1
- const common = require('./wdio-common')
2
-
3
- module.exports = function(RED) {
4
- function newSession(config) {
5
- RED.nodes.createNode(this, config)
6
- const node = this
7
-
8
- common.clearStatus(node)
9
-
10
- node.on('input', async (msg) => {
11
- try {
12
- const webdriverConfig = Object.assign(
13
- { logLevel: config.logLevel },
14
- { baseUrl: config.webdriverUri || msg.webdriverUri },
15
- //parseUri(config.webdriverUri || msg.webdriverUri, node),
16
- getCapabilities(
17
- config.webdriverProvider,
18
- config.webdriverBrowser,
19
- msg
20
- )
21
- )
22
- node.log = `Open new browser.`
23
- let b = await common.newSession(webdriverConfig, node, node.context())
24
- await common.log(node)
25
- common.connectedStatus(node)
26
- msg.payload = b.sessionId
27
- node.send(msg)
28
- } catch (e) {
29
- await common.log(node)
30
- common.handleError(e, node, msg)
31
- }
32
- })
33
-
34
- node.on('close', async (done) => {
35
- try {
36
- if (config.killSession) {
37
- let b = await common.deleteSession(node.context())
38
- let sessionId = ''
39
- if (b && b.sessionId) sessionId = b.sessionId
40
- common.disconnectedStatus(node)
41
- node.log('Disconnected webdriver session ' + sessionId)
42
- }
43
- } catch (e) {
44
- await common.log(node)
45
- common.handleError(e, node, msg)
46
- }
47
- done()
48
- })
49
- }
50
- RED.nodes.registerType('new-session', newSession)
51
- }
52
-
53
- const parseUri = (uri, node) => {
54
- let uriComponents
55
- try {
56
- if (uri[uri.length - 1] !== '/') uri += '/'
57
- let parsed = uri.match(/(\w+):\/\/(.+):(\d+)(\/.*)/)
58
- uriComponents = {
59
- protocol: parsed[1],
60
- hostname: parsed[2],
61
- port: parseInt(parsed[3]),
62
- path: parsed[4]
63
- }
64
- } catch (e) {
65
- common.handleError(
66
- new Error(
67
- 'Invalid URI, expected format "<protocol>://<host>:<port>/<path>'
68
- ),
69
- node
70
- )
71
- }
72
-
73
- return uriComponents
74
- }
75
-
76
- const getCapabilities = (vendor, browser, msg) => {
77
- let capabilities
78
-
79
- if(browser == 'custom'){
80
- capabilities = msg.capabilities
81
- }
82
- else if (vendor === 'browserless.io') {
83
- capabilities = {
84
- browserName: browser,
85
- 'goog:chromeOptions': {
86
- args: ['--headless', '--no-sandbox']
87
- }
88
- }
89
- } else if (vendor === 'local' && browser === 'chromium') {
90
- capabilities = {
91
- browserName: 'chrome',
92
- 'goog:chromeOptions': {
93
- args: ['--headless', '--no-sandbox'],
94
- w3c: false
95
- }
96
- }
97
- } else if (vendor === 'local') {
98
- capabilities = {
99
- browserName: browser,
100
- //platformName: 'Linux',
101
- 'goog:chromeOptions': {
102
- w3c: false
103
- }
104
- }
105
- }
106
-
107
- return { capabilities }
108
- }
1
+ const common = require('./wdio-common')
2
+
3
+ module.exports = function(RED) {
4
+ function newSession(config) {
5
+ RED.nodes.createNode(this, config)
6
+ const node = this
7
+
8
+ common.clearStatus(node)
9
+
10
+ node.on('input', async (msg) => {
11
+ try {
12
+ const webdriverConfig = Object.assign(
13
+ { logLevel: config.logLevel },
14
+ { baseUrl: config.webdriverUri || msg.webdriverUri },
15
+ //parseUri(config.webdriverUri || msg.webdriverUri, node),
16
+ getCapabilities(
17
+ config.webdriverProvider,
18
+ config.webdriverBrowser,
19
+ msg
20
+ )
21
+ )
22
+ node.log = `Open new browser.`
23
+ let b = await common.newSession(webdriverConfig, node, node.context())
24
+ await common.log(node)
25
+ common.connectedStatus(node)
26
+ msg.payload = b.sessionId
27
+ node.send(msg)
28
+ } catch (e) {
29
+ await common.log(node)
30
+ common.handleError(e, node, msg)
31
+ }
32
+ })
33
+
34
+ node.on('close', async (done) => {
35
+ try {
36
+ if (config.killSession) {
37
+ let b = await common.deleteSession(node.context())
38
+ let sessionId = ''
39
+ if (b && b.sessionId) sessionId = b.sessionId
40
+ common.disconnectedStatus(node)
41
+ node.log('Disconnected webdriver session ' + sessionId)
42
+ }
43
+ } catch (e) {
44
+ await common.log(node)
45
+ common.handleError(e, node, msg)
46
+ }
47
+ done()
48
+ })
49
+ }
50
+ RED.nodes.registerType('new-session', newSession)
51
+ }
52
+
53
+ const parseUri = (uri, node) => {
54
+ let uriComponents
55
+ try {
56
+ if (uri[uri.length - 1] !== '/') uri += '/'
57
+ let parsed = uri.match(/(\w+):\/\/(.+):(\d+)(\/.*)/)
58
+ uriComponents = {
59
+ protocol: parsed[1],
60
+ hostname: parsed[2],
61
+ port: parseInt(parsed[3]),
62
+ path: parsed[4]
63
+ }
64
+ } catch (e) {
65
+ common.handleError(
66
+ new Error(
67
+ 'Invalid URI, expected format "<protocol>://<host>:<port>/<path>'
68
+ ),
69
+ node
70
+ )
71
+ }
72
+
73
+ return uriComponents
74
+ }
75
+
76
+ const getCapabilities = (vendor, browser, msg) => {
77
+ let capabilities
78
+
79
+ if(browser == 'custom'){
80
+ capabilities = msg.capabilities
81
+ }
82
+ else if (vendor === 'browserless.io') {
83
+ capabilities = {
84
+ browserName: browser,
85
+ 'goog:chromeOptions': {
86
+ args: ['--headless', '--no-sandbox']
87
+ }
88
+ }
89
+ } else if (vendor === 'local' && browser === 'chromium') {
90
+ capabilities = {
91
+ browserName: 'chrome',
92
+ 'goog:chromeOptions': {
93
+ args: ['--headless', '--no-sandbox'],
94
+ w3c: false
95
+ }
96
+ }
97
+ } else if (vendor === 'local') {
98
+ capabilities = {
99
+ browserName: browser,
100
+ //platformName: 'Linux',
101
+ 'goog:chromeOptions': {
102
+ w3c: false
103
+ }
104
+ }
105
+ }
106
+
107
+ return { capabilities }
108
+ }