Skip to content

Commit 189f908

Browse files
test(e2e): wait for the input row to hide under a pending permission prompt
The permission-prompt element is attached first and Alpine applies the x-show style to .acp-input-row on the next tick. The test sampled the row's display once, immediately after the prompt attached, so on a loaded CI runner it could observe the pre-update state and fail (CI run 34159374409, chromium-kiro). Wait for the hidden state with a bounded wait_for_function instead, mirroring the existing check that the row becomes visible again after the prompt resolves. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent fb60646 commit 189f908

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

‎packages/studyloop/tests/test_web_acp_chat_ui.py‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
pytest.importorskip("playwright")
3535
pytest.importorskip("fastapi")
3636
pytest.importorskip("uvicorn")
37+
from playwright.sync_api import TimeoutError as PlaywrightTimeoutError
3738

3839
_tests_dir = Path(__file__).parent
3940
if str(_tests_dir) not in sys.path:
@@ -1982,17 +1983,22 @@ def test_allow_deny_buttons_render_and_input_row_hidden(
19821983
assert "Allow" in names and "Deny" in names, (
19831984
f"Expected Allow+Deny buttons, got: {names}"
19841985
)
1985-
# Input row must be hidden while prompt is pending.
1986-
input_row_visible = page.evaluate(
1987-
"""() => {
1988-
const r = document.querySelector('.acp-input-row');
1989-
if (!r) return false;
1990-
return getComputedStyle(r).display !== 'none';
1991-
}"""
1992-
)
1993-
assert not input_row_visible, (
1994-
"Input row should be hidden while permission prompt is pending"
1995-
)
1986+
# Input row must be hidden while prompt is pending. The prompt is
1987+
# attached first and Alpine applies the x-show style on the next
1988+
# tick, so wait for the hidden state instead of sampling it once
1989+
# (a one-shot evaluate raced this on a loaded CI runner).
1990+
try:
1991+
page.wait_for_function(
1992+
"""() => {
1993+
const r = document.querySelector('.acp-input-row');
1994+
return !r || getComputedStyle(r).display === 'none';
1995+
}""",
1996+
timeout=3000,
1997+
)
1998+
except PlaywrightTimeoutError:
1999+
raise AssertionError(
2000+
"Input row should be hidden while permission prompt is pending"
2001+
) from None
19962002

19972003
filtered_errors = [
19982004
e for e in app_errors if "Cannot read properties of null (reading 'type')" not in e

0 commit comments

Comments
 (0)