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

Screenshots get deleted after being recorded. #323

Open
cj1098 opened this issue Nov 7, 2022 · 0 comments
Open

Screenshots get deleted after being recorded. #323

cj1098 opened this issue Nov 7, 2022 · 0 comments

Comments

@cj1098
Copy link

cj1098 commented Nov 7, 2022

Expected behaviour

I expect after running ./gradlew executeScreenshotTests -Precord that the tests get saved and stay in the directory they're saved in.

Actual behaviour

The entire directory gets deleted, and a new empty directory gets created in projects' build/reports/shot/debug/record/images/recorded. It has screenshots-default and screenshots-compose-default, but both are empty. It also has an index.html and that says 0 screenshot tests were run.

Steps to reproduce

run /gradlew executeScreenshotTests -Precord

Version of the library

I'm using Shot 5.14.1

My setup is as follows: I tried to follow the instruments as closely as possible.
I have an AndroidManifest test file that declares sharedUserId, and I have declared that same id in app/AndroidManifest.
in my project build.gradle I have declared in my dependencies classpath 'com.karumi:shot:5.14.1'
My test runner is testInstrumentationRunner "com.karumi.shot.ShotTestRunner"

I've applied everything in the get started section possible (I think)

What I get is

Task :app:debugExecuteScreenshotTests
💾 Saving screenshots.
🤔 We couldn't find any screenshot. Did you configure Shot properly and added your tests to your project? https://github.com/pedrovgs/Shot/#getting-started

The odd thing is, after it deletes the directories then I get this error ☝️ , but if I add them back in manually and then run /gradlew executeScreenshotTests -Precord then it returns everything was successful, except it deletes everything... lol I see the files be generated then immediately deleted.

Task :app:debugExecuteScreenshotTests
💾 Saving screenshots.
😃 Screenshots recorded and saved at: /Users/chrisjohnson/StudioProjects/project/app/screenshots/debug/
🤓 You can review the execution report here: /Users/chrisjohnson/StudioProjects/project/app/build/reports/shot/debug/index.html

My test is basic, with some infrastructure around compose.

class MessagesScreenTest : BaseComposeScreenTest<MessagesUiState, MessagesViewModel, UiEvent.Default>(
    MessagesUiState()
), ScreenshotTest {

    @Test
    fun testMessagesScreenShot() {
        setContent { viewModel ->
            MessagesScreen(viewModel = viewModel)
            updateUiState {
                it.copy(toolbarTitle = "test")
            }
        }
        compareScreenshot(composeTestRule)
    }
}
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

No branches or pull requests

1 participant