Skip to content

Commit 1bb904b

Browse files
committed
update tests
1 parent 6ed9027 commit 1bb904b

File tree

8 files changed

+85
-26
lines changed

8 files changed

+85
-26
lines changed

services/static-webserver/client/source/class/osparc/dashboard/NewPlusMenu.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
250250
// disable it until found in services store
251251
menuButton.setEnabled(false);
252252

253+
// OM: direct access to service metadata
254+
253255
const key = newStudyData.expectedKey;
254256
// Include deprecated versions, they should all be updatable to a non deprecated version
255257
const versions = osparc.service.Utils.getVersions(key, false);

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -956,31 +956,31 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
956956
firstUpperCase: true
957957
})
958958
const desc = this.tr("Start with an empty study");
959-
const newStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title, desc) : new osparc.dashboard.ListButtonNew(title, desc);
960-
newStudyBtn.setCardKey("new-study");
961-
newStudyBtn.subscribeToFilterGroup("searchBarFilter");
962-
osparc.utils.Utils.setIdToWidget(newStudyBtn, "newStudyBtn");
963-
newStudyBtn.addListener("tap", () => this.__newStudyBtnClicked(newStudyBtn));
964-
this._resourcesContainer.addNonResourceCard(newStudyBtn);
959+
const newEmptyStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title, desc) : new osparc.dashboard.ListButtonNew(title, desc);
960+
newEmptyStudyBtn.setCardKey("new-study");
961+
newEmptyStudyBtn.subscribeToFilterGroup("searchBarFilter");
962+
osparc.utils.Utils.setIdToWidget(newEmptyStudyBtn, "emptyStudyBtn");
963+
newEmptyStudyBtn.addListener("tap", () => this.__newEmptyStudyBtnClicked());
964+
this._resourcesContainer.addNonResourceCard(newEmptyStudyBtn);
965965
},
966966

967967
__addTIPPlusButton: function() {
968968
const mode = this._resourcesContainer.getMode();
969969
const title = this.tr("New Plan");
970-
const newStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title) : new osparc.dashboard.ListButtonNew(title);
971-
newStudyBtn.setCardKey("new-study");
972-
newStudyBtn.subscribeToFilterGroup("searchBarFilter");
973-
osparc.utils.Utils.setIdToWidget(newStudyBtn, "newStudyBtn");
974-
this._resourcesContainer.addNonResourceCard(newStudyBtn);
975-
newStudyBtn.setEnabled(false);
970+
const newPlansBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title) : new osparc.dashboard.ListButtonNew(title);
971+
newPlansBtn.setCardKey("new-study");
972+
newPlansBtn.subscribeToFilterGroup("searchBarFilter");
973+
osparc.utils.Utils.setIdToWidget(newPlansBtn, "newPlansBtn");
974+
this._resourcesContainer.addNonResourceCard(newPlansBtn);
975+
newPlansBtn.setEnabled(false);
976976

977977
osparc.utils.Utils.fetchJSON("/resource/osparc/new_studies.json")
978978
.then(newStudiesData => {
979979
const product = osparc.product.Utils.getProductName()
980980
if (product in newStudiesData) {
981-
newStudyBtn.setEnabled(true);
981+
newPlansBtn.setEnabled(true);
982982

983-
newStudyBtn.addListener("tap", () => {
983+
newPlansBtn.addListener("tap", () => {
984984
osparc.data.Resources.get("templates")
985985
.then(templates => {
986986
if (templates) {
@@ -1506,7 +1506,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
15061506
}
15071507
},
15081508

1509-
__newStudyBtnClicked: function(button) {
1509+
__newEmptyStudyBtnClicked: function() {
15101510
const minStudyData = osparc.data.model.Study.createMinStudyObject();
15111511
const existingNames = this._resourcesList.map(study => study["name"]);
15121512
const title = osparc.utils.Utils.getUniqueName(minStudyData.name, existingNames);

services/static-webserver/client/source/class/osparc/product/Utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ qx.Class.define("osparc.product.Utils", {
301301
"s4l",
302302
"s4lacad",
303303
"s4llite",
304-
"tis",
305-
"tiplite",
304+
// "tis",
305+
// "tiplite",
306306
].includes(osparc.product.Utils.getProductName());
307307
},
308308
}

services/static-webserver/client/source/resource/osparc/new_studies.json

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,43 +116,77 @@
116116
}]
117117
},
118118
"s4l": {
119+
"categories": [{
120+
"id": "apps",
121+
"title": "Apps"
122+
}, {
123+
"id": "osparc",
124+
"title": "oSPARC"
125+
}],
119126
"resources": [{
127+
"category": "apps",
120128
"resourceType": "service",
121129
"expectedKey": "simcore/services/dynamic/s4l-ui",
122130
"title": "Sim4Life",
123131
"newStudyLabel": "New S4L project",
124132
"idToWidget": "startS4LButton"
125133
}, {
134+
"category": "apps",
126135
"resourceType": "service",
127136
"expectedKey": "simcore/services/dynamic/iseg-web",
128137
"title": "iSEG",
129138
"newStudyLabel": "New iSEG project"
130139
}, {
140+
"category": "apps",
131141
"resourceType": "service",
132142
"expectedKey": "simcore/services/dynamic/s4l-jupyter",
133143
"title": "Jupyter Lab",
134144
"icon": "https://upload.wikimedia.org/wikipedia/commons/3/38/Jupyter_logo.svg",
135145
"newStudyLabel": "New S4L Jupyter Lab"
146+
}, {
147+
"category": "osparc",
148+
"resourceType": "study",
149+
"icon": "@FontAwesome5Solid/file/18",
150+
"title": "Workbench",
151+
"newStudyLabel": "New Study",
152+
"idToWidget": "emptyStudyBtn"
136153
}]
137154
},
138155
"s4lacad": {
156+
"categories": [{
157+
"id": "apps",
158+
"title": "Apps"
159+
}, {
160+
"id": "osparc",
161+
"title": "oSPARC"
162+
}],
139163
"resources": [{
164+
"category": "apps",
140165
"resourceType": "service",
141166
"expectedKey": "simcore/services/dynamic/s4l-ui",
142167
"title": "Sim4Life",
143168
"newStudyLabel": "New S4L project",
144169
"idToWidget": "startS4LButton"
145170
}, {
171+
"category": "apps",
146172
"resourceType": "service",
147173
"expectedKey": "simcore/services/dynamic/iseg-web",
148174
"title": "iSEG",
149175
"newStudyLabel": "New iSEG project"
150176
}, {
177+
"category": "apps",
151178
"resourceType": "service",
152179
"expectedKey": "simcore/services/dynamic/s4l-jupyter",
153180
"icon": "https://upload.wikimedia.org/wikipedia/commons/3/38/Jupyter_logo.svg",
154181
"title": "Jupyter Lab",
155182
"newStudyLabel": "New S4L Jupyter Lab"
183+
}, {
184+
"category": "osparc",
185+
"resourceType": "study",
186+
"icon": "@FontAwesome5Solid/file/18",
187+
"title": "Workbench",
188+
"newStudyLabel": "New Study",
189+
"idToWidget": "emptyStudyBtn"
156190
}]
157191
},
158192
"s4llite": {
@@ -170,7 +204,7 @@
170204
"icon": "@FontAwesome5Solid/file/18",
171205
"title": "Empty Study",
172206
"newStudyLabel": "New Study",
173-
"idToWidget": "newStudyBtn"
207+
"idToWidget": "emptyStudyBtn"
174208
}]
175209
}
176210
}

tests/e2e-frontend/tests/studyBrowser/mainView.spec.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,51 @@ import users from '../users.json';
99

1010
const expectedElements = {
1111
"osparc": {
12+
"newButton": {
13+
"id": "newPlusBtn"
14+
},
1215
"plusButton": {
13-
"id": "newStudyBtn",
16+
"id": "emptyStudyBtn",
1417
},
1518
},
1619
"s4l": {
20+
"newButton": {
21+
"id": "newPlusBtn"
22+
},
1723
"plusButton": {
1824
"id": "startS4LButton",
1925
},
2026
},
2127
"s4lacad": {
28+
"newButton": {
29+
"id": "newPlusBtn"
30+
},
2231
"plusButton": {
2332
"id": "startS4LButton",
2433
},
2534
},
2635
"s4llite": {
36+
"newButton": {
37+
"id": "newPlusBtn"
38+
},
2739
"plusButton": {
2840
"id": "startS4LButton",
2941
},
3042
},
3143
"tis": {
44+
"newButton": {
45+
"id": "newPlansBtn"
46+
},
3247
"plusButton": {
33-
"id": "newStudyBtn",
48+
"id": "newTIPlanButton",
3449
},
3550
},
3651
"tiplite": {
52+
"newButton": {
53+
"id": "newPlansBtn"
54+
},
3755
"plusButton": {
38-
"id": "newStudyBtn",
56+
"id": "newTIPlanButton",
3957
},
4058
},
4159
};
@@ -66,9 +84,14 @@ for (const product in products) {
6684
await browser.close();
6785
});
6886

69-
test(`Plus button`, async () => {
87+
test(`Plus button after New button`, async () => {
7088
expect(expectedElements[product]["plusButton"]).toBeDefined();
7189

90+
if (expectedElements[product]["newPlusButton"]) {
91+
const newPlusButton = page.getByTestId("newPlusBtn");
92+
await newPlusButton.click();
93+
}
94+
7295
const plusButtonId = expectedElements[product]["plusButton"]["id"];
7396
const plusButton = page.getByTestId(plusButtonId);
7497
await expect(plusButton).toBeVisible({

tests/e2e-playwright/tests/tip/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def _(
1717
plan_name_test_id: str,
1818
) -> None:
1919
with log_context(logging.INFO, f"Finding {plan_name_test_id=} in dashboard"):
20-
page.get_by_test_id("studiesTabBtn").click()
21-
page.get_by_test_id("newStudyBtn").click()
20+
page.get_by_test_id("newPlansBtn").click()
2221
page.get_by_test_id(plan_name_test_id).click()
2322

2423
return _

tests/e2e/tests/tags.tes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ describe('tags testing', () => {
4848
await page.goto(url);
4949
await auto.register(page, user, pass);
5050
// Create new study
51-
await waitAndClick(page, '[osparc-test-id="newStudyBtn"]');
51+
await waitAndClick(page, '[osparc-test-id="newPlusBtn"]');
52+
await waitAndClick(page, '[osparc-test-id="emptyStudyBtn"]');
5253
// Wait until project is created and Dashboard button is enabled
5354
await utils.sleep(4000);
5455
await auto.toDashboard(page);

tests/e2e/utils/auto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ async function dashboardNewTIPlan(page) {
113113
console.log("Creating New Plan");
114114

115115
await dashboardStudiesBrowser(page);
116-
await utils.waitAndClick(page, '[osparc-test-id="newStudyBtn"]');
116+
await utils.waitAndClick(page, '[osparc-test-id="newPlansBtn"]');
117117
await utils.waitAndClick(page, '[osparc-test-id="newTIPlanButton"]');
118118
}
119119

0 commit comments

Comments
 (0)