Skip to content

Commit 5191764

Browse files
committed
Simplify cell editing logic in DataFrame output and test
Removed unnecessary class expectation when editing cells in OutputDataFrame and simplified flaky retry logic in the related test by using a single wait and class state check. This streamlines cell editing interactions and improves test reliability.
1 parent 863ea54 commit 5191764

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

shiny/playwright/controller/_output.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,8 +1105,6 @@ def _edit_cell_no_save(
11051105
self._cell_scroll_if_needed(row=row, col=col, timeout=timeout)
11061106
cell.dblclick(timeout=timeout)
11071107

1108-
# Wait for the cell to enter editing mode before filling the textarea
1109-
expect_to_have_class(cell, "cell-edit-editing", timeout=timeout)
11101108
cell.locator("> textarea").fill(text)
11111109

11121110
def set_sort(

tests/playwright/shiny/components/data_frame/validate_row_selection_edit_mode/test_validate_row_selection_edit_mode.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,15 @@ def test_validate_row_selection_in_edit_mode(
6060
page.keyboard.press("Escape")
6161
data_frame._edit_cell_no_save("Temp value", row=1, col=16)
6262
page.keyboard.press("Escape")
63+
# Add a small delay
64+
page.wait_for_timeout(100)
6365
page.keyboard.press("Enter")
64-
65-
# This interaction (Enter key to start editing) can be flaky, so we retry if needed
66-
max_retries = 3
67-
for attempt in range(max_retries):
68-
try:
69-
page.wait_for_timeout(100)
70-
data_frame.expect_class_state(
71-
"editing",
72-
row=1,
73-
col=0,
74-
timeout=1000,
75-
)
76-
break
77-
except AssertionError:
78-
if attempt < max_retries - 1:
79-
page.keyboard.press("Enter")
80-
else:
81-
raise
66+
data_frame.expect_class_state(
67+
"editing",
68+
row=1,
69+
col=0,
70+
timeout=1000,
71+
)
8272

8373
# Click outside the table/Press Escape to exit row focus.
8474
# Tab to the column name, hit enter. Verify the table becomes sorted.

0 commit comments

Comments
 (0)