Skip to content
Permalink
Browse files
Express Testing in RegistryActivity
  • Loading branch information
dacost13 committed Sep 14, 2021
1 parent 4b4c336 commit 3ee014e368295905c2e2b45cf3abc132d089eb2f
Showing 1 changed file with 57 additions and 0 deletions.
@@ -0,0 +1,57 @@
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())); }

}

0 comments on commit 3ee014e

Please sign in to comment.