Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CTRL+a + DELETE for TextInput clear method #257

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

tpapaioa
Copy link
Collaborator

Fixes #226

TextInput.fill() should clear any existing text from the element before adding the new text value. It does this by calling Selenium's WebElement.clear() method. This doesn't work reliably when the textarea element is controlled by React.

This PR updates TextInput.fill() to use keyboard actions (Control+A then Delete) to clear the field instead.

Verified in pytest:

$  pytest -k test_simple_input_send_keys_clear
=== test session starts ===
[...]
collected 169 items / 168 deselected / 1 selected                                                                                                                                                                                            

testing/test_browser.py::test_simple_input_send_keys_clear PASSED   

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.44%. Comparing base (5f54ea6) to head (0cf7111).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #257      +/-   ##
==========================================
- Coverage   86.49%   86.44%   -0.05%     
==========================================
  Files          18       18              
  Lines        2569     2567       -2     
==========================================
- Hits         2222     2219       -3     
- Misses        347      348       +1     
Flag Coverage Δ
unittests 86.44% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mshriver mshriver merged commit 777a99f into RedHatQE:master Aug 26, 2024
7 of 17 checks passed
@tpapaioa tpapaioa deleted the fix_textinput_clear branch August 26, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TextInput.clear() does not work reliably
3 participants