Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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())); } | ||
|
||
} |