{"id":18046793,"url":"https://github.com/blipinsk/cortado","last_synced_at":"2025-04-09T20:15:29.384Z","repository":{"id":57717676,"uuid":"82491916","full_name":"blipinsk/cortado","owner":"blipinsk","description":"Android Espresso made more fluent :coffee:","archived":false,"fork":false,"pushed_at":"2018-09-05T17:48:46.000Z","size":717,"stargazers_count":331,"open_issues_count":3,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-09T20:15:24.935Z","etag":null,"topics":["android","android-library","espresso","testing","testing-tools"],"latest_commit_sha":null,"homepage":"","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/blipinsk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-19T21:48:15.000Z","updated_at":"2024-06-21T14:20:54.000Z","dependencies_parsed_at":"2022-09-10T21:01:47.827Z","dependency_job_id":null,"html_url":"https://github.com/blipinsk/cortado","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blipinsk%2Fcortado","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blipinsk%2Fcortado/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blipinsk%2Fcortado/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blipinsk%2Fcortado/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blipinsk","download_url":"https://codeload.github.com/blipinsk/cortado/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"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":["android","android-library","espresso","testing","testing-tools"],"created_at":"2024-10-30T19:09:04.807Z","updated_at":"2025-04-09T20:15:29.352Z","avatar_url":"https://github.com/blipinsk.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Image](/img/1100x330.png)\n\n\nAndroid Espresso made more fluent :coffee:\n\n**Check out my [blog](https://medium.com/@blipinsk) :squirrel: or say *hi* on [Twitter](https://twitter.com/blipinsk).**\n\n--------\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Cortado-green.svg?style=true)](https://android-arsenal.com/details/1/5355)\n[![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23246-blue.svg)](http://androidweekly.net/issues/issue-246)\n[![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23271-blue.svg)](http://androidweekly.net/issues/issue-271)\n[![Build Status](https://travis-ci.org/blipinsk/cortado.svg?branch=master)](https://travis-ci.org/blipinsk/cortado)\n\nOverview\n--------\nCortado provides a layer of abstraction above Espresso, so it's a bit easier to use.\n\n**Remember: It is Google Espresso underneath.** You can still mess up your tests the same way you would when using pure Espresso. Cortado just gives you a bit nicer way to communicate with Espresso.\n\nEspresso vs. Cortado\n====================\n\n1. Get a `Matcher` for `clickable` views with `R.id.text` and with text NOT \"Example\"\n\n  Framework | Code example\n  --- | ---\n  Espresso | `Matchers.allOf(withId(R.id.text), isClickable(), Matchers.not(withText(\"Example\")));`\n  Cortado | `Cortado.view().withId(R.id.text).and().isClickable().and().not().withText(\"Example\");`\n\n2. Get a `Matcher` for views that have text `example` or have parent `FrameLayout`\n\n  Framework | Code example\n  --- | ---\n  Espresso | `Matchers.anyOf(withText(\"example\"), withParent(isAssignableFrom(FrameLayout.class)));`\n  Cortado | `Cortado.view().withText(\"example\").or().withParent(isAssignableFrom(FrameLayout.class));`\n\n3. Click on a `View` with `R.id.button`\n\n  Framework | Code example\n  --- | ---\n  Espresso | `Espresso.onView(withId(R.id.button)).perform(ViewActions.click());`\n  Cortado | `Cortado.onView().withId(R.id.button).perform().click();`\n\n4. Check if a `View` with text `example` is visible\n\n  Framework | Code example\n  --- | ---\n  Espresso | `Espresso.onView(withText(\"example\")).check(ViewAssertions.matches(isDisplayed()));`\n  Cortado | `Cortado.onView().withText(\"example\").check().matches(isDisplayed());`\n\n5. Replace a text on `enabled` view with `R.id.edit`\n\n  Framework | Code example\n  --- | ---\n  Espresso | `Espresso.onView(Matchers.allOf(withId(R.id.edit),isEnabled())).perform(ViewActions.replaceText(\"changed\"));`\n  Cortado | `Cortado.onView().withId(R.id.edit).and().isEnabled().perform().replaceText(\"changed\");`\n\nFeatures\n========\n\n1. Creating an instance of `org.hamcrest.Matcher\u003cView\u003e`\n    \n    ```java\n    org.hamcrest.Matcher\u003cView\u003e matcher = Cortado.view().withId(R.id.example);\n    ```\n    \n2. Creating an instance of `android.support.test.espresso.ViewInteraction`\n    \n    ```java\n    ViewInteraction viewInteraction = Cortado.onView().withId(R.id.example).perform(click());\n    ```\n\n3. Fluently creating `Matchers.allOf(...)`\n\n    ```java\n    Cortado.view().withId(R.id.example).and().withText(\"example\").and().isClickable();\n    ```\n    \n4. Fluently creating `Matchers.anyOf(...)`\n\n    ```java\n    Cortado.view().withId(R.id.example).or().withText(\"example\").or().isClickable();\n    ```\n\n5. Fluently negating conditions\n\n    ```java\n    Cortado.view().not().withId(R.id.example).and().withText(\"example\").and().not().isClickable();\n    ```\n    \n6. Fluently performing single action (on `ViewInteraction`)\n\n    ```java\n    Cortado.onView().withId(R.id.example).perform().click();\n    ```\n    \n7. Fluently checking matches (on `ViewInteraction`)\n\n    ```java\n    Cortado.onView().withId(R.id.example).check().matches(Cortado.view().withText(\"example\"));\n    ```\n\nCompatibility\n-------------\n\nI wanted the api of Cortado to be compatible with Espresso as much as possible. That's why you can do stuff like that:\n\n```java\nEspresso.onView(Cortado.view().withId(R.id.example).and().withText(\"Example\")).perform(click());\n```\n\nIncluding In Your Project\n-------------------------\n\n```groovy\ndependencies {\n    androidTestImplementation 'com.bartoszlipinski:cortado:1.2.0'\n}\n```\n\nDeveloped by\n============\n * Bartosz Lipiński\n\nLicense\n=======\n\n    Copyright 2017 Bartosz Lipiński\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblipinsk%2Fcortado","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblipinsk%2Fcortado","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblipinsk%2Fcortado/lists"}