Skip to content

More e2e tests #2083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions services/web/client/source/class/osparc/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -287,6 +284,7 @@ qx.Class.define("osparc.Application", {
if (this.__mainPage) {
this.__mainPage.closeEditor();
}
osparc.store.Store.getInstance().dispose();
this.__restart();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ qx.Class.define("osparc.dashboard.SideSearch", {
marginLeft: -12,
marginTop: -5
});
osparc.store.Store.getInstance().addListener("changeClassifiers", e => {
osparc.store.Store.getInstance().addListener("changeClassifiers", () => {
classifier.recreateTree();
}, this);
this._add(classifier, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

Expand Down
34 changes: 16 additions & 18 deletions services/web/client/source/class/osparc/desktop/WorkbenchView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
},

Expand Down
10 changes: 8 additions & 2 deletions services/web/client/source/class/osparc/file/FilePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,21 @@ 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;
},

__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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
});
7 changes: 1 addition & 6 deletions services/web/client/source/class/osparc/wrapper/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
85 changes: 85 additions & 0 deletions tests/e2e/portal/Kember.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// 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);
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, 120000);
await utils.takeScreenshot(page, screenshotPrefix + 'pipeline_run');

await tutorial.openNodeFiles(0);
const outFiles = [
"logs.zip",
"outputController.dat"
];
await tutorial.checkResults(outFiles.length);


// 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();
await tutorial.close();
}

runTutorial()
.catch(error => {
console.log('Puppeteer error: ' + error);
process.exit(1);
});
65 changes: 65 additions & 0 deletions tests/e2e/tutorials/isolve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// 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');

const args = process.argv.slice(2);
const {
url,
user,
pass,
newUser,
enableDemoMode
} = utils.parseCommandLineArguments(args)

const templateName = "isolve-gpu";

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

// Some time for loading the workbench
await tutorial.waitFor(5000);

await tutorial.runPipeline(studyId, 20000);
console.log('Checking isolve results:');
await tutorial.openNodeFiles(1);
const outFiles = [
"logs.zip",
"output.h5",
"log.tgz"
];
await tutorial.checkResults(outFiles.length);

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