Created
July 31, 2014 05:28
-
-
Save IlyaEremin/91d846319d74cd4c29f1 to your computer and use it in GitHub Desktop.
robotium test
This file contains hidden or 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 MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> { | |
private Solo solo; | |
public MainActivityTest() { | |
super(MainActivity.class); | |
} | |
public void setUp() throws Exception { | |
solo = new Solo(getInstrumentation(), getActivity()); | |
disablePasskey(); | |
} | |
public void testStartStopProgress() throws Exception { | |
solo.waitForActivity(MainActivity.class); | |
getActivity().stopProgress(); | |
assertFalse(solo.searchText("Loading")); | |
getActivity().startProgress(); | |
assertTrue(solo.searchText("Loading")); | |
getActivity().stopProgress(); | |
assertFalse(solo.searchText("Loading")); | |
} | |
public void testContactAdding() throws Exception { | |
solo.clickOnText("Contacts"); | |
solo.clickOnButton("Add a contact"); | |
DataFactory df = new DataFactory(); | |
solo.enterText((EditText) solo.getView(R.id.contact_email_editText), df.getEmailAddress()); | |
solo.enterText((EditText) solo.getView(R.id.contact_first_name_editText), df.getName()); | |
solo.clickOnView(solo.getView(R.id.actionBar_apply)); | |
assertTrue(solo.searchText(getActivity().getString(R.string.contact_updated))); | |
} | |
@Override | |
public void tearDown() throws Exception { | |
solo.finishOpenedActivities(); | |
} | |
public void disablePasskey(){ | |
Passcode.updatePIN("1111"); | |
Passcode.setUserLastActionTime(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment