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

Android-Testify Compose, View and fragment rules do not handle DisplaySize properly #104

Open
sergio-sastre opened this issue Feb 12, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sergio-sastre
Copy link
Owner

Describe the bug
When verifying only, it fails with UnexpectedDeviceException.

This happens because testify uses different Contexts to create the customKeys for naming the destination folders:
record: activity context
verify: instrumentation context

Since AndroidUiTestingUtils modifies the Activity context display size, it differs from the one of the instrumentation context used when verifying and it fails.

Environment
The setup in which the bug is reproducible:

  • Device or Emulator: Both
  • API level: Any
  • AndroidUiTestingUtils version: 2.2.0
  • Affected Component: Composable, AndroidView (Android-Testify versions)
  • Buggy Configuration: [e.g. DisplaySize]

Expected behavior
No exception is thrown

*Possible fix
We could use a the DisplaySizeTestRule internally to set the Display size. The test rule executes an adb command to change the display size of the device, and therefore it affects also the instrumentation context and not only that of the activity.

Moreover, report this in Android-Testify repo

@sergio-sastre
Copy link
Owner Author

sergio-sastre commented Feb 19, 2024

Seems that it is a bit hacky to deal with TestRules and ComposeRule together, and the tests also become more slow... better to get it fixed in Android-Testify

@sergio-sastre sergio-sastre added bug Something isn't working and removed bugfix release 2.2.1 labels Feb 21, 2024
@sergio-sastre sergio-sastre changed the title Android-Testify view and fragment rules do not handle DisplaySize properly Android-Testify Compose, View and fragment rules do not handle DisplaySize properly Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant