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
@Test fun recyclerView_example() { | |
recyclerView(R.id.recycler_view) { | |
sizeIs(10) | |
atPosition(3) { | |
displayed { | |
id(R.id.item_description) | |
text(R.string.description_text) | |
text("Item header text") | |
} | |
} |
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
@Test | |
fun whenBothFieldsAreFilled_andClickOnLoginButton_shouldOpenMainActivity() { | |
login { | |
username("defaultText") | |
password("defaultText") | |
} doLogin { | |
isSuccess() | |
} | |
} |
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
class LoginRobot { | |
LoginRobot username(String username) { | |
onView(withId(R.id.login_username)).perform(typeText(username), closeSoftKeyboard()); | |
return this; | |
} | |
LoginRobot password(String password) { | |
onView(withId(R.id.login_password)).perform(typeText(password), closeSoftKeyboard()); | |
return this; | |
} |
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
@Test | |
public void whenBothFieldsAreFilled_andClickOnLoginButton_shouldOpenMainActivity() { | |
LoginRobot login = new LoginRobot(); | |
ResultLoginRobot result = login | |
.username("defaultText") | |
.password("defaultText") | |
.login(); | |
result.isSuccess() | |
} |
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
<!-- | |
login_image | |
login_username | |
login_password | |
login_button | |
--> | |
<LinearLayout |
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
09-22 07:29:42.114 4002-4002/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<< | |
09-22 07:29:42.116 4002-4002/? D/AndroidRuntime: CheckJNI is ON | |
09-22 07:29:42.139 4006-4006/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<< | |
09-22 07:29:42.140 4002-4002/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat | |
09-22 07:29:42.140 4006-4006/? D/AndroidRuntime: CheckJNI is ON | |
09-22 07:29:42.177 4002-4002/? E/memtrack: Couldn't load memtrack module (No such file or directory) | |
09-22 07:29:42.177 4002-4002/? E/android.os.Debug: failed to load memtrack module: -2 | |
09-22 07:29:42.179 4002-4002/? I/Radio-JNI: register_android_hardware_Radio DONE | |
09-22 07:29:42.181 4006-4006/? D/ICU: No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat | |
09-22 07:29:42.191 4002-4002/? D/AndroidRuntime: Calling main entry com.android.commands.wm.Wm |
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
@Test | |
public void clickOnPhone_shouldStartPhoneIntent() throws IOException { | |
mActivityRule.launchActivity(createIntent(false)); | |
Intents.init(); | |
intending(hasAction(Intent.ACTION_CALL)) | |
.respondWith(new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent())); | |
onView(withId(R.id.user_details_phone)).perform(scrollTo(), click()); | |
PermissionUtils.allowPermissionsIfNeeded(Manifest.permission.CALL_PHONE); | |
intended(hasAction(Intent.ACTION_CALL)); | |
Intents.release(); |
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
/** | |
* From: https://gist.github.com/rocboronat/65b1187a9fca9eabfebb5121d818a3c4 | |
*/ | |
public class PermissionUtils { | |
private static final int PERMISSIONS_DIALOG_DELAY = 3000; | |
private static final int GRANT_BUTTON_INDEX = 1; | |
public static void allowPermissionsIfNeeded(String permissionNeeded) { | |
try { | |
Context context = InstrumentationRegistry.getTargetContext(); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest | |
xmlns:tools="http://schemas.android.com/tools" | |
package="com.example.heitorcolangelo.espressotests"> | |
<uses-sdk tools:overrideLibrary="android.support.test.uiautomator.v18"/> | |
</manifest> |
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
@Test | |
public void clickOnPhone_shouldStartPhoneIntent() { | |
mActivityRule.launchActivity(createIntent(false)); | |
Intents.init(); | |
intending(hasAction(Intent.ACTION_CALL)) | |
.respondWith(new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent())); | |
onView(withId(R.id.user_details_phone)).perform(scrollTo(), click()); | |
intended(hasAction(Intent.ACTION_CALL)); | |
Intents.release(); | |
} |
NewerOlder