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

Fix off-by-one when specifying count with inputText #2123

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Fishbowler
Copy link
Contributor

@Fishbowler Fishbowler commented Nov 3, 2024

Proposed changes

Self-evident 1 character change to fix a problem where we're always deleting 1 character extra. Background in the linked issue.

Testing

- inputText: 'testing'
- assertVisible: 'testing'
- eraseText: '3'
- assertNotVisible: 'testing'
- assertVisible: 'test'

Issues fixed

#2122

@Fishbowler Fishbowler mentioned this pull request Nov 3, 2024
… of taps occur

Repeated tests show that the emulator can be slightly inconsistent and occasionally add an extra tap
@Fishbowler Fishbowler force-pushed the fix-eraseText-offByOne branch from 47c1305 to e75a143 Compare November 5, 2024 22:38
uiDevice.pressDelete()
Thread.sleep(50) // Attempt to ensure perfect count of taps on emulators
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't encourage doing this. Let's avoid having random sleeps in the code. It becomes very hard to reason about slowness and failures due to these.

Can you explain why is this exactly needed and if there is something other than a sleep we could do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before this sleep was in, I'd occasionally see 1 extra or 1 too few presses of the delete key.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a chance that shorter sleeps would be sufficient, or that the API could be improved to block until ready?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup I'd vote for choosing an API that reasons about that and includes wait as much in needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's the way forward with this change?
Would you accept a //TODO?

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.

2 participants