Textfields menus items availability tests#3098
Textfields menus items availability tests#3098Ianina (ianinadavydova) wants to merge 12 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
| } | ||
|
|
||
| @Test | ||
| fun testOldContextMenuBasicTextFieldEditableCollapsedClipboardText() = |
There was a problem hiding this comment.
That's great that you managed to cover such many test cases.
One thing I would like to notice here is tests readability. In the perfect scenario, the test input conditions and assertions should be places right in the test body. And also, It's okay to have copy-pasted code in tests in order to make them clear and readable. Usually, every test body should have three easily distinguishable parts:
- Initial configuration
- Action
- Result validation
How I would suggest to re-arrange tests:
- Create "runComplexTextFieldTest(test: UIKitInstrumentedTest.(EditableTextFieldKind, isNewContextMenu: Bool) -> Unit) that runs two
runContextMenuTesttests inside - with the new context menu enabled and disabled and passes the execution to the main context body. It will allow to group four tests with the same action and validation into one. - The test body will be looking like
verifyEditableCollapsedContextMenu, but all the validation conditions will be visible right away there.
There was a problem hiding this comment.
Andrei Salavei (@ASalavei) sorry, I'm not sure I got the suggestion fully correctly, so I tried to refactor 1 group of tests, the result is here
Could you please take a look and confirm if it's what you suggested?There was a problem hiding this comment.
Yes, looks great! Please apply this approach to other test groups.
There was a problem hiding this comment.
Apllied to others, please, take a look when you have a chance.
Describe proposed changes and the issue being fixed
(Optional) Fixes CMP-10292 [iOS] Add instrumented tests for old and new edit menus with TextField and TextField2
Testing
(Optional) Describe how you tested your changes (provide a snippet or/and steps)
Release Notes
N/A