topological-nodered-wdio 0.5.2 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "topological-nodered-wdio",
3
3
  "description": "Open source WebdriverIO nodes for Node-RED",
4
- "version": "0.5.2",
4
+ "version": "0.5.4",
5
5
  "author": "topological",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -1,10 +1,20 @@
1
- <script type="text/javascript">
1
+ <script type="text/javascript">
2
+
3
+ function setValue() {
4
+ return $('#node-input-line').val()
5
+ }
6
+
7
+ function setChanges() {
8
+ return $('#node-input-refUrl').val()
9
+ }
10
+
2
11
  RED.nodes.registerType('document-helper', {
3
12
  category: 'Webdriver IO',
4
- color: '#E2D96E',
13
+ color: '#FFFFFF',
5
14
  defaults: {
6
15
  name: { value: '' },
7
- desc: { value: '' }
16
+ refUrl: {value: setChanges()},
17
+ line: {value: setValue()}
8
18
  },
9
19
  inputs: 1,
10
20
  outputs: 1,
@@ -22,20 +32,24 @@
22
32
  <input id="node-input-name" type="text">
23
33
  </div>
24
34
 
35
+ <div class="form-row">
36
+ <input type="checkbox" id="node-input-line" name="node-input-line" onclick="setValue()" style="width:auto; margin-right:20%" />
37
+ <label for="node-input-line" style="min-width:70%;color:#87A980"><b> Use new line as separator</b></label>
38
+ </div>
39
+
25
40
  <div class="form-row">
26
- <label for="node-input-desc"><i class="fa fa-tag"></i> Description</label>
27
- <textarea id="node-input-desc" name="node-input-desc" rows="20" cols="50" style="min-width:70%; "/>
41
+ <label for="node-input-refUrl"><i class="fa fa-tag"></i> Ref. URl</label>
42
+ <textarea id="node-input-refUrl" name="node-input-refUrl" class="node-text-editor" rows="3" style="min-width:70%;" onblur="setChanges()"></textarea>
28
43
  </div>
29
44
  </script>
30
45
 
31
-
32
-
33
46
  <script type="text/x-red" data-help-name="document-helper">
34
47
  <h3>Log helper node uses to add notes to <code>global.document</code></h3>
35
48
  <h3>Details</h3>
36
49
  <dl class="message-properties">
37
50
  <dt>Name: name of the log to be added to <code>global.document</code></dt>
38
- <dt>Description: more details about the node</dt>
51
+ <dt>New Line: Check the checkbox for Use new line as separator</dt>
52
+ <dt>Ref Url.: A quick reference url that needs to be added to document.</dt>
39
53
  </dl>
40
54
 
41
55
  <h3>Outputs</h3>
@@ -4,6 +4,8 @@ module.exports = function(RED) {
4
4
  function documentHelper(config) {
5
5
  RED.nodes.createNode(this, config)
6
6
  const node = this
7
+ node.refUrl = config.refUrl
8
+ node.line = config.line
7
9
  common.clearStatus(node)
8
10
 
9
11
  node.on('input', async (msg) => {
@@ -150,13 +150,14 @@ module.exports.log = async (node) => {
150
150
  let context = node.context()
151
151
  let stepCount = await (context.global.get('stepCount') || 0) + 1
152
152
  let document = await context.global.get('document') || ''
153
- await context.global.set('document', `${document}\n${stepCount}. Node: ${node.name} - ${node.log}`)
153
+ await context.global.set('document', `${document}${stepCount}. Node: ${node.name} - ${node.log}\n`)
154
154
  await context.global.set('stepCount', stepCount)
155
155
  }
156
156
 
157
157
  module.exports.document = async (node) => {
158
158
  let context = node.context()
159
- let name = node.name
160
159
  let document = await context.global.get('document') || ''
161
- await context.global.set('document', `${document}\n********************\n${name}\n********************`)
160
+ document = node.line? `${document}\n${node.name}${node.refUrl? `\nRef: ${node.refUrl}`:''}\n\n` :
161
+ `${document}********************\n${node.name}${node.refUrl? `\nRef: ${node.refUrl}`:''}\n********************\n`
162
+ await context.global.set('document', document.replaceAll('\\n','\n'))
162
163
  }