From 8235b7b96d1e8a437afde5b3da5fb53647521363 Mon Sep 17 00:00:00 2001 From: Yuma Matsuura Date: Thu, 11 Oct 2018 18:16:08 +0900 Subject: [PATCH 1/2] Followed runtime-editor split --- package.json | 1 + test/editor/editor_helper.js | 2 +- test/editor/pageobjects/editor/workspace_page.js | 2 +- test/editor/pageobjects/nodes/core/core/58-debug_page.js | 2 +- .../editor/pageobjects/nodes/core/logic/15-change_page.js | 8 ++++---- test/editor/specs/scenario/cookbook_endpoint_uispec.js | 5 +++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index b5d15970d..570173117 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "istanbul": "0.4.5", "minami": "1.2.3", "mocha": "^5.2.0", + "mosca": "^2.8.3", "should": "^8.4.0", "sinon": "1.17.7", "stoppable": "^1.0.6", diff --git a/test/editor/editor_helper.js b/test/editor/editor_helper.js index 281988484..656ebe5c7 100644 --- a/test/editor/editor_helper.js +++ b/test/editor/editor_helper.js @@ -21,7 +21,7 @@ var fs = require('fs-extra'); var path = require('path'); var app = express(); -var RED = require("../../red/red.js"); +var RED = require("../../packages/node_modules/node-red/lib/red.js"); var utilPage = require("./pageobjects/util/util_page"); diff --git a/test/editor/pageobjects/editor/workspace_page.js b/test/editor/pageobjects/editor/workspace_page.js index e62eb686f..7eca9d25a 100644 --- a/test/editor/pageobjects/editor/workspace_page.js +++ b/test/editor/pageobjects/editor/workspace_page.js @@ -16,7 +16,7 @@ var when = require("when"); -var events = require("../../../../red/runtime/events.js"); +var events = require("../../../../packages/node_modules/@node-red/runtime/lib/events.js"); var palette = require("./palette_page"); var nodeFactory = require("../nodes/nodefactory_page"); diff --git a/test/editor/pageobjects/nodes/core/core/58-debug_page.js b/test/editor/pageobjects/nodes/core/core/58-debug_page.js index c8c1d8871..0dc4c298e 100644 --- a/test/editor/pageobjects/nodes/core/core/58-debug_page.js +++ b/test/editor/pageobjects/nodes/core/core/58-debug_page.js @@ -29,7 +29,7 @@ debugNode.prototype.setOutput = function(complete) { browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-container")]/button'); if (complete !== 'true') { // Select the "msg" type. - browser.clickWithWait('/html/body/div[11]/a[1]'); + browser.clickWithWait('//div[@class="red-ui-typedInput-options"][1]/a[1]'); // Input the path in msg. browser.clickWithWait('//*[contains(@class, "red-ui-typedInput-input")]/input'); browser.keys(['Control', 'a', 'Control']); diff --git a/test/editor/pageobjects/nodes/core/logic/15-change_page.js b/test/editor/pageobjects/nodes/core/logic/15-change_page.js index 1336e8069..51589f7b5 100644 --- a/test/editor/pageobjects/nodes/core/logic/15-change_page.js +++ b/test/editor/pageobjects/nodes/core/logic/15-change_page.js @@ -54,8 +54,8 @@ changeNode.prototype.ruleSet = function(p, pt, to, tot, index) { setT("set", index); if (pt) { browser.clickWithWait('//*[@id="node-input-rule-container"]/li[' + index + ']/div/div[1]/div/button[1]'); - var num = 5 * index + 6; - var ptXPath = '/html/body/div[' + num + ']/a[' + ptType[pt] + ']'; + var num = 5 * (index - 1) + 1; + var ptXPath = '//div[@class="red-ui-typedInput-options"][' + num + ']/a[' + ptType[pt] + ']'; browser.clickWithWait(ptXPath); } if (p) { @@ -63,8 +63,8 @@ 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 + 7; - var totXPath = '/html/body/div[' + num + ']/a[' + totType[tot] + ']'; + var num = 5 * (index - 1) + 2; + var totXPath = '//div[@class="red-ui-typedInput-options"][' + num + ']/a[' + totType[tot] + ']'; browser.clickWithWait(totXPath); } if (to) { diff --git a/test/editor/specs/scenario/cookbook_endpoint_uispec.js b/test/editor/specs/scenario/cookbook_endpoint_uispec.js index bb54da557..da672a747 100644 --- a/test/editor/specs/scenario/cookbook_endpoint_uispec.js +++ b/test/editor/specs/scenario/cookbook_endpoint_uispec.js @@ -315,8 +315,9 @@ describe('cookbook', function() { debugTab.open(); debugTab.clearMessage(); injectNode.clickLeftButton(); - var message = debugTab.getMessage(); - message[1].indexOf('application/json').should.not.eql(-1); + var messages = debugTab.getMessage(); + var contents = messages.join([separator = ""]); + contents.indexOf('application/json').should.not.eql(-1); }); it('serve a local file', function () { From f204c77ba3614970313e54ac00bb22f3750ea11e Mon Sep 17 00:00:00 2001 From: Yuma Matsuura Date: Tue, 16 Oct 2018 10:29:58 +0900 Subject: [PATCH 2/2] Modify require paths --- test/editor/editor_helper.js | 2 +- test/editor/pageobjects/editor/workspace_page.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/editor/editor_helper.js b/test/editor/editor_helper.js index 656ebe5c7..2cf103188 100644 --- a/test/editor/editor_helper.js +++ b/test/editor/editor_helper.js @@ -21,7 +21,7 @@ var fs = require('fs-extra'); var path = require('path'); var app = express(); -var RED = require("../../packages/node_modules/node-red/lib/red.js"); +var RED = require("nr-test-utils").require("node-red/lib/red.js"); var utilPage = require("./pageobjects/util/util_page"); diff --git a/test/editor/pageobjects/editor/workspace_page.js b/test/editor/pageobjects/editor/workspace_page.js index 7eca9d25a..e1a57d86d 100644 --- a/test/editor/pageobjects/editor/workspace_page.js +++ b/test/editor/pageobjects/editor/workspace_page.js @@ -16,7 +16,7 @@ var when = require("when"); -var events = require("../../../../packages/node_modules/@node-red/runtime/lib/events.js"); +var events = require("nr-test-utils").require("@node-red/runtime/lib/events.js"); var palette = require("./palette_page"); var nodeFactory = require("../nodes/nodefactory_page");