mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add page objects for UI testing (#2501)
* Update page object of change node * Support multiple node outputs in UI testing * Add page object of switch node * Add page objects of trigger and exec nodes * Remove unnecessary code * Update page object of trigger node to select time unit * Add page objects of websocket nodes * Support boolean as value in selectWithWait() * Update page object of split node * Merge page objects of mqtt nodes to make them same as original mqtt node file path
This commit is contained in:
parent
6a30f2cbc8
commit
421b5846f2
@ -24,16 +24,21 @@ var idMap = {
|
|||||||
"comment": ".red-ui-palette-node[data-palette-type='comment']",
|
"comment": ".red-ui-palette-node[data-palette-type='comment']",
|
||||||
// function
|
// function
|
||||||
"function": ".red-ui-palette-node[data-palette-type='function']",
|
"function": ".red-ui-palette-node[data-palette-type='function']",
|
||||||
|
"switch": ".red-ui-palette-node[data-palette-type='switch']",
|
||||||
"change": ".red-ui-palette-node[data-palette-type='change']",
|
"change": ".red-ui-palette-node[data-palette-type='change']",
|
||||||
"range": ".red-ui-palette-node[data-palette-type='range']",
|
"range": ".red-ui-palette-node[data-palette-type='range']",
|
||||||
"template": ".red-ui-palette-node[data-palette-type='template']",
|
"template": ".red-ui-palette-node[data-palette-type='template']",
|
||||||
"delay": ".red-ui-palette-node[data-palette-type='delay']",
|
"delay": ".red-ui-palette-node[data-palette-type='delay']",
|
||||||
|
"trigger": ".red-ui-palette-node[data-palette-type='trigger']",
|
||||||
|
"exec": ".red-ui-palette-node[data-palette-type='exec']",
|
||||||
// network
|
// network
|
||||||
"mqttIn": ".red-ui-palette-node[data-palette-type='mqtt in']",
|
"mqttIn": ".red-ui-palette-node[data-palette-type='mqtt in']",
|
||||||
"mqttOut": ".red-ui-palette-node[data-palette-type='mqtt out']",
|
"mqttOut": ".red-ui-palette-node[data-palette-type='mqtt out']",
|
||||||
"httpIn": ".red-ui-palette-node[data-palette-type='http in']",
|
"httpIn": ".red-ui-palette-node[data-palette-type='http in']",
|
||||||
"httpResponse": ".red-ui-palette-node[data-palette-type='http response']",
|
"httpResponse": ".red-ui-palette-node[data-palette-type='http response']",
|
||||||
"httpRequest": ".red-ui-palette-node[data-palette-type='http request']",
|
"httpRequest": ".red-ui-palette-node[data-palette-type='http request']",
|
||||||
|
"websocketIn": ".red-ui-palette-node[data-palette-type='websocket in']",
|
||||||
|
"websocketOut": ".red-ui-palette-node[data-palette-type='websocket out']",
|
||||||
// sequence
|
// sequence
|
||||||
"split": ".red-ui-palette-node[data-palette-type='split']",
|
"split": ".red-ui-palette-node[data-palette-type='split']",
|
||||||
"join": ".red-ui-palette-node[data-palette-type='join']",
|
"join": ".red-ui-palette-node[data-palette-type='join']",
|
||||||
|
@ -18,8 +18,6 @@ var util = require("util");
|
|||||||
|
|
||||||
var nodePage = require("../../node_page");
|
var nodePage = require("../../node_page");
|
||||||
|
|
||||||
var keyPage = require("../../../util/key_page");
|
|
||||||
|
|
||||||
function debugNode(id) {
|
function debugNode(id) {
|
||||||
nodePage.call(this, id);
|
nodePage.call(this, id);
|
||||||
}
|
}
|
||||||
|
234
test/editor/pageobjects/nodes/core/function/10-switch_page.js
Normal file
234
test/editor/pageobjects/nodes/core/function/10-switch_page.js
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
var util = require('util');
|
||||||
|
|
||||||
|
var nodePage = require('../../node_page');
|
||||||
|
|
||||||
|
function switchNode(id) {
|
||||||
|
nodePage.call(this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(switchNode, nodePage);
|
||||||
|
|
||||||
|
var vtType = {
|
||||||
|
"msg": 1,
|
||||||
|
"flow": 2,
|
||||||
|
"global": 3,
|
||||||
|
"str": 4,
|
||||||
|
"num": 5,
|
||||||
|
"jsonata": 6,
|
||||||
|
"env": 7,
|
||||||
|
"prev": 8
|
||||||
|
};
|
||||||
|
|
||||||
|
function setT(t, index) {
|
||||||
|
browser.selectWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/select', t);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setV(v, vt, index) {
|
||||||
|
if (vt) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + vtType[vt] + ']');
|
||||||
|
}
|
||||||
|
if (v) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/div/input', v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setBetweenV(v, vt, v2, v2t, index) {
|
||||||
|
if (vt) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div[2]/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + vtType[vt] + ']');
|
||||||
|
}
|
||||||
|
if (v) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div[2]/div[1]/input', v);
|
||||||
|
}
|
||||||
|
if (v2t) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[3]/div/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + vtType[v2t] + ']');
|
||||||
|
}
|
||||||
|
if (v2) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[3]/div/div[1]/input', v2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSequenceV(v, vt, index) {
|
||||||
|
var sType = {
|
||||||
|
"flow": 1,
|
||||||
|
"global": 2,
|
||||||
|
"num": 3,
|
||||||
|
"jsonata": 4,
|
||||||
|
"env": 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (vt) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div[2]/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + sType[vt] + ']');
|
||||||
|
}
|
||||||
|
if (v) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div[2]/div[1]/input', v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleEqual = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('eq', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleNotEqual = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('neq', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleLessThan = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('lt', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleLessThanOrEqual = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('lte', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleGreaterThan = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('gt', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleGreaterThanOrEqual = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('gte', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleHasKey = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('hask', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIsBetween = function (v, vt, v2, v2t, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('btwn', index);
|
||||||
|
setBetweenV(v, vt, v2, v2t, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleContains = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('cont', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleMatchesRegex = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('regex', index);
|
||||||
|
setV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIsTrue = function (index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('true', index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIsFalse = function (index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('false', index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIsNull = function (index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('null', index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIsNotNull = function (index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('nnull', index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIsOfType = function (t, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('istype', index);
|
||||||
|
|
||||||
|
var tType = {
|
||||||
|
"str": 1,
|
||||||
|
"num": 2,
|
||||||
|
"boolean": 3,
|
||||||
|
"array": 4,
|
||||||
|
"buffer": 5,
|
||||||
|
"object": 6,
|
||||||
|
"json": 7,
|
||||||
|
"undefined": 8,
|
||||||
|
"null": 9
|
||||||
|
};
|
||||||
|
|
||||||
|
if (t) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div[2]/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + tType[t] + ']');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIsEmpty = function (index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('empty', index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIsNotEmpty = function (index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('nempty', index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleHead = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('head', index);
|
||||||
|
setSequenceV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleIndexBetween = function (v, vt, v2, v2t, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('index', index);
|
||||||
|
setBetweenV(v, vt, v2, v2t, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleTail = function (v, vt, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('tail', index);
|
||||||
|
setSequenceV(v, vt, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleJSONataExp = function (v, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('jsonata_exp', index);
|
||||||
|
if (v) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div[2]/div[1]/input', v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.ruleOtherwise = function (index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('else', index);
|
||||||
|
}
|
||||||
|
|
||||||
|
switchNode.prototype.addRule = function () {
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-editableList")]/a');
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = switchNode;
|
@ -51,37 +51,78 @@ function setT(t, index) {
|
|||||||
// 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,
|
||||||
changeNode.prototype.ruleSet = function (p, pt, to, tot, index) {
|
changeNode.prototype.ruleSet = function (p, pt, to, tot, index) {
|
||||||
index = index || 1;
|
index = index || 1;
|
||||||
setT("set", index);
|
setT('set', index);
|
||||||
if (pt) {
|
if (pt) {
|
||||||
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/button[1]');
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/button[1]');
|
||||||
var num = 5 * (index - 1) + 1;
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + ptType[pt] + ']');
|
||||||
var ptXPath = '//div[contains(@class, "red-ui-typedInput-options")][' + num + ']/a[' + ptType[pt] + ']';
|
|
||||||
browser.clickWithWait(ptXPath);
|
|
||||||
}
|
}
|
||||||
if (p) {
|
if (p) {
|
||||||
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/div/input', p);
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/div/input', p);
|
||||||
}
|
}
|
||||||
if (tot) {
|
if (tot) {
|
||||||
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[2]/div[2]/button[1]');
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[2]/div[2]/button[1]');
|
||||||
var num = 5 * (index - 1) + 2;
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + totType[tot] + ']');
|
||||||
var totXPath = '//div[contains(@class, "red-ui-typedInput-options")][' + num + ']/a[' + totType[tot] + ']';
|
|
||||||
browser.clickWithWait(totXPath);
|
|
||||||
}
|
}
|
||||||
if (to) {
|
if (to) {
|
||||||
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[2]/div[2]/div/input', to);
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[2]/div[2]/div/input', to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeNode.prototype.ruleDelete = function (index) {
|
changeNode.prototype.ruleChange = function (p, pt, from, fromt, to, tot, index) {
|
||||||
index = index || 1;
|
index = index || 1;
|
||||||
setT("delete", index);
|
setT('change', index);
|
||||||
|
if (pt) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + ptType[pt] + ']');
|
||||||
|
}
|
||||||
|
if (p) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/div/input', p);
|
||||||
|
}
|
||||||
|
if (fromt) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[3]/div[1]/div[2]/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + totType[pt] + ']');
|
||||||
|
}
|
||||||
|
if (from) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[3]/div[1]/div[2]/div[1]/input', from);
|
||||||
|
}
|
||||||
|
if (tot) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[3]/div[2]/div[2]/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + totType[pt] + ']');
|
||||||
|
}
|
||||||
|
if (to) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[3]/div[2]/div[2]/div[1]/input', to);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeNode.prototype.ruleMove = function (p, to, index) {
|
changeNode.prototype.ruleDelete = function (p, pt, index) {
|
||||||
index = index || 1;
|
index = index || 1;
|
||||||
setT("move", index);
|
setT('delete', index);
|
||||||
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/div/input', p);
|
if (pt) {
|
||||||
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[4]/div[2]/div/input', to);
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + ptType[pt] + ']');
|
||||||
|
}
|
||||||
|
if (p) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/div/input', p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
changeNode.prototype.ruleMove = function (p, pt, to, tot, index) {
|
||||||
|
index = index || 1;
|
||||||
|
setT('move', index);
|
||||||
|
if (pt) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + ptType[pt] + ']');
|
||||||
|
}
|
||||||
|
if (p) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/div/input', p);
|
||||||
|
}
|
||||||
|
if (tot) {
|
||||||
|
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[4]/div[2]/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + totType[pt] + ']');
|
||||||
|
}
|
||||||
|
if (to) {
|
||||||
|
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[4]/div[2]/div/input', to);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeNode.prototype.addRule = function () {
|
changeNode.prototype.addRule = function () {
|
||||||
|
@ -18,8 +18,6 @@ var util = require("util");
|
|||||||
|
|
||||||
var nodePage = require("../../node_page");
|
var nodePage = require("../../node_page");
|
||||||
|
|
||||||
var keyPage = require("../../../util/key_page");
|
|
||||||
|
|
||||||
function delayNode(id) {
|
function delayNode(id) {
|
||||||
nodePage.call(this, id);
|
nodePage.call(this, id);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
var util = require("util");
|
||||||
|
|
||||||
|
var nodePage = require("../../node_page");
|
||||||
|
|
||||||
|
function triggerNode(id) {
|
||||||
|
nodePage.call(this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(triggerNode, nodePage);
|
||||||
|
|
||||||
|
triggerNode.prototype.setSend = function (send, sendt) {
|
||||||
|
var sendType = {
|
||||||
|
"flow": 1,
|
||||||
|
"global": 2,
|
||||||
|
"str": 3,
|
||||||
|
"num": 4,
|
||||||
|
"bool": 5,
|
||||||
|
"json": 6,
|
||||||
|
"bin": 7,
|
||||||
|
"date": 8,
|
||||||
|
"env": 9,
|
||||||
|
"pay": 10,
|
||||||
|
"nul": 11
|
||||||
|
};
|
||||||
|
|
||||||
|
if (sendt) {
|
||||||
|
browser.clickWithWait('//*[@id="dialog-form"]/div[1]/div/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + sendType[sendt] + ']');
|
||||||
|
}
|
||||||
|
if (send) {
|
||||||
|
browser.setValue('//*[@id="dialog-form"]/div[1]/div/div[1]/input', send);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggerNode.prototype.setDuration = function (duration, units) {
|
||||||
|
browser.setValue('//*[@id="node-input-duration"]', duration);
|
||||||
|
if (units) {
|
||||||
|
browser.selectWithWait('//*[@id="node-input-units"]', units);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggerNode.prototype.setThenSend = function (thenSend, thenSendt) {
|
||||||
|
var thenSendType = {
|
||||||
|
"flow": 1,
|
||||||
|
"global": 2,
|
||||||
|
"str": 3,
|
||||||
|
"num": 4,
|
||||||
|
"bool": 5,
|
||||||
|
"json": 6,
|
||||||
|
"bin": 7,
|
||||||
|
"date": 8,
|
||||||
|
"env": 9,
|
||||||
|
"pay": 10,
|
||||||
|
"payl": 11,
|
||||||
|
"nul": 12
|
||||||
|
};
|
||||||
|
|
||||||
|
if (thenSendt) {
|
||||||
|
browser.clickWithWait('//*[@id="dialog-form"]/div[5]/div/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + thenSendType[thenSendt] + ']');
|
||||||
|
}
|
||||||
|
if (thenSend) {
|
||||||
|
browser.setValue('//*[@id="dialog-form"]/div[5]/div/div[1]/input', thenSend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = triggerNode;
|
@ -18,18 +18,20 @@ var util = require("util");
|
|||||||
|
|
||||||
var nodePage = require("../../node_page");
|
var nodePage = require("../../node_page");
|
||||||
|
|
||||||
function mqttInNode(id) {
|
function execNode(id) {
|
||||||
nodePage.call(this, id);
|
nodePage.call(this, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
util.inherits(mqttInNode, nodePage);
|
util.inherits(execNode, nodePage);
|
||||||
|
|
||||||
mqttInNode.prototype.setTopic = function (topic) {
|
execNode.prototype.setCommand = function (command) {
|
||||||
browser.setValue('#node-input-topic', topic);
|
browser.setValue('//*[@id="node-input-command"]', command);
|
||||||
}
|
}
|
||||||
|
|
||||||
mqttInNode.prototype.setQoS = function (qos) {
|
execNode.prototype.setAppend = function (checkbox) {
|
||||||
browser.selectWithWait('#node-input-qos', qos);
|
if (browser.isSelected('#node-input-addpay') !== checkbox) {
|
||||||
|
browser.click('#node-input-addpay');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = mqttInNode;
|
module.exports = execNode;
|
@ -14,27 +14,61 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
function setServer(broker, port) {
|
var util = require("util");
|
||||||
|
|
||||||
|
var nodePage = require("../../node_page");
|
||||||
|
|
||||||
|
var mqttBrokerNode = {};
|
||||||
|
|
||||||
|
mqttBrokerNode.setServer = function (broker, port) {
|
||||||
browser.setValue('#node-config-input-broker', broker);
|
browser.setValue('#node-config-input-broker', broker);
|
||||||
port = port ? port : 1883;
|
port = port ? port : 1883;
|
||||||
browser.setValue('#node-config-input-port', port);
|
browser.setValue('#node-config-input-port', port);
|
||||||
}
|
};
|
||||||
|
|
||||||
function clickOk() {
|
mqttBrokerNode.clickOk = function () {
|
||||||
browser.clickWithWait('#node-config-dialog-ok');
|
browser.clickWithWait('#node-config-dialog-ok');
|
||||||
// Wait until an config dialog closes.
|
// Wait until an config dialog closes.
|
||||||
browser.waitForVisible('#node-config-dialog-ok', 10000, true);
|
browser.waitForVisible('#node-config-dialog-ok', 10000, true);
|
||||||
}
|
};
|
||||||
|
|
||||||
function edit() {
|
mqttBrokerNode.edit = function () {
|
||||||
browser.waitForVisible('#node-input-lookup-broker');
|
browser.waitForVisible('#node-input-lookup-broker');
|
||||||
browser.click('#node-input-lookup-broker');
|
browser.click('#node-input-lookup-broker');
|
||||||
// Wait until a config dialog opens.
|
// Wait until a config dialog opens.
|
||||||
browser.waitForVisible('#node-config-dialog-ok', 10000);
|
browser.waitForVisible('#node-config-dialog-ok', 10000);
|
||||||
|
};
|
||||||
|
|
||||||
|
function mqttInNode(id) {
|
||||||
|
nodePage.call(this, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
util.inherits(mqttInNode, nodePage);
|
||||||
setServer: setServer,
|
|
||||||
clickOk: clickOk,
|
mqttInNode.prototype.setTopic = function (topic) {
|
||||||
edit: edit
|
browser.setValue('#node-input-topic', topic);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mqttInNode.prototype.setQoS = function (qos) {
|
||||||
|
browser.selectWithWait('#node-input-qos', qos);
|
||||||
|
};
|
||||||
|
|
||||||
|
mqttInNode.prototype.mqttBrokerNode = mqttBrokerNode;
|
||||||
|
module.exports.mqttInNode = mqttInNode;
|
||||||
|
|
||||||
|
function mqttOutNode(id) {
|
||||||
|
nodePage.call(this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(mqttOutNode, nodePage);
|
||||||
|
|
||||||
|
mqttOutNode.prototype.setTopic = function (topic) {
|
||||||
|
browser.setValue('#node-input-topic', topic);
|
||||||
|
};
|
||||||
|
|
||||||
|
mqttOutNode.prototype.setRetain = function (retain) {
|
||||||
|
browser.selectWithWait('#node-input-retain', retain);
|
||||||
|
};
|
||||||
|
|
||||||
|
mqttOutNode.prototype.mqttBrokerNode = mqttBrokerNode;
|
||||||
|
module.exports.mqttOutNode = mqttOutNode;
|
@ -1,35 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright JS Foundation and other contributors, http://js.foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
**/
|
|
||||||
|
|
||||||
var util = require("util");
|
|
||||||
|
|
||||||
var nodePage = require("../../node_page");
|
|
||||||
|
|
||||||
function mqttOutNode(id) {
|
|
||||||
nodePage.call(this, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
util.inherits(mqttOutNode, nodePage);
|
|
||||||
|
|
||||||
mqttOutNode.prototype.setTopic = function(topic) {
|
|
||||||
browser.setValue('#node-input-topic', topic);
|
|
||||||
}
|
|
||||||
|
|
||||||
mqttOutNode.prototype.setRetain = function (retain) {
|
|
||||||
browser.selectWithWait('#node-input-retain', retain);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = mqttOutNode;
|
|
@ -0,0 +1,93 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
var util = require("util");
|
||||||
|
|
||||||
|
var nodePage = require("../../node_page");
|
||||||
|
|
||||||
|
var websocketListenerNode = {};
|
||||||
|
|
||||||
|
websocketListenerNode.setPath = function (path) {
|
||||||
|
browser.setValue('#node-config-input-path', path);
|
||||||
|
};
|
||||||
|
|
||||||
|
websocketListenerNode.setSendReceive = function (wholemsg) {
|
||||||
|
browser.selectWithWait('#node-config-input-wholemsg', wholemsg);
|
||||||
|
};
|
||||||
|
|
||||||
|
websocketListenerNode.clickOk = function () {
|
||||||
|
browser.clickWithWait('#node-config-dialog-ok');
|
||||||
|
// Wait until an config dialog closes.
|
||||||
|
browser.waitForVisible('#node-config-dialog-ok', 10000, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
websocketListenerNode.edit = function () {
|
||||||
|
browser.waitForVisible('#node-input-lookup-server');
|
||||||
|
browser.click('#node-input-lookup-server');
|
||||||
|
// Wait until a config dialog opens.
|
||||||
|
browser.waitForVisible('#node-config-dialog-ok', 10000);
|
||||||
|
};
|
||||||
|
|
||||||
|
var websocketClientNode = {};
|
||||||
|
|
||||||
|
websocketClientNode.setPath = function (path) {
|
||||||
|
browser.setValue('#node-config-input-path', path);
|
||||||
|
};
|
||||||
|
|
||||||
|
websocketClientNode.setSendReceive = function (wholemsg) {
|
||||||
|
browser.selectWithWait('#node-config-input-wholemsg', wholemsg);
|
||||||
|
};
|
||||||
|
|
||||||
|
websocketClientNode.clickOk = function () {
|
||||||
|
browser.clickWithWait('#node-config-dialog-ok');
|
||||||
|
// Wait until an config dialog closes.
|
||||||
|
browser.waitForVisible('#node-config-dialog-ok', 10000, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
websocketClientNode.edit = function () {
|
||||||
|
browser.waitForVisible('#node-input-lookup-client');
|
||||||
|
browser.click('#node-input-lookup-client');
|
||||||
|
// Wait until a config dialog opens.
|
||||||
|
browser.waitForVisible('#node-config-dialog-ok', 10000);
|
||||||
|
};
|
||||||
|
|
||||||
|
function websocketInNode(id) {
|
||||||
|
nodePage.call(this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(websocketInNode, nodePage);
|
||||||
|
|
||||||
|
websocketInNode.prototype.setType = function (type) {
|
||||||
|
browser.selectWithWait('#node-input-mode', type);
|
||||||
|
};
|
||||||
|
|
||||||
|
websocketInNode.prototype.websocketListenerNode = websocketListenerNode;
|
||||||
|
websocketInNode.prototype.websocketClientNode = websocketClientNode;
|
||||||
|
module.exports.websocketInNode = websocketInNode;
|
||||||
|
|
||||||
|
function websocketOutNode(id) {
|
||||||
|
nodePage.call(this, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
util.inherits(websocketOutNode, nodePage);
|
||||||
|
|
||||||
|
websocketOutNode.prototype.setType = function (type) {
|
||||||
|
browser.selectWithWait('#node-input-mode', type);
|
||||||
|
};
|
||||||
|
|
||||||
|
websocketOutNode.prototype.websocketListenerNode = websocketListenerNode;
|
||||||
|
websocketOutNode.prototype.websocketClientNode = websocketClientNode;
|
||||||
|
module.exports.websocketOutNode = websocketOutNode;
|
@ -24,7 +24,19 @@ function splitNode(id) {
|
|||||||
|
|
||||||
util.inherits(splitNode, nodePage);
|
util.inherits(splitNode, nodePage);
|
||||||
|
|
||||||
module.exports = splitNode;
|
splitNode.prototype.setSplitUsing = function (splt, spltt) {
|
||||||
|
var spltType = {
|
||||||
|
"str": 1,
|
||||||
|
"bin": 2,
|
||||||
|
"len": 3
|
||||||
|
};
|
||||||
|
|
||||||
|
browser.clickWithWait('//*[@id="dialog-form"]/div[3]/div/button[1]');
|
||||||
|
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options") and not(contains(@style, "display: none"))]/a[' + spltType[spltt] + ']');
|
||||||
|
browser.setValue('//*[@id="dialog-form"]/div[3]/div/div[1]/input', splt);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.splitNode = splitNode;
|
||||||
|
|
||||||
function joinNode(id) {
|
function joinNode(id) {
|
||||||
nodePage.call(this, id);
|
nodePage.call(this, id);
|
||||||
@ -32,4 +44,4 @@ function joinNode(id) {
|
|||||||
|
|
||||||
util.inherits(joinNode, nodePage);
|
util.inherits(joinNode, nodePage);
|
||||||
|
|
||||||
module.exports = joinNode;
|
module.exports.joinNode = joinNode;
|
||||||
|
@ -35,10 +35,11 @@ Node.prototype.clickOk = function () {
|
|||||||
browser.pause(50);
|
browser.pause(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node.prototype.connect = function (targetNode) {
|
Node.prototype.connect = function (targetNode, port) {
|
||||||
var outputPort = this.id + '/*[@class="red-ui-flow-port-output"]';
|
port = port || 1;
|
||||||
|
var outputPort = this.id + '/*[@class="red-ui-flow-port-output"][' + port + ']';
|
||||||
var inputPort = targetNode.id + '/*[@class="red-ui-flow-port-input"]';
|
var inputPort = targetNode.id + '/*[@class="red-ui-flow-port-input"]';
|
||||||
browser.dragAndDrop(outputPort, inputPort)
|
browser.dragAndDrop(outputPort, inputPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node.prototype.clickLeftButton = function () {
|
Node.prototype.clickLeftButton = function () {
|
||||||
|
@ -21,17 +21,22 @@ var catchNode = require('./core/common/25-catch_page');
|
|||||||
var statusNode = require('./core/common/25-status_page');
|
var statusNode = require('./core/common/25-status_page');
|
||||||
var commentNode = require('./core/common/90-comment_page');
|
var commentNode = require('./core/common/90-comment_page');
|
||||||
var functionNode = require('./core/function/10-function_page');
|
var functionNode = require('./core/function/10-function_page');
|
||||||
|
var switchNode = require('./core/function/10-switch_page');
|
||||||
var changeNode = require('./core/function/15-change_page');
|
var changeNode = require('./core/function/15-change_page');
|
||||||
var rangeNode = require('./core/function/16-range_page');
|
var rangeNode = require('./core/function/16-range_page');
|
||||||
var templateNode = require('./core/function/80-template_page');
|
var templateNode = require('./core/function/80-template_page');
|
||||||
var delayNode = require('./core/function/89-delay_page');
|
var delayNode = require('./core/function/89-delay_page');
|
||||||
var mqttInNode = require('./core/network/10-mqttin_page');
|
var triggerNode = require('./core/function/89-trigger_page');
|
||||||
var mqttOutNode = require('./core/network/10-mqttout_page');
|
var execNode = require('./core/function/90-exec_page');
|
||||||
|
var mqttInNode = require('./core/network/10-mqtt_page').mqttInNode;
|
||||||
|
var mqttOutNode = require('./core/network/10-mqtt_page').mqttOutNode;
|
||||||
var httpInNode = require('./core/network/21-httpin_page');
|
var httpInNode = require('./core/network/21-httpin_page');
|
||||||
var httpResponseNode = require('./core/network/21-httpresponse_page');
|
var httpResponseNode = require('./core/network/21-httpresponse_page');
|
||||||
var httpRequestNode = require('./core/network/21-httprequest_page');
|
var httpRequestNode = require('./core/network/21-httprequest_page');
|
||||||
var splitNode = require('./core/sequence/17-split_page');
|
var websocketInNode = require('./core/network/22-websocket_page').websocketInNode;
|
||||||
var joinNode = require('./core/sequence/17-split_page');
|
var websocketOutNode = require('./core/network/22-websocket_page').websocketOutNode;
|
||||||
|
var splitNode = require('./core/sequence/17-split_page').splitNode;
|
||||||
|
var joinNode = require('./core/sequence/17-split_page').joinNode;
|
||||||
var batchNode = require('./core/sequence/19-batch_page');
|
var batchNode = require('./core/sequence/19-batch_page');
|
||||||
var csvNode = require('./core/parsers/70-CSV_page');
|
var csvNode = require('./core/parsers/70-CSV_page');
|
||||||
var htmlNode = require('./core/parsers/70-HTML_page');
|
var htmlNode = require('./core/parsers/70-HTML_page');
|
||||||
@ -50,16 +55,21 @@ var nodeCatalog = {
|
|||||||
"comment": commentNode,
|
"comment": commentNode,
|
||||||
// function
|
// function
|
||||||
"function": functionNode,
|
"function": functionNode,
|
||||||
|
"switch": switchNode,
|
||||||
"change": changeNode,
|
"change": changeNode,
|
||||||
"range": rangeNode,
|
"range": rangeNode,
|
||||||
"template": templateNode,
|
"template": templateNode,
|
||||||
"delay": delayNode,
|
"delay": delayNode,
|
||||||
|
"trigger": triggerNode,
|
||||||
|
"exec": execNode,
|
||||||
// network
|
// network
|
||||||
"mqttIn": mqttInNode,
|
"mqttIn": mqttInNode,
|
||||||
"mqttOut": mqttOutNode,
|
"mqttOut": mqttOutNode,
|
||||||
"httpIn": httpInNode,
|
"httpIn": httpInNode,
|
||||||
"httpResponse": httpResponseNode,
|
"httpResponse": httpResponseNode,
|
||||||
"httpRequest": httpRequestNode,
|
"httpRequest": httpRequestNode,
|
||||||
|
"websocketIn": websocketInNode,
|
||||||
|
"websocketOut": websocketOutNode,
|
||||||
// sequence
|
// sequence
|
||||||
"split": splitNode,
|
"split": splitNode,
|
||||||
"join": joinNode,
|
"join": joinNode,
|
||||||
|
@ -70,7 +70,7 @@ function init() {
|
|||||||
|
|
||||||
var ret = repeatUntilSuccess(function(args) {
|
var ret = repeatUntilSuccess(function(args) {
|
||||||
return browser.selectByValue(args[0], args[1]);
|
return browser.selectByValue(args[0], args[1]);
|
||||||
}, [selector, value]);
|
}, [selector, value.toString()]);
|
||||||
return ret;
|
return ret;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.trace();
|
console.trace();
|
||||||
|
@ -88,7 +88,7 @@ describe('cookbook', function () {
|
|||||||
injectNode.clickOk();
|
injectNode.clickOk();
|
||||||
|
|
||||||
changeNode.edit();
|
changeNode.edit();
|
||||||
changeNode.ruleMove('topic', 'payload');
|
changeNode.ruleMove('topic', 'msg', 'payload', 'msg');
|
||||||
changeNode.clickOk();
|
changeNode.clickOk();
|
||||||
|
|
||||||
injectNode.connect(changeNode);
|
injectNode.connect(changeNode);
|
||||||
|
@ -22,7 +22,6 @@ var helper = require("../../editor_helper");
|
|||||||
var debugTab = require('../../pageobjects/editor/debugTab_page');
|
var debugTab = require('../../pageobjects/editor/debugTab_page');
|
||||||
var workspace = require('../../pageobjects/editor/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 mqttConfig = require('../../pageobjects/nodes/core/network/10-mqttconfig_page.js');
|
|
||||||
|
|
||||||
var httpNodeRoot = "/api";
|
var httpNodeRoot = "/api";
|
||||||
|
|
||||||
@ -73,9 +72,9 @@ describe('cookbook', function () {
|
|||||||
var mqttOutNode = workspace.addNode("mqttOut");
|
var mqttOutNode = workspace.addNode("mqttOut");
|
||||||
|
|
||||||
mqttOutNode.edit();
|
mqttOutNode.edit();
|
||||||
mqttConfig.edit();
|
mqttOutNode.mqttBrokerNode.edit();
|
||||||
mqttConfig.setServer("localhost", moscaSettings.port);
|
mqttOutNode.mqttBrokerNode.setServer("localhost", moscaSettings.port);
|
||||||
mqttConfig.clickOk();
|
mqttOutNode.mqttBrokerNode.clickOk();
|
||||||
mqttOutNode.clickOk();
|
mqttOutNode.clickOk();
|
||||||
|
|
||||||
workspace.deploy();
|
workspace.deploy();
|
||||||
|
Loading…
Reference in New Issue
Block a user