mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Improve node files for UI testing
This commit is contained in:
parent
63978e226b
commit
faf46e4447
@ -26,12 +26,11 @@ function functionNode(id) {
|
|||||||
|
|
||||||
util.inherits(functionNode, nodePage);
|
util.inherits(functionNode, nodePage);
|
||||||
|
|
||||||
functionNode.prototype.setFunction = function(func) {
|
functionNode.prototype.setFunction = function (func) {
|
||||||
browser.clickWithWait('#node-input-func-editor');
|
browser.clickWithWait('#node-input-func-editor');
|
||||||
browser.keys(keyPage.selectAll());
|
browser.keys(keyPage.selectAll());
|
||||||
for (var i = 0; i < func.length; i++) {
|
browser.keys(['Delete']);
|
||||||
browser.keys([func.charAt(i)]);
|
browser.keys(func);
|
||||||
}
|
|
||||||
// Delete the unnecessary code that ace editor does the autocompletion.
|
// Delete the unnecessary code that ace editor does the autocompletion.
|
||||||
browser.keys(keyPage.selectToEnd());
|
browser.keys(keyPage.selectToEnd());
|
||||||
browser.keys(['Delete']);
|
browser.keys(['Delete']);
|
||||||
|
@ -49,8 +49,8 @@ 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 ? 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]');
|
||||||
@ -68,23 +68,23 @@ changeNode.prototype.ruleSet = function(p, pt, to, tot, index) {
|
|||||||
browser.clickWithWait(totXPath);
|
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.ruleDelete = function (index) {
|
||||||
index = index ? index : 1;
|
index = index || 1;
|
||||||
setT("delete", index);
|
setT("delete", index);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeNode.prototype.ruleMove = function(p, to, index) {
|
changeNode.prototype.ruleMove = function (p, to, index) {
|
||||||
index = index ? index : 1;
|
index = index || 1;
|
||||||
setT("move", index);
|
setT("move", index);
|
||||||
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);
|
||||||
browser.setValue('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[4]/div[2]/div/input', 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 () {
|
||||||
browser.clickWithWait('//*[@id="dialog-form"]/div[3]/div/a');
|
browser.clickWithWait('//*[@id="dialog-form"]/div[3]/div/a');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,21 +26,19 @@ function templateNode(id) {
|
|||||||
|
|
||||||
util.inherits(templateNode, nodePage);
|
util.inherits(templateNode, nodePage);
|
||||||
|
|
||||||
templateNode.prototype.setSyntax = function(syntax) {
|
templateNode.prototype.setSyntax = function (syntax) {
|
||||||
browser.selectWithWait('#node-input-syntax', syntax);
|
browser.selectWithWait('#node-input-syntax', syntax);
|
||||||
}
|
}
|
||||||
|
|
||||||
templateNode.prototype.setFormat = function(format) {
|
templateNode.prototype.setFormat = function (format) {
|
||||||
browser.selectWithWait('#node-input-format', format);
|
browser.selectWithWait('#node-input-format', format);
|
||||||
}
|
}
|
||||||
|
|
||||||
templateNode.prototype.setTemplate = function(template) {
|
templateNode.prototype.setTemplate = function (template) {
|
||||||
browser.clickWithWait('#node-input-template-editor');
|
browser.clickWithWait('#node-input-template-editor');
|
||||||
browser.keys(keyPage.selectAll());
|
browser.keys(keyPage.selectAll());
|
||||||
// Need to add a character one by one since some words such as 'Control' are treated as a special word.
|
browser.keys(['Delete']);
|
||||||
for (var i = 0; i < template.length; i++) {
|
browser.keys(template);
|
||||||
browser.keys([template.charAt(i)]);
|
|
||||||
}
|
|
||||||
browser.keys(keyPage.selectToEnd());
|
browser.keys(keyPage.selectToEnd());
|
||||||
browser.keys(['Delete']);
|
browser.keys(['Delete']);
|
||||||
// Need to wait until ace editor correctly checks the syntax.
|
// Need to wait until ace editor correctly checks the syntax.
|
||||||
|
@ -23,14 +23,14 @@ function setServer(broker, port) {
|
|||||||
function clickOk() {
|
function clickOk() {
|
||||||
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', 4000, true);
|
browser.waitForVisible('#node-config-dialog-ok', 10000, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit() {
|
function edit() {
|
||||||
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', 4000);
|
browser.waitForVisible('#node-config-dialog-ok', 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -22,13 +22,13 @@ Node.prototype.edit = function() {
|
|||||||
browser.clickWithWait(this.id);
|
browser.clickWithWait(this.id);
|
||||||
browser.clickWithWait(this.id);
|
browser.clickWithWait(this.id);
|
||||||
// Wait until an edit dialog opens.
|
// Wait until an edit dialog opens.
|
||||||
browser.waitForVisible('#node-dialog-ok', 4000);
|
browser.waitForVisible('#node-dialog-ok', 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node.prototype.clickOk = function() {
|
Node.prototype.clickOk = function() {
|
||||||
browser.clickWithWait('#node-dialog-ok');
|
browser.clickWithWait('#node-dialog-ok');
|
||||||
// Wait untile an edit dialog closes.
|
// Wait untile an edit dialog closes.
|
||||||
browser.waitForVisible('#node-dialog-ok', 4000, true);
|
browser.waitForVisible('#node-dialog-ok', 10000, true);
|
||||||
browser.pause(50);
|
browser.pause(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
exports.config = {
|
exports.config = {
|
||||||
|
|
||||||
//
|
//
|
||||||
// ==================
|
// ==================
|
||||||
// Specify Test Files
|
// Specify Test Files
|
||||||
@ -150,12 +150,12 @@ exports.config = {
|
|||||||
// The only one supported by default is 'dot'
|
// The only one supported by default is 'dot'
|
||||||
// see also: http://webdriver.io/guide/reporters/dot.html
|
// see also: http://webdriver.io/guide/reporters/dot.html
|
||||||
reporters: ['spec'],
|
reporters: ['spec'],
|
||||||
|
|
||||||
//
|
//
|
||||||
// Options to be passed to Mocha.
|
// Options to be passed to Mocha.
|
||||||
// See the full list at http://mochajs.org/
|
// See the full list at http://mochajs.org/
|
||||||
mochaOpts: {
|
mochaOpts: {
|
||||||
timeout: 60000,
|
timeout: 100000,
|
||||||
ui: 'bdd'
|
ui: 'bdd'
|
||||||
},
|
},
|
||||||
//
|
//
|
||||||
@ -197,7 +197,7 @@ exports.config = {
|
|||||||
*/
|
*/
|
||||||
// beforeCommand: function (commandName, args) {
|
// beforeCommand: function (commandName, args) {
|
||||||
// },
|
// },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook that gets executed before the suite starts
|
* Hook that gets executed before the suite starts
|
||||||
* @param {Object} suite suite details
|
* @param {Object} suite suite details
|
||||||
@ -217,13 +217,13 @@ exports.config = {
|
|||||||
// beforeHook: function () {
|
// beforeHook: function () {
|
||||||
// },
|
// },
|
||||||
/**
|
/**
|
||||||
* Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
|
* Hook that gets executed _after_ a hook within the suite ends (e.g. runs after calling
|
||||||
* afterEach in Mocha)
|
* afterEach in Mocha)
|
||||||
*/
|
*/
|
||||||
// afterHook: function () {
|
// afterHook: function () {
|
||||||
// },
|
// },
|
||||||
/**
|
/**
|
||||||
* Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
* Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) ends.
|
||||||
* @param {Object} test test details
|
* @param {Object} test test details
|
||||||
*/
|
*/
|
||||||
// afterTest: function (test) {
|
// afterTest: function (test) {
|
||||||
@ -234,7 +234,7 @@ exports.config = {
|
|||||||
*/
|
*/
|
||||||
// afterSuite: function (suite) {
|
// afterSuite: function (suite) {
|
||||||
// },
|
// },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs after a WebdriverIO command gets executed
|
* Runs after a WebdriverIO command gets executed
|
||||||
* @param {String} commandName hook command name
|
* @param {String} commandName hook command name
|
||||||
|
Loading…
Reference in New Issue
Block a user