Screen Robots: UI Tests in Espresso
-
Upload
annyce-davis -
Category
Mobile
-
view
222 -
download
2
Transcript of Screen Robots: UI Tests in Espresso
@Testpublic void shouldProceedWithLoginWhenValid () {onView( withId( R.id.login_username_entry ) ).perform( typeText( TEST_EMAIL ) );
onView( withId( R.id.login_password_entry ) ).perform( typeText( TEST_PASSWORD ) );
onView( withId( R.id.login_button ) ).perform( click() );
intended( hasComponent( hasShortClassName( PACKAGE_NAME ) ) );}
@brwngrldev
@Testpublic void shouldProceedWithLoginWhenValid () {onView( withId( … ) ).perform( typeText( … ) );
onView( withId( … ) ).perform( typeText( … ) );
onView( withId( … ) ).perform( click() );…
}
@brwngrldev
@Testpublic void shouldProceedWithLoginWhenValid () {
withRobot( LoginScreenRobot.class )
}
@brwngrldev
@Testpublic void shouldProceedWithLoginWhenValid () {
withRobot( LoginScreenRobot.class ) .callLogin( TEST_EMAIL, TEST_PASSWORD )
}
@brwngrldev
@Testpublic void shouldProceedWithLoginWhenValid () {
withRobot( LoginScreenRobot.class ) .callLogin( TEST_EMAIL, TEST_PASSWORD )
.checkIsLoggedIn();}
@brwngrldev
public LoginScreenRobot callLogin (String username, String password) {
return enterTextIntoView ( R.id.login_username_entry, username )
}
@brwngrldev
Screen Robot
public LoginScreenRobot callLogin (String username, String password) {
return enterTextIntoView ( R.id.login_username_entry, username ) .enterTextIntoView ( R.id.login_password_entry, password ) }
@brwngrldev
Screen Robot
public LoginScreenRobot callLogin (String username, String password) {
return enterTextIntoView ( R.id.login_username_entry, username ) .enterTextIntoView ( R.id.login_password_entry, password ) .clickOkOnView( R.id.login_button );}
@brwngrldev
Screen Robot
@brwngrldev
Test Scenarios• Login with valid credentials
• Login with invalid credentials
• Login with bad server response
• Changing the slide language
• Verifying the correctness of the slide content
• Entering content into a text slide