Skip to content

Commit 2740bad

Browse files
authored
Feature/fb 09 05 (ITISFoundation#3317)
1 parent d0cdd84 commit 2740bad

File tree

10 files changed

+73
-22
lines changed

10 files changed

+73
-22
lines changed

services/web/client/source/class/osparc/auth/ui/LoginSMSCodeView.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ qx.Class.define("osparc.auth.ui.LoginSMSCodeView", {
8383
flex: 1
8484
});
8585
resendCodeBtn.addListener("execute", () => {
86-
osparc.auth.ui.VerifyPhoneNumberView.restartResendTimer(this.__resendCodeBtn, this.tr("Resend code"));
86+
const msg = this.tr("Not yet implemented. Please, reload the page instead");
87+
osparc.component.message.FlashMessenger.getInstance().logAs(msg, "WARNING");
88+
// osparc.auth.ui.VerifyPhoneNumberView.restartResendTimer(this.__resendCodeBtn, this.tr("Resend code"));
8789
}, this);
8890
this.add(resendLayout);
8991
},

services/web/client/source/class/osparc/component/widget/PreparingInputs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ qx.Class.define("osparc.component.widget.PreparingInputs", {
2121
construct: function(monitoredNodes = []) {
2222
this.base(arguments);
2323

24+
osparc.utils.Utils.setIdToWidget(this, "AppMode_PreparingInputsView");
25+
2426
this._setLayout(new qx.ui.layout.VBox(10));
2527

2628
const text = this.tr("In order to move to this step, we need to prepare some inputs for you.<br>This might take a while, so enjoy checking the logs down here:");

services/web/client/source/class/osparc/dashboard/ResourceBrowserBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
212212
if (dontShow === "true") {
213213
return;
214214
}
215-
if (templates === false && resources.length === 0 && this._resourcesContainer.nextRequest === null) {
215+
if (templates === false && "_meta" in resp && resp["_meta"]["total"] === 0) {
216216
// there are no studies
217217
const tutorialWindow = new osparc.component.tutorial.ti.Slides();
218218
tutorialWindow.center();

services/web/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
369369
__newStudyBtnClicked: function() {
370370
this.__newStudyBtn.setValue(false);
371371
const minStudyData = osparc.data.model.Study.createMyNewStudyObject();
372-
let title = minStudyData.name;
373-
const existingTitles = this.__studies.map(study => study.name);
374-
if (existingTitles.includes(title)) {
375-
let cont = 1;
376-
while (existingTitles.includes(`${title} (${cont})`)) {
377-
cont++;
378-
}
379-
title += ` (${cont})`;
380-
}
372+
const title = osparc.utils.Utils.getUniqueStudyName(minStudyData.name, this.__studies);
381373
minStudyData["name"] = title;
382374
minStudyData["description"] = "";
383375
this.__createStudy(minStudyData, null);
384376
},
385377

386378
__newPlanBtnClicked: function(templateData) {
379+
const title = osparc.utils.Utils.getUniqueStudyName(templateData.name, this.__studies);
380+
templateData.name = title;
387381
this._showLoadingPage(this.tr("Creating ") + (templateData.name || this.tr("Study")));
388382
osparc.utils.Study.createStudyFromTemplate(templateData)
389383
.then(studyId => {

services/web/client/source/class/osparc/navigation/BreadcrumbsSlideshow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ qx.Class.define("osparc.navigation.BreadcrumbsSlideshow", {
7575
const node = study.getWorkbench().getNode(nodeId);
7676
if (node && nodeId in slideshow) {
7777
const pos = slideshow[nodeId].position;
78+
osparc.utils.Utils.setIdToWidget(btn, "AppMode_StepBtn_"+(pos+1));
7879
node.bind("label", btn, "label", {
7980
converter: val => `${pos+1}: ${val}`
8081
});

services/web/client/source/class/osparc/navigation/PrevNextButtons.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,15 @@ qx.Class.define("osparc.navigation.PrevNextButtons", {
8080
icon: this.self().PREV_BUTTON,
8181
...this.self().BUTTON_OPTIONS
8282
});
83+
osparc.utils.Utils.setIdToWidget(prvsBtn, "AppMode_PreviousBtn");
8384
prvsBtn.addListener("execute", () => this.__prevPressed(), this);
8485

8586
const nextBtn = this.__nextBtn = new qx.ui.form.Button().set({
8687
toolTipText: qx.locale.Manager.tr("Next"),
8788
icon: this.self().NEXT_BUTTON,
8889
...this.self().BUTTON_OPTIONS
8990
});
91+
osparc.utils.Utils.setIdToWidget(nextBtn, "AppMode_NextBtn");
9092
nextBtn.addListener("execute", () => this.__nextPressed(), this);
9193

9294
const runBtn = this.__runBtn = new qx.ui.form.Button().set({

services/web/client/source/class/osparc/utils/Utils.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ qx.Class.define("osparc.utils.Utils", {
7777
}
7878
},
7979

80+
getUniqueStudyName: function(preferredName, list) {
81+
let title = preferredName;
82+
const existingTitles = list.map(study => study.name);
83+
if (existingTitles.includes(title)) {
84+
let cont = 1;
85+
while (existingTitles.includes(`${title} (${cont})`)) {
86+
cont++;
87+
}
88+
title += ` (${cont})`;
89+
}
90+
return title;
91+
},
92+
8093
checkIsOnScreen: function(elem) {
8194
const isInViewport = element => {
8295
if (element) {

tests/e2e/tutorials/jupyterlabs.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,8 @@ async function runTutorial() {
3838
await tutorial.openNode(j);
3939
await tutorial.waitFor(35000);
4040

41-
4241
// Run the jlab nbook
43-
const iframeHandles = await tutorial.getIframe();
44-
let iframes2 = [];
45-
for (let i = 0; i < iframeHandles.length; i++) {
46-
const frame = await iframeHandles[i].contentFrame();
47-
iframes2.push(frame);
48-
}
49-
const jLabIframe = iframes2.find(iframe => iframe._url.includes(workbenchData["nodeIds"][j]));
42+
const jLabIframe = await tutorial.getIframe(workbenchData["nodeIds"][j]);
5043

5144
await tutorial.takeScreenshot("before_nb_selection");
5245
const input2outputFileSelector = '[title~="jl_notebook.ipynb"]';

tests/e2e/tutorials/ti-plan.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,36 @@ async function runTutorial() {
4040
// wait for the three services
4141
const workbenchData = utils.extractWorkbenchData(studyData["data"]);
4242
console.log(workbenchData);
43-
// skipping the second one wchich is the optimizer
43+
44+
// wait for the three services, except the optimizer
4445
await tutorial.waitForServices(
4546
workbenchData["studyId"],
4647
[workbenchData["nodeIds"][0], workbenchData["nodeIds"][2], workbenchData["nodeIds"][3]],
4748
startTimeout,
4849
false
4950
);
51+
52+
// Make Electrode Selector selection
53+
const electrodeSelectorIframe = await tutorial.getIframe(workbenchData["nodeIds"][0]);
54+
await utils.waitAndClick(electrodeSelectorIframe, '[osparc-test-id="TargetStructure_Selector"]');
55+
await utils.waitAndClick(electrodeSelectorIframe, '[osparc-test-id="TargetStructure_Target_Hypothalamus"]');
56+
const selection = [
57+
["E1+", "FT9"],
58+
["E1-", "FT7"],
59+
["E2+", "T9"],
60+
["E2-", "T7"],
61+
];
62+
for (let i = 0; i < selection.length; i++) {
63+
const grp = selection[i];
64+
await utils.waitAndClick(electrodeSelectorIframe, `[osparc-test-id="ElectrodeGroup_${grp[0]}_Start"]`);
65+
await utils.waitAndClick(electrodeSelectorIframe, `[osparc-test-id="Electrode_${grp[1]}"]`);
66+
}
67+
await utils.waitAndClick(electrodeSelectorIframe, `[osparc-test-id="FinishSetUp"]`);
68+
69+
// Run optimizer
70+
await tutorial.waitAndClick("AppMode_NextBtn");
71+
await tutorial.waitFor(5000, "Running Optimizer");
72+
await tutorial.waitForStudyDone(studyId, 120000);
5073
}
5174
catch (err) {
5275
tutorial.setTutorialFailed(true);

tests/e2e/tutorials/tutorialBase.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ class TutorialBase {
297297
}
298298

299299
async waitForServices(studyId, nodeIds, timeout = 40000, waitForConnected = true) {
300+
console.log("waitForServices timeout:", timeout);
300301
if (nodeIds.length < 1) {
301302
return;
302303
}
@@ -389,10 +390,26 @@ class TutorialBase {
389390
await this.takeScreenshot('openNode_' + nodePosInTree);
390391
}
391392

392-
async getIframe() {
393+
async __getIframeHandles() {
393394
return await this.__page.$$("iframe");
394395
}
395396

397+
async __getIframes() {
398+
const iframeHandles = await this.__getIframeHandles();
399+
const iframes = [];
400+
for (let i = 0; i < iframeHandles.length; i++) {
401+
const frame = await iframeHandles[i].contentFrame();
402+
iframes.push(frame);
403+
}
404+
return iframes;
405+
}
406+
407+
async getIframe(nodeId) {
408+
const iframes = await this.__getIframes();
409+
const nodeIframe = iframes.find(iframe => iframe._url.includes(nodeId));
410+
return nodeIframe;
411+
}
412+
396413
async openNodeFiles(nodePosInTree = 0) {
397414
const nodeId = await auto.openNode(this.__page, nodePosInTree);
398415
this.__responsesQueue.addResponseListener("storage/locations/0/files/metadata?uuid_filter=" + nodeId);
@@ -406,8 +423,12 @@ class TutorialBase {
406423
}
407424
}
408425

426+
async waitAndClick(osparcTestId) {
427+
await utils.waitAndClick(this.__page, `[osparc-test-id=${osparcTestId}]`);
428+
}
429+
409430
async closeNodeFiles() {
410-
await utils.waitAndClick(this.__page, '[osparc-test-id="nodeDataManagerCloseBtn"]');
431+
await this.waitAndClick("nodeDataManagerCloseBtn");
411432
}
412433

413434
async checkNodeOutputs(nodePos, fileNames, checkNFiles = true, checkFileNames = true) {

0 commit comments

Comments
 (0)