Closed jescriba closed 7 years ago
Shares some logic with PR #381 so we may want to refactor some if we merge both
Assume that #381 will not be merged. If it is ever merged, we can perform an extract refactor.
Another point I was concerned with is the while(hasText) { deleteBackward } logic
Add comment about timing out or limiting to a number of characters.
Add tests. What's the most appropriate way of adding test?
I don't think there is any way to add meaningful unit tests. The best we can do is add integration tests, either with Cucumber or UITest.
I was wrong about the LPTestTarget containing the required text input views.
Here is a depressing summary of the test applications that you might use. No application has every view that is required. CalSmoke is the closest. There might be a Xamarin test app with some of these.
I think the best place is for these views is actually in the DeviceAgent TextApp because we will eventually want to know if DeviceAgent can handle interacting with these kinds of views.
CalSmokeApp
LPTestTarget (in calabash-ios-server)
DeviceAgent TestApp
Jenkins test this please.
Motivation Currently clearing text doesn't trigger any of the appropriate delegate methods or NSNotifications - this PR attempts to address that.
Update - I rebased to use the LPRoute approach.
Tested locally using
GET
on the/clearText
route. Note - now this requires the keyboard to be open before clearing text.Accounts for possible scenarios: UITextField Calls
shouldChangeCharactersInRange
(when selecting all and cut) andshouldClear
(when selecting the 'x' button) on delegate FiresUITextFieldTextDidChange
NSNotificationUITextView Calls
shouldChangeTextIn
,textViewDidChangeSelection
,textViewDidChange
on delegate FiresUITextViewTextDidChange
NSNotificationUISearchBar Calls
shouldChangeTextIn
,textDidChange
on delegate no notifications firedUIKeyInput Implements this protocol in which case it attempts to
deleteBackward
untilhasText
returns falseTODO
while(hasText) { deleteBackward }
logic. Is there a way to do this with a timeout or what's the current best practice on that?Tests