Skip to content

moquality/crema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crema

Gitter

Set of utilities to extend the espresso testing framework

Word origin: Crema is the foam that makes espresso delicious.

How to get Crema

STEP 1: Download crema.jar from Releases and paste to your lib folder.

STEP 2: Next, you need to add a test compile dependency to your app's build.gradle

dependencies {
    // Testing-only dependencies
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile files('libs/crema-1.0.jar')
}

STEP 3: Finally, add EspressoPlus.* matchers in your test.

import static com.checkdroid.crema.EspressoPlus.*;

What does Crema get you

With Crema, we want to bring a library of new matchers and assertions to espresso.

As of now, crema has the following:

  • XPath Matchers: Crema has 2 implementations of xPath Matchers
  • withXPath(String xPath)
  • withXPath2(String xPath)
  • Taking screenshots in tests: Saves screenshots as /sdcard/{filename}_{timestamp}.png
  • takeScreenshot() - default file name is package name
  • takeScreenshot(String filename)
  • takeScreenshot(boolean timestamp) - timestamp is not added if false
  • takeScreenshot(String file, boolean addTimestamp)
  • Fetchers
  • TextFetcher class to get the text contained in a particular node
  • ViewTreeFetcher class to get the espresso view tree (different from UIAutomator view tree)
  • More coming soon..

Support

  • Got any issues/problems with crema?
  • Any other matchers/assertious you would like?

Please create new issues on github to reach out to us!

Signup for updates here: http://checkdroid.com/updates