Skip to content

Commit 527e7e3

Browse files
authored
Merge branch 'master' into split_func_repos_files
2 parents 90602cd + f6bfc51 commit 527e7e3

File tree

1 file changed

+66
-33
lines changed

1 file changed

+66
-33
lines changed

tests/e2e-playwright/tests/metamodeling/test_response_surface_modeling.py

Lines changed: 66 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -122,39 +122,72 @@ def test_response_surface_modeling(
122122
1
123123
].click()
124124

125-
# create the probe
126-
with page.expect_response(
127-
lambda response: re.compile(
128-
rf"/projects/{jsonifier_project_data['uuid']}"
129-
).search(response.url)
130-
is not None
131-
and response.request.method == "PATCH"
132-
):
133-
page.get_by_test_id("connect_probe_btn_number_3").click()
134-
135-
# # create the parameter
136-
page.get_by_test_id("connect_input_btn_number_1").click()
137-
with page.expect_response(
138-
lambda response: re.compile(
139-
rf"/projects/{jsonifier_project_data['uuid']}"
140-
).search(response.url)
141-
is not None
142-
and response.request.method == "PATCH"
143-
):
144-
page.get_by_text("new parameter").click()
145-
146-
# rename the project to identify it
147-
page.get_by_test_id("studyTitleRenamer").click()
148-
with page.expect_response(
149-
lambda response: re.compile(
150-
rf"/projects/{jsonifier_project_data['uuid']}"
151-
).search(response.url)
152-
is not None
153-
and response.request.method == "PATCH"
154-
):
155-
page.get_by_test_id("studyTitleRenamer").locator("input").fill(
156-
_STUDY_FUNCTION_NAME
157-
)
125+
jsonifier_prj_uuid = jsonifier_project_data["uuid"]
126+
127+
with log_context(logging.INFO, "Create probe"):
128+
with (
129+
page.expect_response(
130+
lambda resp: resp.url.endswith(f"/projects/{jsonifier_prj_uuid}")
131+
and resp.request.method == "PATCH"
132+
) as patch_prj_probe_ctx,
133+
page.expect_response(
134+
lambda resp: resp.url.endswith(
135+
f"/projects/{jsonifier_prj_uuid}/nodes"
136+
)
137+
and resp.request.method == "POST"
138+
) as create_probe_ctx,
139+
):
140+
page.get_by_test_id("connect_probe_btn_number_3").click()
141+
142+
patch_prj_probe_resp = patch_prj_probe_ctx.value
143+
assert (
144+
patch_prj_probe_resp.status == 204
145+
), f"Expected 204 from PATCH, got {patch_prj_probe_resp.status}"
146+
create_probe_resp = create_probe_ctx.value
147+
assert (
148+
create_probe_resp.status == 201
149+
), f"Expected 201 from POST, got {create_probe_resp.status}"
150+
151+
with log_context(logging.INFO, "Create parameter"):
152+
page.get_by_test_id("connect_input_btn_number_1").click()
153+
154+
with (
155+
page.expect_response(
156+
lambda resp: resp.url.endswith(f"/projects/{jsonifier_prj_uuid}")
157+
and resp.request.method == "PATCH"
158+
) as patch_prj_param_ctx,
159+
page.expect_response(
160+
lambda resp: resp.url.endswith(
161+
f"/projects/{jsonifier_prj_uuid}/nodes"
162+
)
163+
and resp.request.method == "POST"
164+
) as create_param_ctx,
165+
):
166+
page.get_by_text("new parameter").click()
167+
168+
patch_prj_param_resp = patch_prj_param_ctx.value
169+
assert (
170+
patch_prj_param_resp.status == 204
171+
), f"Expected 204 from PATCH, got {patch_prj_param_resp.status}"
172+
create_param_resp = create_param_ctx.value
173+
assert (
174+
create_param_resp.status == 201
175+
), f"Expected 201 from POST, got {create_param_resp.status}"
176+
177+
with log_context(logging.INFO, "Rename project"):
178+
page.get_by_test_id("studyTitleRenamer").click()
179+
with page.expect_response(
180+
lambda resp: resp.url.endswith(f"/projects/{jsonifier_prj_uuid}")
181+
and resp.request.method == "PATCH"
182+
) as patch_prj_rename_ctx:
183+
page.get_by_test_id("studyTitleRenamer").locator("input").fill(
184+
_STUDY_FUNCTION_NAME
185+
)
186+
187+
patch_prj_rename_resp = patch_prj_rename_ctx.value
188+
assert (
189+
patch_prj_rename_resp.status == 204
190+
), f"Expected 204 from PATCH, got {patch_prj_rename_resp.status}"
158191

159192
# 2. go back to dashboard
160193
with (

0 commit comments

Comments
 (0)