Skip to content

Commit 06d62cd

Browse files
committed
button cannot be checked that way
1 parent 5acd9a4 commit 06d62cd

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

tests/e2e-playwright/tests/tip/test_ti_plan.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,17 @@ def test_classic_ti_plan( # noqa: PLR0915
236236
assert not ws_info.value.is_closed()
237237
restartable_jlab_websocket = RobustWebSocket(page, ws_info.value)
238238

239-
with log_context(logging.INFO, "Run optimization") as ctx:
239+
with log_context(logging.INFO, "Run optimization") as ctx2:
240240
run_button = ti_iframe.get_by_role("button", name="Run Optimization")
241241
run_button.click(timeout=_JLAB_RUN_OPTIMIZATION_APPEARANCE_TIME)
242242
try:
243243
_wait_for_optimization_complete(run_button)
244-
ctx.logger.info("Optimization finished!")
244+
ctx2.logger.info("Optimization finished!")
245245
except RetryError as e:
246246
last_exc = e.last_attempt.exception()
247-
ctx.logger.warning(f"Optimization did not finish in time: {last_exc}")
247+
ctx2.logger.warning(
248+
"Optimization did not finish in time: %s", f"{last_exc}"
249+
)
248250

249251
with log_context(logging.INFO, "Create report"):
250252
with log_context(
@@ -262,25 +264,32 @@ def test_classic_ti_plan( # noqa: PLR0915
262264

263265
if is_product_lite:
264266
assert (
265-
not ti_iframe.get_by_role("button", name="Add to Report (0)")
267+
ti_iframe.get_by_role("button", name="Add to Report (0)")
266268
.nth(0)
267-
.is_enabled()
268-
)
269-
assert not ti_iframe.get_by_role(
270-
"button", name="Export to S4L"
271-
).is_enabled()
272-
assert not ti_iframe.get_by_role(
273-
"button", name="Export Report"
274-
).is_enabled()
269+
.get_attribute("disabled")
270+
is not None
271+
), "Add to Report button should be disabled in lite product"
272+
assert (
273+
ti_iframe.get_by_role("button", name="Export to S4L").get_attribute(
274+
"disabled"
275+
)
276+
is not None
277+
), "Export to S4L button should be disabled in lite product"
278+
assert (
279+
ti_iframe.get_by_role("button", name="Export Report").get_attribute(
280+
"disabled"
281+
)
282+
is not None
283+
), "Export Report button should be disabled in lite product"
275284

276285
else:
277286
with log_context(
278287
logging.INFO,
279288
f"Click button - `Add to Report (0)` and wait for {_JLAB_REPORTING_MAX_TIME}",
280289
):
281-
ti_iframe.get_by_role("button", name="Add to Report (0)").nth(
282-
0
283-
).click()
290+
ti_iframe.get_by_role(
291+
"button", name="Add to Report (0)", disabled=True
292+
).nth(0).click()
284293
page.wait_for_timeout(_JLAB_REPORTING_MAX_TIME)
285294
with log_context(
286295
logging.INFO,

0 commit comments

Comments
 (0)