Skip to content

Instantly share code, notes, and snippets.

@lparoli
lparoli / LoginScreen
Last active September 21, 2017 09:19
Screen Object Pattern class example
package qa.com.espressospoonstructure.screenObjects;
import android.support.test.espresso.ViewInteraction;
import org.hamcrest.Matcher;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.clearText;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.scrollTo;
@lparoli
lparoli / TestLogin
Last active September 21, 2017 15:39
Class example for testing a Login screen using Screen Object Pattern & JUnit4.
package qa.com.espressospoonstructure.tests;
import org.junit.Test;
import qa.com.espressospoonstructure.screenObjects.LoginScreen;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
public class TestLoginScreen extends BaseTestCase<MainActivity> {
@lparoli
lparoli / BaseTestCase
Created May 4, 2015 06:53
Base class for your Espresso tests, using JUnit4.
package qa.com.espressospoonstructure.tests;
import android.app.Activity;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.test.ActivityInstrumentationTestCase2;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;