Skip to content

Commit 4354cda

Browse files
committed
Organizations window
1 parent 7877fa5 commit 4354cda

File tree

6 files changed

+68
-2
lines changed

6 files changed

+68
-2
lines changed

services/static-webserver/client/source/class/osparc/desktop/organizations/OrganizationsList.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
126126
height: 150,
127127
width: 150
128128
});
129+
osparc.utils.Utils.setIdToWidget(orgsUIList, "organizationsList");
129130
orgsUIList.addListener("changeSelection", e => this.__organizationSelected(e.getData()), this);
130131

131132
const orgsModel = this.__orgsModel = new qx.data.Array();
@@ -143,6 +144,7 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
143144
},
144145
configureItem: item => {
145146
item.subscribeToFilterGroup("organizationsList");
147+
osparc.utils.Utils.setIdToWidget(item, "organizationListItem");
146148
const thumbnail = item.getChildControl("thumbnail");
147149
thumbnail.getContentElement()
148150
.setStyles({

services/static-webserver/client/source/class/osparc/desktop/organizations/OrganizationsWindow.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsWindow", {
3131
appearance: "service-window"
3232
});
3333

34+
osparc.utils.Utils.setIdToWidget(this, "organizationsWindow");
35+
const closeBtn = this.getChildControl("close-button");
36+
osparc.utils.Utils.setIdToWidget(closeBtn, "organizationsWindowCloseBtn");
37+
3438
this.__buildLayout();
3539
},
3640

services/static-webserver/client/source/class/osparc/ui/list/ListItem.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ qx.Class.define("osparc.ui.list.ListItem", {
207207
}
208208
const parts = value.split("/");
209209
const id = parts.pop();
210-
osparc.utils.Utils.setIdToWidget(this, "listItem_"+id);
210+
if (osparc.utils.Utils.getIdFromWidget(this) === null) {
211+
osparc.utils.Utils.setIdToWidget(this, "listItem_"+id);
212+
}
211213
},
212214

213215
_applyThumbnail: function(value) {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,13 @@ qx.Class.define("osparc.utils.Utils", {
10261026
}
10271027
},
10281028

1029+
getIdFromWidget: qWidget => {
1030+
if (qWidget.getContentElement) {
1031+
return qWidget.getContentElement().getAttribute("osparc-test-id");
1032+
}
1033+
return null;
1034+
},
1035+
10291036
setMoreToWidget: (qWidget, id) => {
10301037
if (qWidget.getContentElement) {
10311038
qWidget.getContentElement().setAttribute("osparc-test-more", id);

tests/e2e-frontend/tests/userMenu/userMenu.js renamed to tests/e2e-frontend/tests/userMenu/userMenuButtons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ for (const product in products) {
102102
for (const user of productUsers) {
103103
const role = user.role;
104104

105-
test.describe.serial(`Navigation Bar: ${product}`, () => {
105+
test.describe.serial(`User Menu: ${product}`, () => {
106106
let page = null;
107107
let loginPageFixture = null;
108108

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* eslint-disable no-undef */
2+
3+
const { test, expect } = require('@playwright/test');
4+
5+
import { LoginPage } from '../fixtures/loginPage';
6+
7+
import products from '../products.json';
8+
import users from '../users.json';
9+
10+
const product = "s4l";
11+
const productUrl = products[product];
12+
const user = users[product];
13+
14+
test.describe.serial(`Navigation Bar: ${product}`, () => {
15+
let page = null;
16+
let loginPageFixture = null;
17+
18+
test.beforeAll(async ({ browser }) => {
19+
page = await browser.newPage();
20+
21+
loginPageFixture = new LoginPage(page, productUrl);
22+
await loginPageFixture.goto();
23+
24+
await loginPageFixture.login(user.email, user.password);
25+
26+
const response = await page.waitForResponse('**/me');
27+
const meData = await response.json();
28+
expect(meData["data"]["role"]).toBe(user.role);
29+
});
30+
31+
test.afterAll(async ({ browser }) => {
32+
await loginPageFixture.logout();
33+
await page.close();
34+
await browser.close();
35+
});
36+
37+
test(`Organizations window`, async () => {
38+
// open user menu
39+
await page.getByTestId("userMenuBtn").click();
40+
// open Organization
41+
await page.getByTestId("userMenuOrganizationsBtn").click();
42+
43+
// make sure the window opens
44+
const organizationsWindow = page.getByTestId("organizationsWindow");
45+
await expect(organizationsWindow).toBeVisible();
46+
// check there is at least one organization listed
47+
const organizationListItems = page.getByTestId("organizationListItem");
48+
const count = await organizationListItems.count();
49+
expect(count).toBeTruthy();
50+
});
51+
});

0 commit comments

Comments
 (0)