From 67a1c292a7ceda0b7ae986d229fd1e83ba8d9477 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 20 Nov 2024 11:27:11 +0100 Subject: [PATCH 1/8] "studyTitleField" --- .../client/source/class/osparc/study/StudyOptions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js index 5b0fd30cadb1..db5150b68406 100644 --- a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js +++ b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js @@ -130,6 +130,7 @@ qx.Class.define("osparc.study.StudyOptions", { control = new qx.ui.form.TextField().set({ maxWidth: 220 }); + osparc.utils.Utils.setIdToWidget(control, "studyTitleField"); this.getChildControl("title-layout").add(control); break; case "wallet-selector-layout": From ed457b647cf108dd430618aa7349ab147b8ccc6c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 20 Nov 2024 13:15:09 +0100 Subject: [PATCH 2/8] _open_with_resources --- tests/e2e-playwright/tests/conftest.py | 27 ++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index 551dc1ad2665..a042c4dbb73f 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -11,7 +11,6 @@ import os import random import re -import time import urllib.parse from collections.abc import Callable, Iterator from contextlib import ExitStack @@ -405,6 +404,18 @@ def log_in_and_out( page.wait_for_timeout(500) +def _open_with_resources(page: Page, click_it: bool): + page.wait_for_function( + """element => element.value === 'asdf'""", + arg=page.get_by_test_id("studyTitleField"), + ) + # Open project with default resources + open_with_resources_button = page.get_by_test_id("openWithResources") + if click_it: + open_with_resources_button.click() + return open_with_resources_button + + @pytest.fixture def create_new_project_and_delete( page: Page, @@ -451,9 +462,7 @@ def _( if template_id is not None: if is_product_billable: open_button.click() - # Open project with default resources - open_button = page.get_by_test_id("openWithResources") - time.sleep(2) # wait until the study options are filled up + open_button = _open_with_resources(page, False) # it returns a Long Running Task with page.expect_response( re.compile(rf"/projects\?from_study\={template_id}") @@ -498,16 +507,10 @@ def wait_for_done(response): else: open_button.click() if is_product_billable: - # Open project with default resources - open_button = page.get_by_test_id("openWithResources") - time.sleep(2) # wait until the study options are filled up - open_button.click() + _open_with_resources(page, True) open_with_resources_clicked = True if is_product_billable and not open_with_resources_clicked: - # Open project with default resources - open_button = page.get_by_test_id("openWithResources") - time.sleep(2) # wait until the study options are filled up - open_button.click() + _open_with_resources(page, True) project_data = response_info.value.json() assert project_data project_uuid = project_data["data"]["uuid"] From aeeca3a7533dabb92c9a36a487311171b84c88d6 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 20 Nov 2024 13:27:50 +0100 Subject: [PATCH 3/8] undo --- tests/e2e-playwright/tests/conftest.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index a042c4dbb73f..bd71103fca61 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -404,18 +404,6 @@ def log_in_and_out( page.wait_for_timeout(500) -def _open_with_resources(page: Page, click_it: bool): - page.wait_for_function( - """element => element.value === 'asdf'""", - arg=page.get_by_test_id("studyTitleField"), - ) - # Open project with default resources - open_with_resources_button = page.get_by_test_id("openWithResources") - if click_it: - open_with_resources_button.click() - return open_with_resources_button - - @pytest.fixture def create_new_project_and_delete( page: Page, @@ -462,7 +450,7 @@ def _( if template_id is not None: if is_product_billable: open_button.click() - open_button = _open_with_resources(page, False) + open_button = page.get_by_test_id("openWithResources") # it returns a Long Running Task with page.expect_response( re.compile(rf"/projects\?from_study\={template_id}") @@ -507,10 +495,16 @@ def wait_for_done(response): else: open_button.click() if is_product_billable: - _open_with_resources(page, True) + open_with_resources_button = page.get_by_test_id( + "openWithResources" + ) + open_with_resources_button.click() open_with_resources_clicked = True if is_product_billable and not open_with_resources_clicked: - _open_with_resources(page, True) + open_with_resources_button = page.get_by_test_id( + "openWithResources" + ) + open_with_resources_button.click() project_data = response_info.value.json() assert project_data project_uuid = project_data["data"]["uuid"] From 558a358a00a1602cd03e33bedb79a712e8ce9f02 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 20 Nov 2024 13:28:11 +0100 Subject: [PATCH 4/8] disable button until requirements are met --- .../client/source/class/osparc/study/StudyOptions.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js index db5150b68406..8620aae8d24b 100644 --- a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js +++ b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js @@ -130,6 +130,7 @@ qx.Class.define("osparc.study.StudyOptions", { control = new qx.ui.form.TextField().set({ maxWidth: 220 }); + control.addListener("changeValue", () => this.__evaluateOpenButton()); osparc.utils.Utils.setIdToWidget(control, "studyTitleField"); this.getChildControl("title-layout").add(control); break; @@ -227,7 +228,8 @@ qx.Class.define("osparc.study.StudyOptions", { minWidth: 150, maxWidth: 150, height: 35, - center: true + center: true, + enabled: false, }); osparc.utils.Utils.setIdToWidget(control, "openWithResources"); this.getChildControl("buttons-layout").addAt(control, 1); @@ -277,7 +279,13 @@ qx.Class.define("osparc.study.StudyOptions", { }); } - this.getChildControl("open-button").setEnabled(Boolean(wallet)); + this.__evaluateOpenButton(); + }, + + __evaluateOpenButton: function() { + const hasTitle = Boolean(this.getChildControl("title-field").getValue()); + const walletSelected = Boolean(this.getWallet()); + this.getChildControl("open-button").setEnabled(hasTitle && walletSelected); }, __buildLayout: function() { From 6dd331423d6c07bc46e19c74fea214aca1b0a43c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 20 Nov 2024 13:32:16 +0100 Subject: [PATCH 5/8] minor --- .../client/source/class/osparc/study/StudyOptions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js index 8620aae8d24b..96c68afc8008 100644 --- a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js +++ b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js @@ -292,6 +292,8 @@ qx.Class.define("osparc.study.StudyOptions", { this.__buildTopSummaryLayout(); this.__buildOptionsLayout(); this.__buildButtons(); + + this.__evaluateOpenButton(); }, __buildTopSummaryLayout: function() { From 2a67227fd547cdf6a5d44634295b094aacb0de8f Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 20 Nov 2024 13:35:11 +0100 Subject: [PATCH 6/8] comments --- tests/e2e-playwright/tests/conftest.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index bd71103fca61..55b0c6e6cfcb 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -450,6 +450,7 @@ def _( if template_id is not None: if is_product_billable: open_button.click() + # Open project with default resources open_button = page.get_by_test_id("openWithResources") # it returns a Long Running Task with page.expect_response( @@ -495,16 +496,14 @@ def wait_for_done(response): else: open_button.click() if is_product_billable: - open_with_resources_button = page.get_by_test_id( - "openWithResources" - ) - open_with_resources_button.click() + # Open project with default resources + open_button = page.get_by_test_id("openWithResources") + open_button.click() open_with_resources_clicked = True if is_product_billable and not open_with_resources_clicked: - open_with_resources_button = page.get_by_test_id( - "openWithResources" - ) - open_with_resources_button.click() + # Open project with default resources + open_button = page.get_by_test_id("openWithResources") + open_button.click() project_data = response_info.value.json() assert project_data project_uuid = project_data["data"]["uuid"] From 555b108d7119def5ba2fa0fc182f87b5cc7eae3e Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 20 Nov 2024 13:38:17 +0100 Subject: [PATCH 7/8] minor --- .../client/source/class/osparc/study/StudyOptions.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js index 96c68afc8008..d9dd439df6ef 100644 --- a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js +++ b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js @@ -142,6 +142,7 @@ qx.Class.define("osparc.study.StudyOptions", { control = osparc.desktop.credits.Utils.createWalletSelector("read").set({ allowGrowX: false }); + control.addListener("changeSelection", () => this.__evaluateOpenButton()); this.getChildControl("wallet-selector-layout").add(control); break; case "advanced-layout": @@ -278,13 +279,11 @@ qx.Class.define("osparc.study.StudyOptions", { } }); } - - this.__evaluateOpenButton(); }, __evaluateOpenButton: function() { const hasTitle = Boolean(this.getChildControl("title-field").getValue()); - const walletSelected = Boolean(this.getWallet()); + const walletSelected = Boolean(this.getChildControl("wallet-selector").getSelection()); this.getChildControl("open-button").setEnabled(hasTitle && walletSelected); }, From 9009a385cf05452bc04f6de8957fadfb7684f310 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 20 Nov 2024 13:46:44 +0100 Subject: [PATCH 8/8] minor --- .../client/source/class/osparc/study/StudyOptions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js index d9dd439df6ef..0ceef6fde4e5 100644 --- a/services/static-webserver/client/source/class/osparc/study/StudyOptions.js +++ b/services/static-webserver/client/source/class/osparc/study/StudyOptions.js @@ -283,7 +283,7 @@ qx.Class.define("osparc.study.StudyOptions", { __evaluateOpenButton: function() { const hasTitle = Boolean(this.getChildControl("title-field").getValue()); - const walletSelected = Boolean(this.getChildControl("wallet-selector").getSelection()); + const walletSelected = Boolean(this.getChildControl("wallet-selector").getSelection().length); this.getChildControl("open-button").setEnabled(hasTitle && walletSelected); },