mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix test cases for UI
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
var idMap = {
|
||||
// input
|
||||
"inject": ".red-ui-palette-node[data-palette-type='inject']",
|
||||
"httpin": ".red-ui-palette-node[data-palette-type='http in']",
|
||||
"httpIn": ".red-ui-palette-node[data-palette-type='http in']",
|
||||
"mqttIn": ".red-ui-palette-node[data-palette-type='mqtt in']",
|
||||
// output
|
||||
"debug": ".red-ui-palette-node[data-palette-type='debug']",
|
||||
@@ -32,7 +32,7 @@ var idMap = {
|
||||
"html": ".red-ui-palette-node[data-palette-type='html']",
|
||||
"json": ".red-ui-palette-node[data-palette-type='json']",
|
||||
// storage
|
||||
"filein": ".red-ui-palette-node[data-palette-type='file in']",
|
||||
"fileIn": ".red-ui-palette-node[data-palette-type='file in']",
|
||||
};
|
||||
|
||||
function getId(type) {
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
var when = require("when");
|
||||
var when = require("when");
|
||||
|
||||
var events = require("nr-test-utils").require("@node-red/runtime/lib/events.js");
|
||||
|
||||
@@ -44,6 +44,7 @@ function addNode(type, x, y) {
|
||||
previousY = previousY + flowLayout.heightInterval;
|
||||
}
|
||||
}
|
||||
browser.waitForVisible(palette.getId(type));
|
||||
browser.moveToObject(palette.getId(type));
|
||||
browser.buttonDown();
|
||||
browser.moveToObject("#red-ui-palette-search", previousX + 300, previousY + 100); // adjust to the top-left corner of workspace.
|
||||
@@ -56,7 +57,12 @@ function addNode(type, x, y) {
|
||||
}
|
||||
|
||||
function deleteAllNodes() {
|
||||
browser.click('.red-ui-workspace-chart-event-layer');
|
||||
browser.waitForVisible('.red-ui-workspace-chart-event-layer');
|
||||
try {
|
||||
browser.click('.red-ui-workspace-chart-event-layer');
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
browser.keys(['Control', 'a', 'a', 'Control']); // call twice to release the keys.
|
||||
browser.keys(['Delete']);
|
||||
}
|
||||
|
@@ -47,11 +47,11 @@ injectNode.prototype.setPayload = function(payloadType, payload) {
|
||||
// Open a payload type list.
|
||||
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-container")]');
|
||||
// Select a payload type.
|
||||
var payloadTypeXPath = '//*[@class="red-ui-typedInput-options"]/a[' + payloadTypeList[payloadType] + ']';
|
||||
var payloadTypeXPath = '//*[contains(@class, "red-ui-typedInput-options")]/a[' + payloadTypeList[payloadType] + ']';
|
||||
browser.clickWithWait(payloadTypeXPath);
|
||||
if (payload) {
|
||||
// Input a value.
|
||||
browser.setValue('//*[@class="red-ui-typedInput-input"]/input', payload);
|
||||
browser.setValue('//*[contains(@class, "red-ui-typedInput-input")]/input', payload);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ debugNode.prototype.setOutput = function(complete) {
|
||||
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-container")]/button');
|
||||
if (complete !== 'true') {
|
||||
// Select the "msg" type.
|
||||
browser.clickWithWait('//div[@class="red-ui-typedInput-options"][1]/a[1]');
|
||||
browser.clickWithWait('//div[contains(@class, "red-ui-typedInput-options")][1]/a[1]');
|
||||
// Input the path in msg.
|
||||
browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-input")]/input');
|
||||
browser.keys(keyPage.selectAll());
|
||||
|
@@ -23,13 +23,14 @@ function setServer(broker, port) {
|
||||
function clickOk() {
|
||||
browser.clickWithWait('#node-config-dialog-ok');
|
||||
// Wait until an config dialog closes.
|
||||
browser.waitForVisible('#node-config-dialog-ok', 2000, true);
|
||||
browser.waitForVisible('#node-config-dialog-ok', 4000, true);
|
||||
}
|
||||
|
||||
function edit() {
|
||||
browser.clickWithWait('#node-input-lookup-broker');
|
||||
browser.waitForVisible('#node-input-lookup-broker');
|
||||
browser.click('#node-input-lookup-broker');
|
||||
// Wait until a config dialog opens.
|
||||
browser.waitForVisible('#node-config-dialog-ok', 2000);
|
||||
browser.waitForVisible('#node-config-dialog-ok', 4000);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@@ -18,18 +18,18 @@ var util = require("util");
|
||||
|
||||
var nodePage = require("../../node_page");
|
||||
|
||||
function httpinNode(id) {
|
||||
function httpInNode(id) {
|
||||
nodePage.call(this, id);
|
||||
}
|
||||
|
||||
util.inherits(httpinNode, nodePage);
|
||||
util.inherits(httpInNode, nodePage);
|
||||
|
||||
httpinNode.prototype.setMethod = function(method) {
|
||||
httpInNode.prototype.setMethod = function(method) {
|
||||
browser.selectWithWait('#node-input-method', method);
|
||||
}
|
||||
|
||||
httpinNode.prototype.setUrl = function(url) {
|
||||
httpInNode.prototype.setUrl = function(url) {
|
||||
browser.setValue('#node-input-url', url);
|
||||
}
|
||||
|
||||
module.exports = httpinNode;
|
||||
module.exports = httpInNode;
|
||||
|
@@ -55,7 +55,7 @@ changeNode.prototype.ruleSet = function(p, pt, to, tot, index) {
|
||||
if (pt) {
|
||||
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/button[1]');
|
||||
var num = 5 * (index - 1) + 1;
|
||||
var ptXPath = '//div[@class="red-ui-typedInput-options"][' + num + ']/a[' + ptType[pt] + ']';
|
||||
var ptXPath = '//div[contains(@class, "red-ui-typedInput-options")][' + num + ']/a[' + ptType[pt] + ']';
|
||||
browser.clickWithWait(ptXPath);
|
||||
}
|
||||
if (p) {
|
||||
@@ -64,7 +64,7 @@ changeNode.prototype.ruleSet = function(p, pt, to, tot, index) {
|
||||
if (tot) {
|
||||
browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[2]/div[2]/button[1]');
|
||||
var num = 5 * (index - 1) + 2;
|
||||
var totXPath = '//div[@class="red-ui-typedInput-options"][' + num + ']/a[' + totType[tot] + ']';
|
||||
var totXPath = '//div[contains(@class, "red-ui-typedInput-options")][' + num + ']/a[' + totType[tot] + ']';
|
||||
browser.clickWithWait(totXPath);
|
||||
}
|
||||
if (to) {
|
||||
|
@@ -18,11 +18,11 @@ var util = require("util");
|
||||
|
||||
var nodePage = require("../../node_page");
|
||||
|
||||
function fileinNode(id) {
|
||||
function fileInNode(id) {
|
||||
nodePage.call(this, id);
|
||||
}
|
||||
|
||||
util.inherits(fileinNode, nodePage);
|
||||
util.inherits(fileInNode, nodePage);
|
||||
|
||||
var formatType = {
|
||||
"utf8": 1,
|
||||
@@ -31,14 +31,14 @@ var formatType = {
|
||||
"stream": 4
|
||||
};
|
||||
|
||||
fileinNode.prototype.setFilename = function(filename) {
|
||||
fileInNode.prototype.setFilename = function(filename) {
|
||||
browser.setValue('#node-input-filename', filename);
|
||||
}
|
||||
|
||||
fileinNode.prototype.setOutput = function(format) {
|
||||
fileInNode.prototype.setOutput = function(format) {
|
||||
browser.clickWithWait('#node-input-format');
|
||||
var formatTypeXPath = '//*[@id="node-input-format"]/option[' + formatType[format] + ']';
|
||||
browser.clickWithWait(formatTypeXPath);
|
||||
}
|
||||
|
||||
module.exports = fileinNode;
|
||||
module.exports = fileInNode;
|
||||
|
@@ -22,13 +22,13 @@ Node.prototype.edit = function() {
|
||||
browser.clickWithWait(this.id);
|
||||
browser.clickWithWait(this.id);
|
||||
// Wait until an edit dialog opens.
|
||||
browser.waitForVisible('#node-dialog-ok', 2000);
|
||||
browser.waitForVisible('#node-dialog-ok', 4000);
|
||||
}
|
||||
|
||||
Node.prototype.clickOk = function() {
|
||||
browser.clickWithWait('#node-dialog-ok');
|
||||
// Wait untile an edit dialog closes.
|
||||
browser.waitForVisible('#node-dialog-ok', 2000, true);
|
||||
browser.waitForVisible('#node-dialog-ok', 4000, true);
|
||||
browser.pause(50);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,10 @@ Node.prototype.connect = function(targetNode) {
|
||||
browser.dragAndDrop(outputPort, inputPort)
|
||||
}
|
||||
|
||||
Node.prototype.clickLeftButton = function() {
|
||||
browser.clickWithWait(this.id + '/*[@class="red-ui-flow-node-button"]');
|
||||
Node.prototype.clickLeftButton = function () {
|
||||
browser.moveToObject(this.id + '/*[@class="red-ui-flow-node-button"]');
|
||||
browser.buttonDown();
|
||||
browser.buttonUp();
|
||||
}
|
||||
|
||||
module.exports = Node;
|
||||
|
@@ -20,20 +20,20 @@ var templateNode = require('./core/core/80-template_page');
|
||||
var functionNode = require('./core/core/80-function_page');
|
||||
var mqttInNode = require('./core/io/10-mqttin_page');
|
||||
var mqttOutNode = require('./core/io/10-mqttout_page');
|
||||
var httpinNode = require('./core/io/21-httpin_page');
|
||||
var httpInNode = require('./core/io/21-httpin_page');
|
||||
var httpResponseNode = require('./core/io/21-httpresponse_page');
|
||||
var changeNode = require('./core/logic/15-change_page');
|
||||
var rangeNode = require('./core/logic/16-range_page');
|
||||
var httpRequestNode = require('./core/io/21-httprequest_page');
|
||||
var htmlNode = require('./core/parsers/70-HTML_page');
|
||||
var jsonNode = require('./core/parsers/70-JSON_page');
|
||||
var fileinNode = require('./core/storage/50-filein_page');
|
||||
var fileInNode = require('./core/storage/50-filein_page');
|
||||
|
||||
|
||||
var nodeCatalog = {
|
||||
// input
|
||||
"inject": injectNode,
|
||||
"httpin": httpinNode,
|
||||
"httpIn": httpInNode,
|
||||
"mqttIn":mqttInNode,
|
||||
// output
|
||||
"debug": debugNode,
|
||||
@@ -48,7 +48,7 @@ var nodeCatalog = {
|
||||
"html": htmlNode,
|
||||
"json":jsonNode,
|
||||
// storage
|
||||
"filein": fileinNode,
|
||||
"fileIn": fileInNode,
|
||||
}
|
||||
|
||||
function create(type, id) {
|
||||
|
Reference in New Issue
Block a user