Created
August 27, 2020 20:41
-
-
Save batmi02/889c30a55d228e12d4957a8aeb869587 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExampleInstrumentedTest { | |
@rule | |
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule(MainActivity.class); | |
@Test | |
public void simpleTeset() { | |
//Initialize the eyes SDK and set your private API key. | |
Eyes eyes = new Eyes(); | |
eyes.setApiKey("YOUR_API_KEY"); | |
try { | |
//start the test | |
eyes.open("Hello World!", "My first Espresso Android Test!"); | |
//Visual checkpoint #1 | |
eyes.checkWindow("Hello!"); | |
onView(withID(R.id.click_me_btn)).perform(click()); | |
//Visual checkpoint #2. | |
eyes.checkWindow("Click!"); | |
//End the test | |
eyes.close(); | |
} finally { | |
//if the test was aborted before eyes.close was called, end the test as aborted | |
eyes.abortIfNotClosed(): | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment