nowinandroid
nowinandroid copied to clipboard
[Bug]: Splash screen shows when running composable tests
Is there an existing issue for this?
- [X] I have searched the existing issues
Is there a StackOverflow question about this issue?
- [X] I have searched StackOverflow
What happened?
A bug happened!
When running UI Composable tests, the Splash Screen is displayed. To see this happen, run any test in NavigationUiTest.kt.
Screen shot for when running NavigationUiTest.compactWidth_compactHeight_showsNavigationBar() test:
Expected results: Splash screen theme should not be shown when running compose UI tests. Instead, only the composable within composeTestRule.setContent should be displayed.
Relevant logcat output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Looks like a solution/work around is to set the splash theme at the activity level instead of the application level in AndroidManifest.xml.
Application theme changed from: android:theme="@style/Theme.Nia.Splash" to: android:theme="@style/Theme.Nia"
And adding: android:theme="@style/Theme.Nia.Splash" to .MainActivity
Seems to fix the issue.
I would like to work on this, please feel free to assign me.
@Vishwajith-Shettigar You can start working on this and open PR without any assignment.
@Vishwajith-Shettigar You can start working on this and open PR without any assignment.
Okay, thanks @anhtuannd.
There isn't any test suite named NavigationUiTest.kt. I ran tests in NavigationTest.kt; the splash screen was displayed (as it should be normally) but not like it is in the screenshot in the issue description. Any thoughts?
Edit: Realised this is screenshot testing not an espresso test and NavigationUiTest was renamed to NiaAppScreenSizesScreenshotTests.kt.
The worst thing in this screenshot is not the window background leaking in the screenshot, but the bottom bar that is not at the "bottom" of the screen, next to the navigation bar. This is probably the root cause. There might be something off in this screenshot.
I think the bottom navigation bar location is normal, because that DeviceConfiguration had been overridden as height 400dp.
It seems like the test suite has been renamed to NiaAppScreenSizesScreenshotTests.kt.
I think the bottom navigation bar location is normal, because that DeviceConfiguration had been overridden as height 400dp.
I'm assuming that the device configuration affects only NiaTheme and, ultimately, the NiaApp, not the whole application. Since we applied the theme Theme.Nia.Splash to NiaApplication, it shows the splash screen. Therefore, this solution would resolve this issue.
Hi, I'm unable to reproduce this issue; I don't see any splash screen in the screenshots as shown in the description above. @SimonMarquis, @Jaehwa-Noh, are you able to?
That test had been removed at #1373. If no problems found in any other tests, this issue could be closed.