1
0
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:
Kazuhito Yokoi 2020-01-14 16:37:43 +09:00
parent 63978e226b
commit faf46e4447
6 changed files with 27 additions and 30 deletions

View File

@ -29,9 +29,8 @@ 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']);

View File

@ -50,7 +50,7 @@ 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]');
@ -73,12 +73,12 @@ changeNode.prototype.ruleSet = function(p, pt, to, tot, index) {
} }
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);

View File

@ -37,10 +37,8 @@ templateNode.prototype.setFormat = function(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.

View File

@ -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 = {

View File

@ -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);
} }

View File

@ -155,7 +155,7 @@ exports.config = {
// 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'
}, },
// //
@ -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) {