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 14 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,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
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
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);
}
}
});
54 changes: 54 additions & 0 deletions tests/e2e/portal/Kember.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// 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);

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

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