Skip to content
Permalink
3ee014e368
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
57 lines (39 sloc) 2.11 KB
package com.example.booksharing21;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@SmallTest
public class RegisterActivityExpress {
private static final String VALID_Email = "john.doe@outlook.com";
private static final String VALID_Password = "1234john";
// https://developer.android.com/training/testing/espresso/intents testing view using express test
@Rule
public ActivityScenarioRule<RegisterActivity> activityRule = new ActivityScenarioRule<>(RegisterActivity.class);
@Test
public void bannerRegister (){ onView(withId(R.id.banner)); }
@Test
public void usernameRegister(){onView(withId(R.id.username)).perform(typeText("Jane"),closeSoftKeyboard());}
@Test
public void EmailRegister(){onView(withId(R.id.email)).perform(typeText(VALID_Email),closeSoftKeyboard()); }
@Test
public void passwordRegister(){onView(withId(R.id.password)).perform(typeText(VALID_Password), closeSoftKeyboard());}
@Test
public void password2Register(){onView(withId(R.id.password2)).perform(typeText(VALID_Password), closeSoftKeyboard());}
@Test
public void AddressRegister(){onView(withId(R.id.address)).perform(typeText("Priory Street"), closeSoftKeyboard());}
@Test
public void phoneRegister() {onView(withId(R.id.phone)).perform(typeText("29289343456"), closeSoftKeyboard());}
@Test
public void buttonRegister (){ onView(withId(R.id.reg1)).perform(click()).check(matches(isDisplayed())); }
}