Closed victorpineda-jt closed 2 months ago
Thank you for your message. The function captureScreenRoboImage() is designed to capture the entire screen, whereas captureRoboImage() should be used for specific components. To better assist you, I would need to understand more about your use case. Could you please clarify why you are looking to remove the top app bar from the captureScreenRoboImage() function?
I'm using captureScreenRoboImage()
as I want to capture a bottom sheet with material 3, and captureRoboImage doesn't seem to be able to do so, even though I've specifically capturing the last root element like composeRule.onAllNodes(isRoot).onLast().captureRoboImage()
. But captureScreenRoboImage()
works fine. But this method is adding a top bar that doesn't belong to my app with the app name:
So I was wondering if there is any option to remove it.
I'm not sure, but Material 3's bottom sheet seems a little different. Have you tried using Espresso instead of a Compose rule to find the node? It would go something like this, though we need to figure out how to do it.
onView(????).captureRoboImage()
No, I haven't, I'm not using espresso in my project as it is 100% compose. I don't really want to find the specific bottom sheet node but capture the whole screen, which includes the content behind the bottom sheet. But if there is no easy way to remove that top bar that seems to be somehow generated by robolectric (that top bar is not part of my app) it won't be a big deal, I was just wondering if there was an easy way to remove it from the screenshot.
Compose's rule uses ActivityScenario, which is part of Espresso. Therefore, I believe you are already using Espresso, perhaps without realizing it. You should be able to use the onView() method. We might have a solution, so I will close this issue for now. I value our users, so if you have any use cases for this feature and the workaround is insufficient, please let me know. I'll reopen the issue.
This might be a silly question, but I've noticed that
captureScreenRoboImage()
generates a screenshot with a top bar that contains the app name. Is it possible to remove this top bar somehow when using this method?Thanks in advance.