{"id":13472141,"url":"https://github.com/facebook/screenshot-tests-for-android","last_synced_at":"2025-05-14T00:06:59.519Z","repository":{"id":38716297,"uuid":"41693388","full_name":"facebook/screenshot-tests-for-android","owner":"facebook","description":"Generate fast deterministic screenshots during Android instrumentation tests","archived":false,"fork":false,"pushed_at":"2025-02-07T18:55:16.000Z","size":2616,"stargazers_count":1748,"open_issues_count":53,"forks_count":225,"subscribers_count":66,"default_branch":"main","last_synced_at":"2025-05-08T00:10:04.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://facebook.github.io/screenshot-tests-for-android","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebook.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-31T18:36:02.000Z","updated_at":"2025-05-02T16:28:22.000Z","dependencies_parsed_at":"2024-01-15T16:16:14.074Z","dependency_job_id":"b3cae6de-a0ba-49e6-9341-0370f49078d9","html_url":"https://github.com/facebook/screenshot-tests-for-android","commit_stats":{"total_commits":551,"total_committers":80,"mean_commits":6.8875,"dds":0.5698729582577132,"last_synced_commit":"4491bb981866667d8502ef988bf4d79e59e8c3e0"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fscreenshot-tests-for-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fscreenshot-tests-for-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fscreenshot-tests-for-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2Fscreenshot-tests-for-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebook","download_url":"https://codeload.github.com/facebook/screenshot-tests-for-android/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043629,"owners_count":22004978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T16:00:52.311Z","updated_at":"2025-05-14T00:06:59.491Z","avatar_url":"https://github.com/facebook.png","language":"Java","funding_links":[],"categories":["Java","Android","Others"],"sub_categories":["Mock Server"],"readme":"# Screenshot Tests for Android\n\n\u003cimg src=\"/.github/logo.png\" width=\"150\" align=\"right\"/\u003e\n\nscreenshot-tests-for-android is a library that can generate fast\ndeterministic screenshots while running instrumentation tests on\nAndroid.\n\nWe mimic Android's measure(), layout() and draw() to generate screenshots\non the test thread. By not having to do the rendering on a separate\nthread we have control over animations and handler callbacks which\nmakes the screenshots extremely deterministic and reliable for catching\nregressions in continuous integration.\n\nWe also provide utilities for using screenshot tests during the development\nprocess. With these scripts you can iterate on a view or layout and quickly\nsee how the view renders in a real Android environment, without having to\nbuild the whole app. You can also render the view in multiple configurations\nat one go.\n\n## Documentation\n\nTake a look at the documentation at http://facebook.github.io/screenshot-tests-for-android/#getting-started\n\n## Requirements\n\nscreenshot-tests-for-android is known to work with MacOS or Linux.\n\nThe host tooling probably doesn't work on Windows, but can be made to\nwork with a little effort. We'll happily accept pull requests!\n\nYou need python-2.7 for the gradle plugin to work, and we also\nrecommending installing the python-pillow library which is required\nfor recording and verifying screenshots.\n\n## Building screenshot-tests-for-android\n\nYou don't have to build screenshot-tests-for-android from scratch if\nyou don't plan to contribute. All artifacts are available from Maven\nCentral.\n\nIf you plan to contribute, this is the code is broken up into a few modules:\n\n* The `core` module is packaged as part of your instrumentation tests\n  and generates screenshots on the device.\n\n* The `plugin` module adds Gradle tasks to make it easier to work\n  with screenshot tests.\n\n* The `layout-hierarchy-common` module adds extra common `View` information to your reports' layout hierarchy viewer\n\n* The `layout-hierarchy-litho` module adds extra Litho component information to your reports' layout hierarchy viewer\n\n\nIn addition you'll find python code inside `plugin/src/py`. This code\nis packaged into the gradle plugin.\n\nWe have tests for the python code and the core library. Run these\ncommands to run all the tests:\n\n```bash\n  $ gradle :plugin:pyTests\n  $ gradle :core:connectedAndroidTest\n```\n\nBoth need a running emulator. \n\nPython tests rely on the `mock` and `Pillow` libraries. Both can be installed via `pip install mock`\nand `pip install Pillow`.\n\nYou can install all the artifacts to your local maven repository using\n\n```bash\n  $ gradle installArchives\n```\n\n## Running With a Remote Service\n\nFor usage with a remote testing service (e.g. Google Cloud Test Lab) where ADB is not available directly the plugin supports a \"disconnected\" \nworkflow.  Collect all screenshots into a single directory and run the plugin using the following options\n\n### Example\nThe location of the screenshot artifacts can be configured in the project's build.gradle:\n```groovy\n  screenshots {\n      // Points to the directory containing all the files pulled from a device\n      referenceDir = path/to/screenshots\n  }\n```\n\nThen, screenshots may be verified by executing the following:\n```bash\n  $ gradle :\u003cproject\u003e:verify\u003cflavor\u003eScreenshotTest\n```\n\nTo record, simply change `verify` to `record`.\n\n## Contributing\n\nPlease see the [contributing](.github/CONTRIBUTING.md) file.\n\n## Authors\n\nscreenshot-tests-for-android was originally written by Arnold Noronha (arnold@tdrhq.com)\nYou can reach him at @tdrhq on GitHub.\n\nIt is currently maintained by Hilal Alsibai (@xiphirx)\n\n## License\n\nscreenshot-tests-for-android is Apache-2-licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2Fscreenshot-tests-for-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebook%2Fscreenshot-tests-for-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2Fscreenshot-tests-for-android/lists"}