Describe the bug
UiModeTestRule works perfectly fine with ActivityScenarios. However, it seems it is not the case when it comes to the deprecated ActivityTestRule, which is used by some screenshot testing libraries like ndpt/android-testify or its predecessor shopify/android-testify.
Environment
The setup in which the bug is reproducible:
Device or Emulator: Emulator
API level: Any
AndroidUiTestingUtils version: any
Affected Component: UiModeTestRule but only when used with the deprecated ActivityTestRule
Buggy Configuration: UiMode
Expected behavior
When UiModeTestRule is used with ndpt/android-testify screenshot testing library, it should also change the UiMode to "Day" or "Night" accordingly.
Additional context
Seems that the problem is due to AppCompatDelegate being not executed at the proper time.
An approach without APpCompatDelegate, but using reflection (like with SystemLocaleTestRule) should work.
Describe the bug UiModeTestRule works perfectly fine with ActivityScenarios. However, it seems it is not the case when it comes to the deprecated ActivityTestRule, which is used by some screenshot testing libraries like ndpt/android-testify or its predecessor shopify/android-testify.
Environment The setup in which the bug is reproducible:
Expected behavior When UiModeTestRule is used with ndpt/android-testify screenshot testing library, it should also change the UiMode to "Day" or "Night" accordingly.
Additional context Seems that the problem is due to AppCompatDelegate being not executed at the proper time. An approach without APpCompatDelegate, but using reflection (like with SystemLocaleTestRule) should work.