Skip to content

Conversation

@dnieto-r
Copy link
Contributor

🎟️ Jira ticket

ANDROID-16401

πŸ₯… What's the goal?

In the last SmartWifi PR @jeprubio has proposed to add a property to close the keyboard before the screenshot inside the snaptesting library instead of in the app. I'm adding this feature, is that okay with you?

🚧 How do we do it?

Just one variable with default value as false that forces the keyboard to close.

@dnieto-r dnieto-r changed the title add closeKeyboardFirst before taking the screenshot close keyboard before taking the screenshot Sep 15, 2025
Copy link
Contributor

@jeprubio jeprubio left a comment

Choose a reason for hiding this comment

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

I proposed doing this first in our app and test it well before considering moving it to the lib, but ok πŸ˜„ Thanks!

P.S.: Also, this is not the only way it can be done, the lib could provide this as an extension function... idk. I'm OK with this one.

@dnieto-r
Copy link
Contributor Author

I proposed doing this first in our app and test it well before considering moving it to the lib, but ok πŸ˜„ Thanks!

I've tested it locally before and it seems to close the keyboard properly.

@jeslat
Copy link
Contributor

jeslat commented Sep 15, 2025

I don't have a strong opinion, but I think this is very specific and shouldn't be inside the library.

You can always use that closeSoftKeyboard espresso function in your test just before taking the screenshot instead of passing the parameter to the snap testing library.

I would understand adding this if the code to close the keyboard was complex and difficult, but in this case, it's just calling an espresso function.

@dnieto-r
Copy link
Contributor Author

I don't have a strong opinion, but I think this is very specific and shouldn't be inside the library.

You can always use that closeSoftKeyboard espresso function in your test just before taking the screenshot instead of passing the parameter to the snap testing library.

I would understand adding this if the code to close the keyboard was complex and difficult, but in this case, it's just calling an espresso function.

I don't have a strong opinion on this either, which is why I opened this PR to start a debate. Its' true that is not complex code, and It's also true that you'll often want to close the keyboard by simulating an β€œEnter” key press, and we can't handle that with this. Perhaps it's better to leave it for implementation in the apps rather than the library.

@dnieto-r dnieto-r closed this Sep 15, 2025
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.

4 participants