Skip to content
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

🎨 [e2e-frontend] Navigation Bar and User Menu #6603

Merged
merged 29 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cb67df9
add tiplite to products
odeimaiz Oct 25, 2024
ce4c8f6
tune display names
odeimaiz Oct 25, 2024
8f2b185
update invitation required
odeimaiz Oct 25, 2024
3bc516d
more users
odeimaiz Oct 25, 2024
325265f
User Menu test
odeimaiz Oct 25, 2024
d217368
eslint brace-style
odeimaiz Oct 25, 2024
77caf69
check tab buttons
odeimaiz Oct 25, 2024
57c1069
comments
odeimaiz Oct 25, 2024
8616fcd
displayName lite
odeimaiz Oct 25, 2024
1f45b1c
check three more buttons in the NavBar
odeimaiz Oct 25, 2024
8ae38f9
and user menu
odeimaiz Oct 25, 2024
7863809
refactor
odeimaiz Oct 25, 2024
060cacd
renaming
odeimaiz Oct 25, 2024
9d2b81a
User Menu buttons per product
odeimaiz Oct 25, 2024
13d45d1
minor
odeimaiz Oct 25, 2024
7877fa5
serviceBrowserListItem -> listItem
odeimaiz Oct 25, 2024
4354cda
Organizations window
odeimaiz Oct 25, 2024
098b498
minor
odeimaiz Oct 25, 2024
f5854a1
minor
odeimaiz Oct 25, 2024
8bd0834
close window
odeimaiz Oct 25, 2024
f49c29c
Merge branch 'master' into e2e-frontend/user-menu
odeimaiz Oct 25, 2024
e18f5f6
Merge branch 'master' into e2e-frontend/user-menu
odeimaiz Oct 25, 2024
6f3c8a8
Merge branch 'master' into e2e-frontend/user-menu
odeimaiz Oct 28, 2024
830eca1
renaming
odeimaiz Oct 28, 2024
ec6153f
Merge branch 'e2e-frontend/user-menu' of github.com:odeimaiz/osparc-s…
odeimaiz Oct 28, 2024
7f7a435
Merge branch 'master' into e2e-frontend/user-menu
odeimaiz Oct 28, 2024
d8003d8
fix
odeimaiz Oct 28, 2024
ebe8ee9
Merge branch 'e2e-frontend/user-menu' of github.com:odeimaiz/osparc-s…
odeimaiz Oct 28, 2024
c79d116
Merge branch 'master' into e2e-frontend/user-menu
odeimaiz Oct 28, 2024
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
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"block-scoped-var": "warn",
"brace-style": [
"warn",
"stroustrup"
"1tbs"
],
"indent": [
"warn",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
this.__listenToNoMoreCreditsEvents();
this.__listenToEvent();
this.__listenToServiceStatus();
this.__listenToStateInputPorts();
this.__listenToStatePorts();
},

__listenToLogger: function() {
Expand Down Expand Up @@ -436,7 +436,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
}
},

__listenToStateInputPorts: function() {
__listenToStatePorts: function() {
const socket = osparc.wrapper.WebSocket.getInstance();
if (!socket.slotExists("stateInputPorts")) {
socket.on("stateInputPorts", data => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
height: 150,
width: 150
});
osparc.utils.Utils.setIdToWidget(orgsUIList, "organizationsList");
orgsUIList.addListener("changeSelection", e => this.__organizationSelected(e.getData()), this);

const orgsModel = this.__orgsModel = new qx.data.Array();
Expand All @@ -143,6 +144,7 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
},
configureItem: item => {
item.subscribeToFilterGroup("organizationsList");
osparc.utils.Utils.setIdToWidget(item, "organizationListItem");
const thumbnail = item.getChildControl("thumbnail");
thumbnail.getContentElement()
.setStyles({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsWindow", {
appearance: "service-window"
});

osparc.utils.Utils.setIdToWidget(this, "organizationsWindow");
const closeBtn = this.getChildControl("close-button");
osparc.utils.Utils.setIdToWidget(closeBtn, "organizationsWindowCloseBtn");

this.__buildLayout();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ qx.Class.define("osparc.navigation.UserMenu", {
break;
case "theme-switcher":
control = new osparc.ui.switch.ThemeSwitcherMenuBtn();
osparc.utils.Utils.setIdToWidget(control, "userMenuThemeSwitcherBtn");
this.add(control);
break;
case "log-in":
Expand All @@ -46,6 +47,7 @@ qx.Class.define("osparc.navigation.UserMenu", {
break;
case "user-center":
control = new qx.ui.menu.Button(this.tr("My Account"));
osparc.utils.Utils.setIdToWidget(control, "userMenuMyAccountBtn");
control.addListener("execute", () => osparc.desktop.account.MyAccountWindow.openWindow(), this);
this.add(control);
break;
Expand Down Expand Up @@ -80,6 +82,7 @@ qx.Class.define("osparc.navigation.UserMenu", {
control = new qx.ui.menu.Button(this.tr("Organizations")).set({
visibility: osparc.data.Permissions.getInstance().canDo("user.organizations.create") ? "visible" :"excluded"
});
osparc.utils.Utils.setIdToWidget(control, "userMenuOrganizationsBtn");
control.addListener("execute", () => osparc.desktop.organizations.OrganizationsWindow.openWindow(), this);
this.add(control);
break;
Expand All @@ -97,12 +100,13 @@ qx.Class.define("osparc.navigation.UserMenu", {
break;
case "about":
control = new qx.ui.menu.Button(this.tr("About oSPARC"));
control.addListener("execute", () => osparc.About.getInstance().open());
osparc.utils.Utils.setIdToWidget(control, "userMenuAboutBtn");
control.addListener("execute", () => osparc.About.getInstance().open());
this.add(control);
break;
case "about-product": {
control = new qx.ui.menu.Button(this.tr("About Product"));
osparc.utils.Utils.setIdToWidget(control, "userMenuAboutProductBtn");
const displayName = osparc.store.StaticInfo.getInstance().getDisplayName();
control.getChildControl("label").setRich(true);
control.setLabel(this.tr("About ") + displayName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ qx.Class.define("osparc.ui.list.ListItem", {
}
const parts = value.split("/");
const id = parts.pop();
osparc.utils.Utils.setIdToWidget(this, "serviceBrowserListItem_"+id);
if (osparc.utils.Utils.getIdFromWidget(this) === null) {
osparc.utils.Utils.setIdToWidget(this, "listItem_"+id);
}
},

_applyThumbnail: function(value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,13 @@ qx.Class.define("osparc.utils.Utils", {
}
},

getIdFromWidget: qWidget => {
if (qWidget.getContentElement) {
return qWidget.getContentElement().getAttribute("osparc-test-id");
}
return null;
},

setMoreToWidget: (qWidget, id) => {
if (qWidget.getContentElement) {
qWidget.getContentElement().setAttribute("osparc-test-more", id);
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ run-tests-headed: install-dev ## run tests headed (you can see what's going on)
npx playwright test --headed

.PHONY: run-tests-ui
run-tests-ui: install-dev ## run tests headed with an assistance GUI
run-tests-ui: install-dev ## starts a GUI where tests can be launched
npx playwright test --ui
6 changes: 5 additions & 1 deletion tests/e2e-frontend/tests/init/statics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ const expectedStatics = {
"isPaymentEnabled": true
},
"s4llite": {
"displayName": "<i>S4L<sup>lite</sup></i>",
"displayName": "Sim4Life.lite",
"isPaymentEnabled": false
},
"tis": {
"displayName": "TI Planning Tool",
"isPaymentEnabled": true
},
"tiplite": {
"displayName": "TI Planning Tool lite",
"isPaymentEnabled": true
},
};

for (const product in products) {
Expand Down
47 changes: 29 additions & 18 deletions tests/e2e-frontend/tests/login/invitationRequired.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,38 @@ const { test, expect } = require('@playwright/test');

import products from '../products.json';

const expectedCreateAccountLabel = {
"osparc": "Create Account",
"s4l": "Request Account",
"s4lacad": "Request Account",
"s4llite": "Request Account",
"tis": "Request Account"
};

const expectedActionOnCreateAccount = {
"osparc": "registrationSubmitBtn",
"s4l": "registrationSubmitBtn",
"s4lacad": "registrationSubmitBtn",
"s4llite": "createAccountWindow",
"tis": "createAccountWindow"
const expectedLogin = {
"osparc": {
"label": "Request Account",
"afterClicking": "registrationSubmitBtn",
},
"s4l": {
"label": "Request Account",
"afterClicking": "registrationSubmitBtn",
},
"s4lacad": {
"label": "Request Account",
"afterClicking": "registrationSubmitBtn",
},
"s4llite": {
"label": "Request Account",
"afterClicking": "createAccountWindow",
},
"tis": {
"label": "Request Account",
"afterClicking": "registrationSubmitBtn",
},
"tiplite": {
"label": "Request Account",
"afterClicking": "registrationSubmitBtn",
},
};

for (const product in products) {
test(`Invitation required text in ${product}`, async ({ page }) => {
expect(expectedCreateAccountLabel[product]).toBeDefined();
expect(expectedLogin[product]["label"]).toBeDefined();

const expectedLabel = expectedCreateAccountLabel[product];
const expectedLabel = expectedLogin[product]["label"];
await page.goto(products[product]);

const button = page.getByTestId("loginCreateAccountBtn");
Expand All @@ -33,14 +44,14 @@ for (const product in products) {
});

test(`Callback action on Create Account ${product}`, async ({ page }) => {
expect(expectedActionOnCreateAccount[product]).toBeDefined();
expect(expectedLogin[product]["afterClicking"]).toBeDefined();

await page.goto(products[product]);

const button = page.getByTestId("loginCreateAccountBtn");
button.click();

const expectedWidget = page.getByTestId(expectedActionOnCreateAccount[product]);
const expectedWidget = page.getByTestId(expectedLogin[product]["afterClicking"]);
await expect(expectedWidget).toBeVisible();
});
}
Loading
Loading