1010 MINUTE ,
1111 RobustWebSocket ,
1212 ServiceType ,
13- wait_for_service_running ,
1413)
1514
1615_WAITING_FOR_SERVICE_TO_START : Final [int ] = 5 * MINUTE
16+ _WAITING_FOR_SERVICE_TO_APPEAR : Final [int ] = 2 * MINUTE
1717_DEFAULT_RESPONSE_TO_WAIT_FOR : Final [re .Pattern ] = re .compile (
1818 r"/flask/list_function_job_collections_for_functionid"
1919)
2020
21+ _FUNCTION_NAME : Final [str ] = "playwright_test_function"
22+
2123
2224def test_response_surface_modeling (
2325 page : Page ,
@@ -30,31 +32,75 @@ def test_response_surface_modeling(
3032 product_url : AnyUrl ,
3133 is_service_legacy : bool ,
3234):
33- with (
34- log_context (
35- logging .INFO ,
36- f"Waiting for { service_key } to be responsive (waiting for { _DEFAULT_RESPONSE_TO_WAIT_FOR } )" ,
37- ),
38- page .expect_response (
39- _DEFAULT_RESPONSE_TO_WAIT_FOR , timeout = _WAITING_FOR_SERVICE_TO_START
40- ),
41- ):
42- project_data = create_project_from_service_dashboard (
43- ServiceType .DYNAMIC , service_key , None , service_version
35+ # 1. create the initial study with jsonifier
36+ with log_context (logging .INFO , "Create new study..." ):
37+ jsonifier_project_data = create_project_from_service_dashboard (
38+ ServiceType .COMPUTATIONAL , "jsonifier" , None , service_version
4439 )
45- assert "workbench" in project_data , "Expected workbench to be in project data!"
40+ assert (
41+ "workbench" in jsonifier_project_data
42+ ), "Expected workbench to be in project data!"
4643 assert isinstance (
47- project_data ["workbench" ], dict
44+ jsonifier_project_data ["workbench" ], dict
4845 ), "Expected workbench to be a dict!"
49- node_ids : list [str ] = list (project_data ["workbench" ])
46+ node_ids : list [str ] = list (jsonifier_project_data ["workbench" ])
5047 assert len (node_ids ) == 1 , "Expected 1 node in the workbench!"
48+ # create the number parameter
49+ page .get_by_test_id ("newNodeBtn" ).click ()
50+ page .get_by_placeholder ("Filter" ).click ()
51+ page .get_by_placeholder ("Filter" ).fill ("number parameter" )
52+ page .get_by_placeholder ("Filter" ).press ("Enter" )
5153
52- wait_for_service_running (
53- page = page ,
54- node_id = node_ids [0 ],
55- websocket = log_in_and_out ,
56- timeout = _WAITING_FOR_SERVICE_TO_START ,
57- press_start_button = False ,
58- product_url = product_url ,
59- is_service_legacy = is_service_legacy ,
60- )
54+ # connect the jsonifier to the parameter
55+ page .get_by_test_id ("nodeTreeItem" ).filter (has_text = "jsonifier" ).click ()
56+ page .locator (
57+ "body > div:nth-child(5) > div:nth-child(5) > div:nth-child(3) > div:nth-child(3) > div > div:nth-child(2) > div > div > div:nth-child(3) > div:nth-child(4) > div:nth-child(1) > div > div > div:nth-child(2) > div:nth-child(2) > div > div > div > div:nth-child(2) > div.qx-panelview-content > div > div:nth-child(18)"
58+ ).click ()
59+
60+ # 2. convert it to a function
61+ # 3. start a RSM with that function
62+
63+ # with log_context(
64+ # logging.INFO,
65+ # f"Waiting for {service_key} to be responsive (waiting for {_DEFAULT_RESPONSE_TO_WAIT_FOR})",
66+ # ):
67+ # project_data = create_project_from_service_dashboard(
68+ # ServiceType.DYNAMIC, service_key, None, service_version
69+ # )
70+ # assert "workbench" in project_data, "Expected workbench to be in project data!"
71+ # assert isinstance(project_data["workbench"], dict), (
72+ # "Expected workbench to be a dict!"
73+ # )
74+ # node_ids: list[str] = list(project_data["workbench"])
75+ # assert len(node_ids) == 1, "Expected 1 node in the workbench!"
76+
77+ # wait_for_service_running(
78+ # page=page,
79+ # node_id=node_ids[0],
80+ # websocket=log_in_and_out,
81+ # timeout=_WAITING_FOR_SERVICE_TO_START,
82+ # press_start_button=False,
83+ # product_url=product_url,
84+ # is_service_legacy=is_service_legacy,
85+ # )
86+
87+ # service_iframe = page.frame_locator("iframe")
88+ # with log_context(logging.INFO, "Waiting for the RSM to be ready..."):
89+ # service_iframe.get_by_role("grid").wait_for(
90+ # state="visible", timeout=_WAITING_FOR_SERVICE_TO_APPEAR
91+ # )
92+
93+ # # select the function
94+ # service_iframe.get_by_role("gridcell", name=_FUNCTION_NAME).click()
95+
96+ # # Find the first input field (textbox) in the iframe
97+ # min_input_field = service_iframe.get_by_role("textbox").nth(0)
98+ # min_input_field.fill("1")
99+ # max_input_field = service_iframe.get_by_role("textbox").nth(1)
100+ # max_input_field.fill("10")
101+
102+ # # click on next
103+ # service_iframe.get_by_role("button", name="Next").click()
104+
105+ # # then we wait a long time
106+ # page.wait_for_timeout(1 * MINUTE)
0 commit comments