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

UI Tester update - Implement locating a nested UI for a custom style ListEditor #1175

Merged
merged 16 commits into from
Sep 3, 2020

Conversation

aaronayres35
Copy link
Contributor

Implements the seventh bullet on issue #1149 (Implement locating a nested UI for a custom style ListEditor. Consequently, one should be able to navigate into nested editors inside a nested UI.)

This PR replaces #1172

Comment on lines 76 to 78
for _ in range(6):
item.find_by_name("name").perform(command.KeyClick("Backspace"))
item.find_by_name("name").perform(command.KeySequence("David"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually we will be able to do this with just one KeySequence using '\b' characters, but there is a known issue with that so this works for now.

@aaronayres35 aaronayres35 marked this pull request as ready for review September 1, 2020 18:44
@aaronayres35 aaronayres35 requested a review from kitchoi September 1, 2020 21:18
@aaronayres35
Copy link
Contributor Author

This also gives a wx failure on windows:

======================================================================
890FAIL: test_locate_element_and_edit (traitsui.tests.editors.test_list_editor.TestCustomListEditor)
891----------------------------------------------------------------------
892Traceback (most recent call last):
893  File "C:\Users\appveyor\.edm\envs\traitsui-test-3.6-wx\lib\site-packages\traitsui\tests\editors\test_list_editor.py", line 84, in test_locate_element_and_edit
894    self.assertEqual(obj.people[7].name, "David")
895AssertionError: 'Fields' != 'David'
896- Fields
897+ David
898
899

like issue #1177
All failures appear to be coming from the same source (I suspect EmulateKeyPress in wx helpers.)

Copy link
Contributor

@kitchoi kitchoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Some minor suggestions.

traitsui/testing/tester/qt4/implementation/list_editor.py Outdated Show resolved Hide resolved
traitsui/testing/tester/registry_helper.py Outdated Show resolved Hide resolved
traitsui/tests/editors/test_list_editor.py Show resolved Hide resolved
traitsui/tests/editors/test_list_editor.py Outdated Show resolved Hide resolved
traitsui/tests/editors/test_list_editor.py Show resolved Hide resolved
@aaronayres35
Copy link
Contributor Author

My suspicions in the above discussion were correct. I added a helper function to set the insertion point the the right not the left end of a textbox on wx. This feels a bit tangential to this PR ( I can make this change in a separate PR if needed) but without it, this PR will introduce a new test failure. After #1184 is merged, with this most recent change, there shouldn't be any new errors with this PR as far as I know.

control : Instance of wxTextEntry
"""
control.SetInsertionPoint(control.GetLastPosition()+1)
return control
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function combines both query and command, which often makes it more difficult to reuse and to modify. We should avoid this as much as possible. See comments in #1184

If we remove this and the changes in traitsui/testing/tester/wx/implementation/text_editor.py and the KeyClick in the test, then this PR can be reviewed and merged independently of #1184. The objective of this PR has nothing to do with the text editor anyway.

traitsui/tests/editors/test_list_editor.py Show resolved Hide resolved
traitsui/tests/editors/test_list_editor.py Show resolved Hide resolved
Copy link
Contributor

@kitchoi kitchoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
One function being overly indented, can be merged after fixing that.

traitsui/testing/tester/registry_helper.py Outdated Show resolved Hide resolved
traitsui/testing/tester/registry_helper.py Outdated Show resolved Hide resolved
@aaronayres35 aaronayres35 merged commit 3b60967 into master Sep 3, 2020
@aaronayres35 aaronayres35 deleted the ui-tester-updates-listeditor branch September 3, 2020 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants