mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #1860 from node-red-hitachi/uitest-refactoring
Refactored UI testing code following a design note
This commit is contained in:
commit
9767bd9697
@ -24,7 +24,7 @@ function injectNode(id) {
|
|||||||
|
|
||||||
util.inherits(injectNode, nodePage);
|
util.inherits(injectNode, nodePage);
|
||||||
|
|
||||||
var payloadType = {
|
var payloadTypeList = {
|
||||||
"flow": 1,
|
"flow": 1,
|
||||||
"global": 2,
|
"global": 2,
|
||||||
"str": 3,
|
"str": 3,
|
||||||
@ -36,54 +36,43 @@ var payloadType = {
|
|||||||
"env": 9,
|
"env": 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
var timeType = {
|
var repeatTypeList = {
|
||||||
"none": 1,
|
"none": 1,
|
||||||
"interval": 2,
|
"interval": 2,
|
||||||
"intervalBetweenTimes": 3,
|
"intervalBetweenTimes": 3,
|
||||||
"atASpecificTime": 4,
|
"atASpecificTime": 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
var timeType = {
|
injectNode.prototype.setPayload = function(payloadType, payload) {
|
||||||
"none": 1,
|
|
||||||
"interval": 2,
|
|
||||||
"intervalBetweenTimes": 3,
|
|
||||||
"atASpecificTime": 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
var timeType = {
|
|
||||||
"none": 1,
|
|
||||||
"interval": 2,
|
|
||||||
"intervalBetweenTimes": 3,
|
|
||||||
"atASpecificTime": 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
injectNode.prototype.setPayload = function(type, value) {
|
|
||||||
// Open a payload type list.
|
// Open a payload type list.
|
||||||
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-container")]');
|
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-container")]');
|
||||||
// Select a payload type.
|
// Select a payload type.
|
||||||
var payloadTypeXPath = '//*[@class="red-ui-typedInput-options"]/a[' + payloadType[type] + ']';
|
var payloadTypeXPath = '//*[@class="red-ui-typedInput-options"]/a[' + payloadTypeList[payloadType] + ']';
|
||||||
browser.clickWithWait(payloadTypeXPath);
|
browser.clickWithWait(payloadTypeXPath);
|
||||||
if (value) {
|
if (payload) {
|
||||||
// Input a value.
|
// Input a value.
|
||||||
browser.setValue('//*[@class="red-ui-typedInput-input"]/input', value);
|
browser.setValue('//*[@class="red-ui-typedInput-input"]/input', payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
injectNode.prototype.setTopic = function(value) {
|
injectNode.prototype.setTopic = function(topic) {
|
||||||
browser.setValue('#node-input-topic', value);
|
browser.setValue('#node-input-topic', topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
injectNode.prototype.setOnce = function(value) {
|
injectNode.prototype.setOnce = function(once) {
|
||||||
browser.clickWithWait('#node-input-once');
|
var isChecked = browser.isSelected('#node-input-once');
|
||||||
|
if (isChecked !== once) {
|
||||||
|
browser.clickWithWait('#node-input-once');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
injectNode.prototype.setTimeType = function(type) {
|
injectNode.prototype.setRepeat = function(repeatType) {
|
||||||
var timeTypeXPath = '//*[@id="inject-time-type-select"]/option[' + timeType[type] + ']';
|
var repeatTypeXPath = '//*[@id="inject-time-type-select"]/option[' + repeatTypeList[repeatType] + ']';
|
||||||
browser.clickWithWait(timeTypeXPath);
|
browser.clickWithWait(repeatTypeXPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
injectNode.prototype.setRepeat = function(sec) {
|
injectNode.prototype.setRepeatInterval = function(repeat) {
|
||||||
browser.setValue('#inject-time-interval-count', sec);
|
browser.setValue('#inject-time-interval-count', repeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = injectNode;
|
module.exports = injectNode;
|
||||||
|
@ -24,22 +24,20 @@ function debugNode(id) {
|
|||||||
|
|
||||||
util.inherits(debugNode, nodePage);
|
util.inherits(debugNode, nodePage);
|
||||||
|
|
||||||
var target = {
|
debugNode.prototype.setOutput = function(complete) {
|
||||||
"msg": 1,
|
|
||||||
"full": 2
|
|
||||||
};
|
|
||||||
|
|
||||||
debugNode.prototype.setTarget = function(type, value) {
|
|
||||||
// Open a payload type list.
|
// Open a payload type list.
|
||||||
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-container")]/button');
|
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-container")]/button');
|
||||||
// Select a payload type.
|
if (complete !== 'true') {
|
||||||
var xPath = '/html/body/div[11]/a[' + target[type] + ']';
|
// Select the "msg" type.
|
||||||
browser.clickWithWait(xPath);
|
browser.clickWithWait('/html/body/div[11]/a[1]');
|
||||||
if (value) {
|
// Input the path in msg.
|
||||||
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-input")]/input');
|
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-input")]/input');
|
||||||
browser.keys(['Control', 'a', 'Control']);
|
browser.keys(['Control', 'a', 'Control']);
|
||||||
browser.keys(['Delete']);
|
browser.keys(['Delete']);
|
||||||
browser.setValue('//*[contains(@class, "red-ui-typedInput-input")]/input', value);
|
browser.setValue('//*[contains(@class, "red-ui-typedInput-input")]/input', complete);
|
||||||
|
} else {
|
||||||
|
// Select the "complete msg object" type.
|
||||||
|
browser.clickWithWait('/html/body/div[11]/a[2]');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,12 +24,17 @@ function functionNode(id) {
|
|||||||
|
|
||||||
util.inherits(functionNode, nodePage);
|
util.inherits(functionNode, nodePage);
|
||||||
|
|
||||||
functionNode.prototype.setCode = function(value) {
|
functionNode.prototype.setFunction = function(func) {
|
||||||
browser.click('#node-input-func-editor');
|
browser.click('#node-input-func-editor');
|
||||||
browser.keys(['Control', 'Home', 'Control']);
|
browser.keys(['Control', 'Home', 'Control']);
|
||||||
for (var i=0; i<value.length; i++) {
|
for (var i = 0; i < func.length; i++) {
|
||||||
browser.keys([value.substr(i, 1)]);
|
browser.keys([func.charAt(i)]);
|
||||||
}
|
}
|
||||||
|
// Delete the unnecessary code that ace editor does the autocompletion.
|
||||||
|
browser.keys(['Control', 'Shift', 'End', 'Shift', 'Control']);
|
||||||
|
browser.keys(['Delete']);
|
||||||
|
// Need to wait until ace editor correctly checks the syntax.
|
||||||
|
browser.pause(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = functionNode;
|
module.exports = functionNode;
|
||||||
|
@ -24,29 +24,20 @@ function templateNode(id) {
|
|||||||
|
|
||||||
util.inherits(templateNode, nodePage);
|
util.inherits(templateNode, nodePage);
|
||||||
|
|
||||||
var syntaxType = {
|
templateNode.prototype.setSyntax = function(syntax) {
|
||||||
"mustache": 1,
|
browser.selectWithWait('#node-input-syntax', syntax);
|
||||||
"plain": 2
|
|
||||||
};
|
|
||||||
|
|
||||||
templateNode.prototype.setSyntax = function(type) {
|
|
||||||
// Open a method type list.
|
|
||||||
browser.clickWithWait('#node-input-syntax');
|
|
||||||
// Select a method type.
|
|
||||||
var syntaxTypeXPath = '//*[@id="node-input-syntax"]/option[' + syntaxType[type] + ']';
|
|
||||||
browser.clickWithWait(syntaxTypeXPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
templateNode.prototype.setFormat = function(type) {
|
templateNode.prototype.setFormat = function(format) {
|
||||||
browser.selectByValue('#node-input-format', type);
|
browser.selectWithWait('#node-input-format', format);
|
||||||
}
|
}
|
||||||
|
|
||||||
templateNode.prototype.setTemplate = function(value) {
|
templateNode.prototype.setTemplate = function(template) {
|
||||||
browser.click('#node-input-template-editor');
|
browser.click('#node-input-template-editor');
|
||||||
browser.keys(['Control', 'a', 'Control']); // call twice to release the keys.
|
browser.keys(['Control', 'a', 'Control']); // call twice to release the keys.
|
||||||
// Need to add a character one by one since some words such as 'Control' are treated as a special word.
|
// Need to add a character one by one since some words such as 'Control' are treated as a special word.
|
||||||
for (var i=0; i<value.length; i++) {
|
for (var i = 0; i < template.length; i++) {
|
||||||
browser.keys([value.charAt(i)]);
|
browser.keys([template.charAt(i)]);
|
||||||
}
|
}
|
||||||
browser.keys(['Control', 'Shift', 'End', 'Shift', 'Control']);
|
browser.keys(['Control', 'Shift', 'End', 'Shift', 'Control']);
|
||||||
browser.keys(['Delete']);
|
browser.keys(['Delete']);
|
||||||
|
@ -22,30 +22,14 @@ function httpinNode(id) {
|
|||||||
nodePage.call(this, id);
|
nodePage.call(this, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMethod(type) {
|
|
||||||
browser.selectByValue('#node-input-method', type);
|
|
||||||
}
|
|
||||||
|
|
||||||
util.inherits(httpinNode, nodePage);
|
util.inherits(httpinNode, nodePage);
|
||||||
|
|
||||||
var methodType = {
|
httpinNode.prototype.setMethod = function(method) {
|
||||||
"get": 1,
|
browser.selectWithWait('#node-input-method', method);
|
||||||
"post": 2,
|
|
||||||
"put": 3,
|
|
||||||
"delete": 4,
|
|
||||||
"patch": 5,
|
|
||||||
};
|
|
||||||
|
|
||||||
httpinNode.prototype.setMethod = function(type) {
|
|
||||||
// Open a method type list.
|
|
||||||
browser.clickWithWait('#node-input-method');
|
|
||||||
// Select a method type.
|
|
||||||
var methodTypeXPath = '//*[@id="node-input-method"]/option[' + methodType[type] + ']';
|
|
||||||
browser.clickWithWait(methodTypeXPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
httpinNode.prototype.setUrl = function(value) {
|
httpinNode.prototype.setUrl = function(url) {
|
||||||
browser.setValue('#node-input-url', value);
|
browser.setValue('#node-input-url', url);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = httpinNode;
|
module.exports = httpinNode;
|
||||||
|
@ -24,36 +24,16 @@ function httpRequestNode(id) {
|
|||||||
|
|
||||||
util.inherits(httpRequestNode, nodePage);
|
util.inherits(httpRequestNode, nodePage);
|
||||||
|
|
||||||
var methodType = {
|
httpRequestNode.prototype.setUrl = function(url) {
|
||||||
"get": 1,
|
browser.setValue('#node-input-url', url);
|
||||||
"post": 2,
|
|
||||||
"put": 3,
|
|
||||||
"delete": 4,
|
|
||||||
"setByMsgMethod": 5,
|
|
||||||
};
|
|
||||||
|
|
||||||
var retType = {
|
|
||||||
"txt": 1,
|
|
||||||
"bin": 2,
|
|
||||||
"obj": 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
httpRequestNode.prototype.setUrl = function(value) {
|
|
||||||
browser.setValue('#node-input-url', value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
httpRequestNode.prototype.setMethod = function(type) {
|
httpRequestNode.prototype.setMethod = function(method) {
|
||||||
// Open a method type list.
|
browser.selectWithWait('#node-input-method', method);
|
||||||
browser.clickWithWait('#node-input-method');
|
|
||||||
// Select a method type.
|
|
||||||
var methodTypeXPath = '//*[@id="node-input-method"]/option[' + methodType[type] + ']';
|
|
||||||
browser.clickWithWait(methodTypeXPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
httpRequestNode.prototype.setRet = function(type) {
|
httpRequestNode.prototype.setReturn = function(ret) {
|
||||||
browser.clickWithWait('#node-input-ret');
|
browser.selectWithWait('#node-input-ret', ret);
|
||||||
var retTypeXPath = '//*[@id="node-input-ret"]/option[' + retType[type] + ']';
|
|
||||||
browser.clickWithWait(retTypeXPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = httpRequestNode;
|
module.exports = httpRequestNode;
|
||||||
|
@ -24,13 +24,6 @@ function changeNode(id) {
|
|||||||
|
|
||||||
util.inherits(changeNode, nodePage);
|
util.inherits(changeNode, nodePage);
|
||||||
|
|
||||||
var tType = {
|
|
||||||
"set": 1,
|
|
||||||
"change": 2,
|
|
||||||
"delete": 3,
|
|
||||||
"move": 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
var totType = {
|
var totType = {
|
||||||
"msg": 1,
|
"msg": 1,
|
||||||
"flow": 2,
|
"flow": 2,
|
||||||
@ -42,6 +35,7 @@ var totType = {
|
|||||||
"bin": 8,
|
"bin": 8,
|
||||||
"date": 9,
|
"date": 9,
|
||||||
"jsonata": 10,
|
"jsonata": 10,
|
||||||
|
"env": 11,
|
||||||
};
|
};
|
||||||
|
|
||||||
var ptType = {
|
var ptType = {
|
||||||
@ -50,8 +44,8 @@ var ptType = {
|
|||||||
"global": 3,
|
"global": 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
function setT(rule, index) {
|
function setT(t, index) {
|
||||||
browser.selectByValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/select', rule);
|
browser.selectWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/select', t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is better to create a function whose input value is the object type in the future,
|
// It is better to create a function whose input value is the object type in the future,
|
||||||
|
@ -24,8 +24,8 @@ function rangeNode(id) {
|
|||||||
|
|
||||||
util.inherits(rangeNode, nodePage);
|
util.inherits(rangeNode, nodePage);
|
||||||
|
|
||||||
rangeNode.prototype.setAction = function(value) {
|
rangeNode.prototype.setAction = function(action) {
|
||||||
browser.selectByValue('#node-input-action', value);
|
browser.selectWithWait('#node-input-action', action);
|
||||||
}
|
}
|
||||||
|
|
||||||
rangeNode.prototype.setRange = function(minin, maxin, minout, maxout) {
|
rangeNode.prototype.setRange = function(minin, maxin, minout, maxout) {
|
||||||
|
@ -24,8 +24,8 @@ function htmlNode(id) {
|
|||||||
|
|
||||||
util.inherits(htmlNode, nodePage);
|
util.inherits(htmlNode, nodePage);
|
||||||
|
|
||||||
htmlNode.prototype.setTag = function(value) {
|
htmlNode.prototype.setSelector = function(tag) {
|
||||||
browser.setValue('#node-input-tag', value);
|
browser.setValue('#node-input-tag', tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = htmlNode;
|
module.exports = htmlNode;
|
||||||
|
@ -31,13 +31,13 @@ var formatType = {
|
|||||||
"stream": 4
|
"stream": 4
|
||||||
};
|
};
|
||||||
|
|
||||||
fileinNode.prototype.setFilename = function(value) {
|
fileinNode.prototype.setFilename = function(filename) {
|
||||||
browser.setValue('#node-input-filename', value);
|
browser.setValue('#node-input-filename', filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
fileinNode.prototype.setFormat = function(type) {
|
fileinNode.prototype.setOutput = function(format) {
|
||||||
browser.clickWithWait('#node-input-format');
|
browser.clickWithWait('#node-input-format');
|
||||||
var formatTypeXPath = '//*[@id="node-input-format"]/option[' + formatType[type] + ']';
|
var formatTypeXPath = '//*[@id="node-input-format"]/option[' + formatType[format] + ']';
|
||||||
browser.clickWithWait(formatTypeXPath);
|
browser.clickWithWait(formatTypeXPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,12 @@ function init() {
|
|||||||
var ret = browser.getText(selector);
|
var ret = browser.getText(selector);
|
||||||
return ret;
|
return ret;
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
browser.addCommand("selectWithWait", function(selector, value) {
|
||||||
|
browser.waitForVisible(selector, 5000);
|
||||||
|
var ret = browser.selectByValue(selector, value);
|
||||||
|
return ret;
|
||||||
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -19,8 +19,8 @@ var should = require("should");
|
|||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
|
|
||||||
var helper = require("../../editor_helper");
|
var helper = require("../../editor_helper");
|
||||||
var debugTab = require('../../pageobjects/workspace/debugTab_page');
|
var debugTab = require('../../pageobjects/editor/debugTab_page');
|
||||||
var workspace = require('../../pageobjects/workspace/workspace_page');
|
var workspace = require('../../pageobjects/editor/workspace_page');
|
||||||
|
|
||||||
var nodeWidth = 200;
|
var nodeWidth = 200;
|
||||||
|
|
@ -17,8 +17,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
|
|
||||||
var helper = require("../../editor_helper");
|
var helper = require("../../editor_helper");
|
||||||
var debugTab = require('../../pageobjects/workspace/debugTab_page');
|
var debugTab = require('../../pageobjects/editor/debugTab_page');
|
||||||
var workspace = require('../../pageobjects/workspace/workspace_page');
|
var workspace = require('../../pageobjects/editor/workspace_page');
|
||||||
|
|
||||||
var nodeWidth = 200;
|
var nodeWidth = 200;
|
||||||
var nodeHeight = 100;
|
var nodeHeight = 100;
|
||||||
@ -65,7 +65,7 @@ describe('cookbook', function() {
|
|||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello');
|
||||||
httpRequestNode.setMethod("get");
|
httpRequestNode.setMethod("GET");
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(httpRequestNode);
|
injectNode.connect(httpRequestNode);
|
||||||
@ -105,7 +105,7 @@ describe('cookbook', function() {
|
|||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-query?name=Nick');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-query?name=Nick');
|
||||||
httpRequestNode.setMethod("get");
|
httpRequestNode.setMethod("GET");
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(httpRequestNode);
|
injectNode.connect(httpRequestNode);
|
||||||
@ -145,7 +145,7 @@ describe('cookbook', function() {
|
|||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-param/Dave');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-param/Dave');
|
||||||
httpRequestNode.setMethod("get");
|
httpRequestNode.setMethod("GET");
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(httpRequestNode);
|
injectNode.connect(httpRequestNode);
|
||||||
@ -185,12 +185,12 @@ describe('cookbook', function() {
|
|||||||
var debugNode = workspace.addNode("debug", nodeWidth * 3, nodeHeight);
|
var debugNode = workspace.addNode("debug", nodeWidth * 3, nodeHeight);
|
||||||
|
|
||||||
changeNode.edit();
|
changeNode.edit();
|
||||||
changeNode.ruleSet("headers", "msg", "{\"user-agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64)\"}", "json");
|
changeNode.ruleSet("headers", "msg", '{"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}', "json");
|
||||||
changeNode.clickOk();
|
changeNode.clickOk();
|
||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-headers');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-headers');
|
||||||
httpRequestNode.setMethod("get");
|
httpRequestNode.setMethod("GET");
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(changeNode);
|
injectNode.connect(changeNode);
|
||||||
@ -249,7 +249,7 @@ describe('cookbook', function() {
|
|||||||
var debugNode = workspace.addNode("debug", nodeWidth * 2, nodeHeight * 2);
|
var debugNode = workspace.addNode("debug", nodeWidth * 2, nodeHeight * 2);
|
||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setMethod("get");
|
httpRequestNode.setMethod("GET");
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-data');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-data');
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ describe('cookbook', function() {
|
|||||||
templateNode.edit();
|
templateNode.edit();
|
||||||
templateNode.setSyntax("mustache");
|
templateNode.setSyntax("mustache");
|
||||||
templateNode.setFormat("handlebars");
|
templateNode.setFormat("handlebars");
|
||||||
templateNode.setTemplate("{ \"Hello\": \"World\" }");
|
templateNode.setTemplate('{ "Hello": "World" }');
|
||||||
templateNode.clickOk();
|
templateNode.clickOk();
|
||||||
|
|
||||||
changeNode.edit();
|
changeNode.edit();
|
||||||
@ -299,12 +299,12 @@ describe('cookbook', function() {
|
|||||||
var debugNode = workspace.addNode("debug", nodeWidth * 2, nodeHeight);
|
var debugNode = workspace.addNode("debug", nodeWidth * 2, nodeHeight);
|
||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setMethod("get");
|
httpRequestNode.setMethod("GET");
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-json');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-json');
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
debugNode.edit();
|
debugNode.edit();
|
||||||
debugNode.setTarget("msg", "headers");
|
debugNode.setOutput("headers");
|
||||||
debugNode.clickOk();
|
debugNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(httpRequestNode);
|
injectNode.connect(httpRequestNode);
|
||||||
@ -332,7 +332,7 @@ describe('cookbook', function() {
|
|||||||
|
|
||||||
fileinNode.edit();
|
fileinNode.edit();
|
||||||
fileinNode.setFilename("test/resources/file-in-node/test.txt");
|
fileinNode.setFilename("test/resources/file-in-node/test.txt");
|
||||||
fileinNode.setFormat("");
|
fileinNode.setOutput("");
|
||||||
fileinNode.clickOk();
|
fileinNode.clickOk();
|
||||||
|
|
||||||
changeNode.edit();
|
changeNode.edit();
|
||||||
@ -352,7 +352,7 @@ describe('cookbook', function() {
|
|||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-file');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-file');
|
||||||
httpRequestNode.setMethod("get");
|
httpRequestNode.setMethod("GET");
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(httpRequestNode);
|
injectNode.connect(httpRequestNode);
|
||||||
@ -396,7 +396,7 @@ describe('cookbook', function() {
|
|||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-raw');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-raw');
|
||||||
httpRequestNode.setMethod("post");
|
httpRequestNode.setMethod("POST");
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(httpRequestNode);
|
injectNode.connect(httpRequestNode);
|
||||||
@ -440,12 +440,12 @@ describe('cookbook', function() {
|
|||||||
injectNode.clickOk();
|
injectNode.clickOk();
|
||||||
|
|
||||||
changeNode.edit();
|
changeNode.edit();
|
||||||
changeNode.ruleSet("headers", "msg", "{\"content-type\":\"application/x-www-form-urlencoded\"}", "json");
|
changeNode.ruleSet("headers", "msg", '{"content-type":"application/x-www-form-urlencoded"}', "json");
|
||||||
changeNode.clickOk();
|
changeNode.clickOk();
|
||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-form');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-form');
|
||||||
httpRequestNode.setMethod("post");
|
httpRequestNode.setMethod("POST");
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(changeNode);
|
injectNode.connect(changeNode);
|
||||||
@ -486,16 +486,16 @@ describe('cookbook', function() {
|
|||||||
var debugNode = workspace.addNode("debug", nodeWidth * 3, nodeHeight);
|
var debugNode = workspace.addNode("debug", nodeWidth * 3, nodeHeight);
|
||||||
|
|
||||||
injectNode.edit()
|
injectNode.edit()
|
||||||
injectNode.setPayload("json", "{\"name\":\"Nick\"}");
|
injectNode.setPayload("json", '{"name":"Nick"}');
|
||||||
injectNode.clickOk();
|
injectNode.clickOk();
|
||||||
|
|
||||||
changeNode.edit();
|
changeNode.edit();
|
||||||
changeNode.ruleSet("headers", "msg", "{\"content-type\":\"application/json\"}", "json");
|
changeNode.ruleSet("headers", "msg", '{"content-type":"application/json"}', "json");
|
||||||
changeNode.clickOk();
|
changeNode.clickOk();
|
||||||
|
|
||||||
httpRequestNode.edit();
|
httpRequestNode.edit();
|
||||||
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-json');
|
httpRequestNode.setUrl(helper.url() + httpNodeRoot + '/hello-json');
|
||||||
httpRequestNode.setMethod("post");
|
httpRequestNode.setMethod("POST");
|
||||||
httpRequestNode.clickOk();
|
httpRequestNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(changeNode);
|
injectNode.connect(changeNode);
|
||||||
@ -531,13 +531,13 @@ describe('cookbook', function() {
|
|||||||
httpinNodeFormat.clickOk();
|
httpinNodeFormat.clickOk();
|
||||||
|
|
||||||
functionNodeFormat.edit();
|
functionNodeFormat.edit();
|
||||||
functionNodeFormat.setCode("msg.payload = JSON.stringify(msg.req.cookies,null,4);");
|
functionNodeFormat.setFunction("msg.payload = JSON.stringify(msg.req.cookies,null,4);\nreturn msg;");
|
||||||
functionNodeFormat.clickOk();
|
functionNodeFormat.clickOk();
|
||||||
|
|
||||||
templateNode.edit();
|
templateNode.edit();
|
||||||
templateNode.setSyntax("mustache");
|
templateNode.setSyntax("mustache");
|
||||||
templateNode.setFormat("handlebars");
|
templateNode.setFormat("handlebars");
|
||||||
templateNode.setTemplate("<html>\n<head></head>\n<body>\n<h1>Cookies</h1>\n<p></p><a href=\"hello-cookie/add\">Add a cookie</a> • <a href=\"hello-cookie/clear\">Clear cookies</a></p>\n<pre>{{ payload }}</pre>\n</body>\n</html>");
|
templateNode.setTemplate('<html>\n<head></head>\n<body>\n<h1>Cookies</h1>\n<p></p><a href="hello-cookie/add">Add a cookie</a> • <a href="hello-cookie/clear">Clear cookies</a></p>\n<pre>{{ payload }}</pre>\n</body>\n</html>');
|
||||||
templateNode.clickOk();
|
templateNode.clickOk();
|
||||||
|
|
||||||
httpinNodeFormat.connect(functionNodeFormat);
|
httpinNodeFormat.connect(functionNodeFormat);
|
||||||
@ -550,7 +550,7 @@ describe('cookbook', function() {
|
|||||||
httpinNodeAdd.clickOk();
|
httpinNodeAdd.clickOk();
|
||||||
|
|
||||||
functionNodeAdd.edit();
|
functionNodeAdd.edit();
|
||||||
functionNodeAdd.setCode("msg.cookies = { };\n msg.cookies[\"demo-\"+(Math.floor(Math.random()*1000))] = Date.now();");
|
functionNodeAdd.setFunction('msg.cookies = { };\n msg.cookies["demo-"+(Math.floor(Math.random()*1000))] = Date.now();\nreturn msg;');
|
||||||
functionNodeAdd.clickOk();
|
functionNodeAdd.clickOk();
|
||||||
|
|
||||||
changeNode.edit();
|
changeNode.edit();
|
||||||
@ -571,7 +571,7 @@ describe('cookbook', function() {
|
|||||||
httpinNodeClear.clickOk();
|
httpinNodeClear.clickOk();
|
||||||
|
|
||||||
functionNodeClear.edit();
|
functionNodeClear.edit();
|
||||||
functionNodeClear.setCode("var cookieNames = Object.keys(msg.req.cookies).filter(function(cookieName) { return /^demo-/.test(cookieName);});\nmsg.cookies = {};\n\ncookieNames.forEach(function(cookieName) {\n msg.cookies[cookieName] = null;\n});\n\n");
|
functionNodeClear.setFunction("var cookieNames = Object.keys(msg.req.cookies).filter(function(cookieName) { return /^demo-/.test(cookieName);});\nmsg.cookies = {};\n\ncookieNames.forEach(function(cookieName) {\n msg.cookies[cookieName] = null;\n});\nreturn msg;\n");
|
||||||
functionNodeClear.clickOk();
|
functionNodeClear.clickOk();
|
||||||
|
|
||||||
httpinNodeClear.connect(functionNodeClear);
|
httpinNodeClear.connect(functionNodeClear);
|
||||||
|
@ -19,8 +19,8 @@ var should = require("should");
|
|||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
|
|
||||||
var helper = require("../../editor_helper");
|
var helper = require("../../editor_helper");
|
||||||
var debugTab = require('../../pageobjects/workspace/debugTab_page');
|
var debugTab = require('../../pageobjects/editor/debugTab_page');
|
||||||
var workspace = require('../../pageobjects/workspace/workspace_page');
|
var workspace = require('../../pageobjects/editor/workspace_page');
|
||||||
var specUtil = require('../../pageobjects/util/spec_util_page');
|
var specUtil = require('../../pageobjects/util/spec_util_page');
|
||||||
|
|
||||||
var nodeWidth = 200;
|
var nodeWidth = 200;
|
||||||
@ -168,8 +168,8 @@ describe('cookbook', function() {
|
|||||||
var debugNode = workspace.addNode("debug", nodeWidth * 2);
|
var debugNode = workspace.addNode("debug", nodeWidth * 2);
|
||||||
|
|
||||||
injectNode.edit();
|
injectNode.edit();
|
||||||
injectNode.setTimeType("interval");
|
injectNode.setRepeat("interval");
|
||||||
injectNode.setRepeat(1);
|
injectNode.setRepeatInterval(1);
|
||||||
injectNode.clickOk();
|
injectNode.clickOk();
|
||||||
injectNode.connect(debugNode);
|
injectNode.connect(debugNode);
|
||||||
|
|
||||||
@ -196,12 +196,12 @@ describe('cookbook', function() {
|
|||||||
var debugNode = workspace.addNode("debug", nodeWidth * 3);
|
var debugNode = workspace.addNode("debug", nodeWidth * 3);
|
||||||
|
|
||||||
httpRequetNode.edit();
|
httpRequetNode.edit();
|
||||||
httpRequetNode.setMethod("get");
|
httpRequetNode.setMethod("GET");
|
||||||
httpRequetNode.setUrl(helper.url());
|
httpRequetNode.setUrl(helper.url());
|
||||||
httpRequetNode.clickOk();
|
httpRequetNode.clickOk();
|
||||||
|
|
||||||
htmlNode.edit();
|
htmlNode.edit();
|
||||||
htmlNode.setTag("title");
|
htmlNode.setSelector("title");
|
||||||
htmlNode.clickOk();
|
htmlNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(httpRequetNode);
|
injectNode.connect(httpRequetNode);
|
||||||
@ -336,14 +336,14 @@ describe('cookbook', function() {
|
|||||||
changeNodeSetPost.clickOk();
|
changeNodeSetPost.clickOk();
|
||||||
|
|
||||||
httpRequetNode.edit();
|
httpRequetNode.edit();
|
||||||
httpRequetNode.setMethod("get");
|
httpRequetNode.setMethod("GET");
|
||||||
var url = helper.url() + httpNodeRoot + "/{{post}}";
|
var url = helper.url() + httpNodeRoot + "/{{post}}";
|
||||||
httpRequetNode.setUrl(url);
|
httpRequetNode.setUrl(url);
|
||||||
httpRequetNode.setRet("obj");
|
httpRequetNode.setReturn("obj");
|
||||||
httpRequetNode.clickOk();
|
httpRequetNode.clickOk();
|
||||||
|
|
||||||
debugNode.edit();
|
debugNode.edit();
|
||||||
debugNode.setTarget("msg", "payload.title");
|
debugNode.setOutput("payload.title");
|
||||||
debugNode.clickOk();
|
debugNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(changeNodeSetPost);
|
injectNode.connect(changeNodeSetPost);
|
||||||
@ -364,11 +364,11 @@ describe('cookbook', function() {
|
|||||||
templateNode.edit();
|
templateNode.edit();
|
||||||
templateNode.setSyntax("mustache");
|
templateNode.setSyntax("mustache");
|
||||||
templateNode.setFormat("handlebars");
|
templateNode.setFormat("handlebars");
|
||||||
templateNode.setTemplate("{\"title\": \"Hello\"}");
|
templateNode.setTemplate('{"title": "Hello"}');
|
||||||
templateNode.clickOk();
|
templateNode.clickOk();
|
||||||
|
|
||||||
changeNodeSetHeader.edit();
|
changeNodeSetHeader.edit();
|
||||||
changeNodeSetHeader.ruleSet("headers", "msg", "{\"content-type\":\"application/json\"}", "json");
|
changeNodeSetHeader.ruleSet("headers", "msg", '{"content-type":"application/json"}', "json");
|
||||||
changeNodeSetHeader.clickOk();
|
changeNodeSetHeader.clickOk();
|
||||||
|
|
||||||
httpinNode.connect(templateNode);
|
httpinNode.connect(templateNode);
|
||||||
@ -389,9 +389,9 @@ describe('cookbook', function() {
|
|||||||
var debugNode = workspace.addNode("debug", nodeWidth * 2);
|
var debugNode = workspace.addNode("debug", nodeWidth * 2);
|
||||||
|
|
||||||
httpRequetNode.edit();
|
httpRequetNode.edit();
|
||||||
httpRequetNode.setMethod("get");
|
httpRequetNode.setMethod("GET");
|
||||||
httpRequetNode.setUrl(helper.url() + "/settings");
|
httpRequetNode.setUrl(helper.url() + "/settings");
|
||||||
httpRequetNode.setRet("bin");
|
httpRequetNode.setReturn("bin");
|
||||||
httpRequetNode.clickOk();
|
httpRequetNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(httpRequetNode);
|
injectNode.connect(httpRequetNode);
|
||||||
@ -413,11 +413,11 @@ describe('cookbook', function() {
|
|||||||
var debugNode = workspace.addNode("debug", nodeWidth * 3);
|
var debugNode = workspace.addNode("debug", nodeWidth * 3);
|
||||||
|
|
||||||
functionNode.edit();
|
functionNode.edit();
|
||||||
functionNode.setCode("msg.payload = \"data to post\";");
|
functionNode.setFunction('msg.payload = "data to post";\nreturn msg;');
|
||||||
functionNode.clickOk();
|
functionNode.clickOk();
|
||||||
|
|
||||||
httpRequetNode.edit();
|
httpRequetNode.edit();
|
||||||
httpRequetNode.setMethod("post");
|
httpRequetNode.setMethod("POST");
|
||||||
var url = helper.url() + httpNodeRoot + "/set-header";
|
var url = helper.url() + httpNodeRoot + "/set-header";
|
||||||
httpRequetNode.setUrl(url);
|
httpRequetNode.setUrl(url);
|
||||||
httpRequetNode.clickOk();
|
httpRequetNode.clickOk();
|
||||||
|
Loading…
Reference in New Issue
Block a user