From 293ba96bc05810ce0e2b81906d39a70c4dd50a7f Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 12 Jan 2021 17:36:07 +0100 Subject: [PATCH 01/15] Create Kember.js --- tests/e2e/portal/Kember.js | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/e2e/portal/Kember.js diff --git a/tests/e2e/portal/Kember.js b/tests/e2e/portal/Kember.js new file mode 100644 index 00000000000..1a813fb9644 --- /dev/null +++ b/tests/e2e/portal/Kember.js @@ -0,0 +1,49 @@ +// node kember.js [url_prefix] [template_uuid] [--demo] + +const tutorialBase = require('../tutorials/tutorialBase'); +const utils = require('../utils/utils'); + +const args = process.argv.slice(2); +const { + urlPrefix, + templateUuid, + enableDemoMode +} = utils.parseCommandLineArgumentsTemplate(args); + +const anonURL = urlPrefix + templateUuid; +const screenshotPrefix = "Kember"; + + +async function runTutorial () { + const tutorial = new tutorialBase.TutorialBase(anonURL, screenshotPrefix, null, null, null, enableDemoMode); + + tutorial.startScreenshooter(); + const page = await tutorial.beforeScript(); + const studyData = await tutorial.openStudyLink(); + const studyId = studyData["data"]["uuid"]; + console.log("Study ID:", studyId); + + // Some time for loading the workbench + await tutorial.waitFor(10000); + await utils.takeScreenshot(page, screenshotPrefix + 'workbench_loaded'); + + await tutorial.runPipeline(studyId, 30000); + await utils.takeScreenshot(page, screenshotPrefix + 'pipeline_run'); + + await tutorial.openNodeFiles(0); + const outFiles = [ + "logs.zip", + "outputController.dat" + ]; + await tutorial.checkResults(outFiles.length); + + await tutorial.logOut(); + tutorial.stopScreenshooter(); + await tutorial.close(); +} + +runTutorial() + .catch(error => { + console.log('Puppeteer error: ' + error); + process.exit(1); + }); From a86ee631da93bf01b7d0a8623c9c4aef2052de19 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Tue, 12 Jan 2021 17:50:42 +0100 Subject: [PATCH 02/15] Create isolve.js --- tests/e2e/tutorials/isolve.js | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tests/e2e/tutorials/isolve.js diff --git a/tests/e2e/tutorials/isolve.js b/tests/e2e/tutorials/isolve.js new file mode 100644 index 00000000000..092c36f9770 --- /dev/null +++ b/tests/e2e/tutorials/isolve.js @@ -0,0 +1,57 @@ +// node isolve.js [url] [user] [password] [--demo] + +const utils = require('../utils/utils'); +const tutorialBase = require('./tutorialBase'); + +const args = process.argv.slice(2); +const { + url, + user, + pass, + newUser, + enableDemoMode +} = utils.parseCommandLineArguments(args) + +const templateName = "isolve"; + +async function runTutorial() { + const tutorial = new tutorialBase.TutorialBase(url, templateName, user, pass, newUser, enableDemoMode); + + try { + tutorial.startScreenshooter(); + await tutorial.start(); + const studyData = await tutorial.openService(1000); + const studyId = studyData["data"]["uuid"]; + console.log("Study ID:", studyId); + + const workbenchData = utils.extractWorkbenchData(studyData["data"]); + console.log(workbenchData); + await tutorial.waitForServices(workbenchData["studyId"], [workbenchData["nodeIds"][0]], 20000); + + // Wait for some time + await tutorial.waitFor(12000); + + await tutorial.toDashboard(); + + await tutorial.removeStudy(studyId); + } + catch(err) { + tutorial.setTutorialFailed(true); + console.log('Tutorial error: ' + err); + } + finally { + await tutorial.logOut(); + tutorial.stopScreenshooter(); + await tutorial.close(); + } + + if (tutorial.getTutorialFailed()) { + throw "Tutorial Failed"; + } +} + +runTutorial() + .catch(error => { + console.log('Puppeteer error: ' + error); + process.exit(1); + }); From bddf4f3588c12ed4201f13006bf025854aaa5a08 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 13 Jan 2021 10:12:49 +0100 Subject: [PATCH 03/15] Update isolve.js --- tests/e2e/tutorials/isolve.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/e2e/tutorials/isolve.js b/tests/e2e/tutorials/isolve.js index 092c36f9770..6a5d63072b9 100644 --- a/tests/e2e/tutorials/isolve.js +++ b/tests/e2e/tutorials/isolve.js @@ -1,5 +1,7 @@ // node isolve.js [url] [user] [password] [--demo] +// https://itisfoundation.github.io/osparc-manual-z43/#/Tutorials/GeneralTutorial + const utils = require('../utils/utils'); const tutorialBase = require('./tutorialBase'); From 756e85084d7c2778ca7da435cb7a65ce9f4ce2b0 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 17 Jan 2021 17:14:57 +0100 Subject: [PATCH 04/15] Update Kember.js --- tests/e2e/portal/Kember.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/portal/Kember.js b/tests/e2e/portal/Kember.js index 1a813fb9644..a316278caed 100644 --- a/tests/e2e/portal/Kember.js +++ b/tests/e2e/portal/Kember.js @@ -27,7 +27,7 @@ async function runTutorial () { await tutorial.waitFor(10000); await utils.takeScreenshot(page, screenshotPrefix + 'workbench_loaded'); - await tutorial.runPipeline(studyId, 30000); + await tutorial.runPipeline(studyId, 60000); await utils.takeScreenshot(page, screenshotPrefix + 'pipeline_run'); await tutorial.openNodeFiles(0); From 0503e79b0a5e57e58e929c8a61b16c7c39751233 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 17 Jan 2021 17:15:14 +0100 Subject: [PATCH 05/15] Update isolve.js --- tests/e2e/tutorials/isolve.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/e2e/tutorials/isolve.js b/tests/e2e/tutorials/isolve.js index 6a5d63072b9..83a00f18f10 100644 --- a/tests/e2e/tutorials/isolve.js +++ b/tests/e2e/tutorials/isolve.js @@ -14,7 +14,7 @@ const { enableDemoMode } = utils.parseCommandLineArguments(args) -const templateName = "isolve"; +const templateName = "isolve-gpu"; async function runTutorial() { const tutorial = new tutorialBase.TutorialBase(url, templateName, user, pass, newUser, enableDemoMode); @@ -26,12 +26,17 @@ async function runTutorial() { const studyId = studyData["data"]["uuid"]; console.log("Study ID:", studyId); - const workbenchData = utils.extractWorkbenchData(studyData["data"]); - console.log(workbenchData); - await tutorial.waitForServices(workbenchData["studyId"], [workbenchData["nodeIds"][0]], 20000); + // Some time for loading the workbench + await tutorial.waitFor(5000); - // Wait for some time - await tutorial.waitFor(12000); + await tutorial.runPipeline(studyId, 60000); + console.log('Checking isolve results:'); + await tutorial.openNodeFiles(1); + const outFiles = [ + "output.h5", + "log.tgz" + ]; + await tutorial.checkResults(outFiles.length); await tutorial.toDashboard(); From 48f03bb0da0dd436f1e3bd69bcc02b4a178c95c9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Sun, 17 Jan 2021 17:34:25 +0100 Subject: [PATCH 06/15] Update isolve.js --- tests/e2e/tutorials/isolve.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e/tutorials/isolve.js b/tests/e2e/tutorials/isolve.js index 83a00f18f10..aadcf132040 100644 --- a/tests/e2e/tutorials/isolve.js +++ b/tests/e2e/tutorials/isolve.js @@ -29,10 +29,11 @@ async function runTutorial() { // Some time for loading the workbench await tutorial.waitFor(5000); - await tutorial.runPipeline(studyId, 60000); + await tutorial.runPipeline(studyId, 20000); console.log('Checking isolve results:'); await tutorial.openNodeFiles(1); const outFiles = [ + "logs.zip", "output.h5", "log.tgz" ]; From af621ca2d7295b3de7c047fe49a3b14d7b6ad42b Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 18 Jan 2021 15:31:15 +0100 Subject: [PATCH 07/15] minor --- .../client/source/class/osparc/ui/mixin/FetchButton.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/ui/mixin/FetchButton.js b/services/web/client/source/class/osparc/ui/mixin/FetchButton.js index 712e9531197..41df88ed0f6 100644 --- a/services/web/client/source/class/osparc/ui/mixin/FetchButton.js +++ b/services/web/client/source/class/osparc/ui/mixin/FetchButton.js @@ -28,9 +28,14 @@ qx.Mixin.define("osparc.ui.mixin.FetchButton", { if (isFetching !== old) { this.setIcon(this.__icon); } - this.getChildControl("icon").getContentElement().removeClass("rotate"); + if (this.getChildControl("icon")) { + this.getChildControl("icon").getContentElement().removeClass("rotate"); + } + } + // Might have been destroyed already + if (this.getLayoutParent()) { + this.setEnabled(!isFetching); } - this.setEnabled(!isFetching); } } }); From 34cb2fd55ea155c3f9e9004192ad1ae612d8e3fb Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 18 Jan 2021 15:32:29 +0100 Subject: [PATCH 08/15] load workbench by default --- .../class/osparc/desktop/WorkbenchView.js | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/services/web/client/source/class/osparc/desktop/WorkbenchView.js b/services/web/client/source/class/osparc/desktop/WorkbenchView.js index e0d723fb2dd..c59f2f89790 100644 --- a/services/web/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/web/client/source/class/osparc/desktop/WorkbenchView.js @@ -94,26 +94,24 @@ qx.Class.define("osparc.desktop.WorkbenchView", { const study = this.getStudy(); const workbench = study.getWorkbench(); - if (nodeId === study.getUuid()) { - this.__showInMainView(this.__workbenchUI, nodeId); + const node = workbench.getNode(nodeId); + if (node === null || nodeId === study.getUuid()) { + this.__showInMainView(this.__workbenchUI, study.getUuid()); this.__workbenchUI.loadModel(workbench); + } else if (node.isContainer()) { + this.__groupNodeView.setNode(node); + this.__showInMainView(this.__workbenchUI, nodeId); + this.__workbenchUI.loadModel(node); + this.__groupNodeView.populateLayout(); + } else if (node.isFilePicker()) { + const nodeView = new osparc.component.node.FilePickerNodeView(); + nodeView.setNode(node); + this.__showInMainView(nodeView, nodeId); + nodeView.populateLayout(); } else { - const node = workbench.getNode(nodeId); - if (node.isContainer()) { - this.__groupNodeView.setNode(node); - this.__showInMainView(this.__workbenchUI, nodeId); - this.__workbenchUI.loadModel(node); - this.__groupNodeView.populateLayout(); - } else if (node.isFilePicker()) { - const nodeView = new osparc.component.node.FilePickerNodeView(); - nodeView.setNode(node); - this.__showInMainView(nodeView, nodeId); - nodeView.populateLayout(); - } else { - this.__nodeView.setNode(node); - this.__showInMainView(this.__nodeView, nodeId); - this.__nodeView.populateLayout(); - } + this.__nodeView.setNode(node); + this.__showInMainView(this.__nodeView, nodeId); + this.__nodeView.populateLayout(); } }, From 94d497212bfd7f34bf1aeeaee0bfc582bada7063 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 18 Jan 2021 15:37:57 +0100 Subject: [PATCH 09/15] Update SideSearch.js --- .../web/client/source/class/osparc/dashboard/SideSearch.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/dashboard/SideSearch.js b/services/web/client/source/class/osparc/dashboard/SideSearch.js index d0c0cfcd58a..ebfaa8845c7 100644 --- a/services/web/client/source/class/osparc/dashboard/SideSearch.js +++ b/services/web/client/source/class/osparc/dashboard/SideSearch.js @@ -59,8 +59,10 @@ qx.Class.define("osparc.dashboard.SideSearch", { marginLeft: -12, marginTop: -5 }); - osparc.store.Store.getInstance().addListener("changeClassifiers", e => { - classifier.recreateTree(); + osparc.store.Store.getInstance().addListener("changeClassifiers", () => { + if (osparc.auth.Manager.getInstance().isLoggedIn()) { + classifier.recreateTree(); + } }, this); this._add(classifier, { flex: 1 From d4d29eb7d363b8dcf26b84afe8f46f9c504e6106 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 18 Jan 2021 15:55:05 +0100 Subject: [PATCH 10/15] dispose Store after log out --- services/web/client/source/class/osparc/Application.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/web/client/source/class/osparc/Application.js b/services/web/client/source/class/osparc/Application.js index 5113b887429..14b5bec133a 100644 --- a/services/web/client/source/class/osparc/Application.js +++ b/services/web/client/source/class/osparc/Application.js @@ -220,9 +220,6 @@ qx.Class.define("osparc.Application", { if (isLogged) { this.__loadMainPage(); } else { - // Reset store (cache) - osparc.store.Store.getInstance().invalidate(); - osparc.auth.Manager.getInstance().validateToken() .then(data => { if (data.role.toLowerCase() === "guest") { @@ -287,6 +284,7 @@ qx.Class.define("osparc.Application", { if (this.__mainPage) { this.__mainPage.closeEditor(); } + osparc.store.Store.getInstance().dispose(); this.__restart(); }, From c2cf02ceddb4c65db2ebf5e68be003b25f1e5aa3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 18 Jan 2021 16:39:35 +0100 Subject: [PATCH 11/15] TODO added --- tests/e2e/portal/Kember.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/e2e/portal/Kember.js b/tests/e2e/portal/Kember.js index a316278caed..a995f817993 100644 --- a/tests/e2e/portal/Kember.js +++ b/tests/e2e/portal/Kember.js @@ -11,7 +11,7 @@ const { } = utils.parseCommandLineArgumentsTemplate(args); const anonURL = urlPrefix + templateUuid; -const screenshotPrefix = "Kember"; +const screenshotPrefix = "Kember_"; async function runTutorial () { @@ -27,7 +27,7 @@ async function runTutorial () { await tutorial.waitFor(10000); await utils.takeScreenshot(page, screenshotPrefix + 'workbench_loaded'); - await tutorial.runPipeline(studyId, 60000); + await tutorial.runPipeline(studyId, 30000); await utils.takeScreenshot(page, screenshotPrefix + 'pipeline_run'); await tutorial.openNodeFiles(0); @@ -37,6 +37,11 @@ async function runTutorial () { ]; await tutorial.checkResults(outFiles.length); + // TODO when kember viewer gets fixed: + // - get the frame from the second node + // - rerun all cells + // - check output + await tutorial.logOut(); tutorial.stopScreenshooter(); await tutorial.close(); From d425f51f07ab89e2919a7632572d8ffe33ce284a Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 18 Jan 2021 16:53:47 +0100 Subject: [PATCH 12/15] cleanup --- .../web/client/source/class/osparc/dashboard/SideSearch.js | 4 +--- .../web/client/source/class/osparc/dashboard/StudyBrowser.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/services/web/client/source/class/osparc/dashboard/SideSearch.js b/services/web/client/source/class/osparc/dashboard/SideSearch.js index ebfaa8845c7..db178d63824 100644 --- a/services/web/client/source/class/osparc/dashboard/SideSearch.js +++ b/services/web/client/source/class/osparc/dashboard/SideSearch.js @@ -60,9 +60,7 @@ qx.Class.define("osparc.dashboard.SideSearch", { marginTop: -5 }); osparc.store.Store.getInstance().addListener("changeClassifiers", () => { - if (osparc.auth.Manager.getInstance().isLoggedIn()) { - classifier.recreateTree(); - } + classifier.recreateTree(); }, this); this._add(classifier, { flex: 1 diff --git a/services/web/client/source/class/osparc/dashboard/StudyBrowser.js b/services/web/client/source/class/osparc/dashboard/StudyBrowser.js index d8ff75f4ac7..a4716d7c236 100644 --- a/services/web/client/source/class/osparc/dashboard/StudyBrowser.js +++ b/services/web/client/source/class/osparc/dashboard/StudyBrowser.js @@ -284,9 +284,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", { this.resetSelection(); }); osparc.store.Store.getInstance().addListener("changeTags", () => { - if (osparc.auth.Manager.getInstance().isLoggedIn()) { - this.reloadUserStudies(); - } + this.reloadUserStudies(); }, this); }, From ff7899e1ff36cb1022bd6c41c43927d566da931a Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 20 Jan 2021 10:25:39 +0100 Subject: [PATCH 13/15] minor fix --- .../web/client/source/class/osparc/file/FilePicker.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/web/client/source/class/osparc/file/FilePicker.js b/services/web/client/source/class/osparc/file/FilePicker.js index 67e03361f61..8d8fb43941a 100644 --- a/services/web/client/source/class/osparc/file/FilePicker.js +++ b/services/web/client/source/class/osparc/file/FilePicker.js @@ -245,7 +245,10 @@ qx.Class.define("osparc.file.FilePicker", { __isOutputFileSelectedFromStore: function() { const outFile = this.__getOutputFile(); - if (outFile && "value" in outFile && "path" in outFile.value) { + if (outFile && + "value" in outFile && + typeof outFile["value"] === "object" && + "path" in outFile["value"]) { return true; } return false; @@ -253,7 +256,10 @@ qx.Class.define("osparc.file.FilePicker", { __isOutputFileSelectedFromLink: function() { const outFile = this.__getOutputFile(); - if (outFile && "value" in outFile && "downloadLink" in outFile.value) { + if (outFile && + "value" in outFile && + typeof outFile["value"] === "object" && + "downloadLink" in outFile.value) { return true; } return false; From 81ed10fe48438b83c3fb8701089ff2d3ca45d3ed Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 20 Jan 2021 10:56:09 +0100 Subject: [PATCH 14/15] minor improvement --- .../web/client/source/class/osparc/wrapper/WebSocket.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/services/web/client/source/class/osparc/wrapper/WebSocket.js b/services/web/client/source/class/osparc/wrapper/WebSocket.js index 47ab23723a1..15d29077230 100644 --- a/services/web/client/source/class/osparc/wrapper/WebSocket.js +++ b/services/web/client/source/class/osparc/wrapper/WebSocket.js @@ -251,12 +251,7 @@ qx.Class.define("osparc.wrapper.WebSocket", { }, slotExists: function(name) { - for (let i = 0; i < this.__name.length; ++i) { - if (this.__name[i] === name) { - return true; - } - } - return false; + return this.__name && this.__name.includes(name); }, removeSlot: function(name) { From a70739f6337e97e8d7a1ed627090b54a0441d0af Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Wed, 20 Jan 2021 10:57:37 +0100 Subject: [PATCH 15/15] Checking Kember's viewer output --- tests/e2e/portal/Kember.js | 39 ++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/tests/e2e/portal/Kember.js b/tests/e2e/portal/Kember.js index a995f817993..dbdd71bc801 100644 --- a/tests/e2e/portal/Kember.js +++ b/tests/e2e/portal/Kember.js @@ -1,6 +1,7 @@ // node kember.js [url_prefix] [template_uuid] [--demo] const tutorialBase = require('../tutorials/tutorialBase'); +const auto = require('../utils/auto'); const utils = require('../utils/utils'); const args = process.argv.slice(2); @@ -27,7 +28,7 @@ async function runTutorial () { await tutorial.waitFor(10000); await utils.takeScreenshot(page, screenshotPrefix + 'workbench_loaded'); - await tutorial.runPipeline(studyId, 30000); + await tutorial.runPipeline(studyId, 120000); await utils.takeScreenshot(page, screenshotPrefix + 'pipeline_run'); await tutorial.openNodeFiles(0); @@ -37,10 +38,40 @@ async function runTutorial () { ]; await tutorial.checkResults(outFiles.length); - // TODO when kember viewer gets fixed: - // - get the frame from the second node - // - rerun all cells + + // open kember viewer + auto.openNode(page, 1); + + await tutorial.waitFor(2000); + await utils.takeScreenshot(page, screenshotPrefix + 'iFrame0'); + const iframeHandles = await page.$$("iframe"); + // expected two iframes = loading + raw-graph + const frame = await iframeHandles[1].contentFrame(); + + // - restart kernel: click restart and accept + const restartSelector = "#run_int > button:nth-child(3)"; + await frame.waitForSelector(restartSelector); + await frame.click(restartSelector); + await tutorial.waitFor(2000); + await utils.takeScreenshot(page, screenshotPrefix + 'restart_pressed'); + const acceptSelector = "body > div.modal.fade.in > div > div > div.modal-footer > button.btn.btn-default.btn-sm.btn-danger"; + await frame.waitForSelector(acceptSelector); + await frame.click(acceptSelector); + await tutorial.waitFor(2000); + await utils.takeScreenshot(page, screenshotPrefix + 'restart_accept'); + + await tutorial.waitFor(8000); + await utils.takeScreenshot(page, screenshotPrefix + 'notebook_run'); + // - check output + await tutorial.openNodeFiles(0); + const outFiles2 = [ + "Hear_Rate.csv", + "notebooks.zip", + "Parasympathetic_Cell_Activity.csv", + "Table_Data.csv" + ]; + await tutorial.checkResults(outFiles2.length); await tutorial.logOut(); tutorial.stopScreenshooter();