diff --git a/OlympusServices/.idea/caches/build_file_checksums.ser b/OlympusServices/.idea/caches/build_file_checksums.ser index ce93595..38a3339 100644 Binary files a/OlympusServices/.idea/caches/build_file_checksums.ser and b/OlympusServices/.idea/caches/build_file_checksums.ser differ diff --git a/OlympusServices/app/build.gradle b/OlympusServices/app/build.gradle index 84f55ee..b9ba7b2 100644 --- a/OlympusServices/app/build.gradle +++ b/OlympusServices/app/build.gradle @@ -29,10 +29,13 @@ dependencies { implementation 'com.android.support:design:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' + testImplementation 'androidx.test:core:1.0.0' + testImplementation 'org.mockito:mockito-core:1.10.19' testImplementation 'org.robolectric:robolectric:4.0-alpha-3-SNAPSHOT' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:rules:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'org.hamcrest:hamcrest-library:1.3' implementation 'com.jaredrummler:material-spinner:1.2.5' implementation 'com.android.support:design:28.0.0-alpha3' implementation 'com.rengwuxian.materialedittext:library:2.1.4' diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/LogInTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/LogInTest.java new file mode 100644 index 0000000..0487845 --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/LogInTest.java @@ -0,0 +1,22 @@ +package com.uottawa.olympus.olympusservices; + +import android.support.test.rule.ActivityTestRule; +import android.support.test.runner.AndroidJUnit4; + + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(AndroidJUnit4.class) +public class LogInTest { + + @Rule + public ActivityTestRule mActivityTestRule = new ActivityTestRule(LogIn.class); + + @Test + public void checkSignIn() throws Exception{ + + } +} \ No newline at end of file diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java new file mode 100644 index 0000000..1e1e229 --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java @@ -0,0 +1,27 @@ +package com.uottawa.olympus.olympusservices; + +import android.support.test.annotation.UiThreadTest; +import android.support.test.rule.ActivityTestRule; +import android.widget.TextView; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class ServiceProviderTest { + /*@Rule + public ActivityTestRule mActivityTestRule2 = new ActivityTestRule(ServiceProvider.class); + private ServiceProvider mActivity2 = null; + private TextView text; + + @Before + public void setUp() throws Exception{ + mActivity2=mActivityTestRule2.getActivity(); + } + + @Test + @UiThreadTest + public void checkServices() throws Exception{ + + }*/ +} \ No newline at end of file diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest.java new file mode 100644 index 0000000..87aaa31 --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest.java @@ -0,0 +1,4 @@ +package com.uottawa.olympus.olympusservices; + +public class ServiceTest { +} diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest2.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest2.java new file mode 100644 index 0000000..9c035be --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/ServiceTest2.java @@ -0,0 +1,4 @@ +package com.uottawa.olympus.olympusservices; + +public class ServiceTest2 { +} diff --git a/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java new file mode 100644 index 0000000..1b4af49 --- /dev/null +++ b/OlympusServices/app/src/androidTest/java/com/uottawa/olympus/olympusservices/SignUpTest.java @@ -0,0 +1,64 @@ +package com.uottawa.olympus.olympusservices; + +import android.support.test.rule.ActivityTestRule; +import android.support.test.runner.AndroidJUnit4; +import android.widget.TextView; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static android.support.test.espresso.Espresso.onData; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.action.ViewActions.click; +import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard; +import static android.support.test.espresso.action.ViewActions.typeText; +import static android.support.test.espresso.matcher.ViewMatchers.withId; +import static android.support.test.espresso.matcher.ViewMatchers.withSpinnerText; +import static java.util.regex.Pattern.matches; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.core.AllOf.allOf; +import static org.junit.Assert.*; + +@RunWith(AndroidJUnit4.class) +public class SignUpTest { + + @Rule + public ActivityTestRule mActivityTestRule = new ActivityTestRule(SignUp.class); + private SignUp mActivity=null; + private TextView text; + + @Before + public void setUp() throws Exception { + mActivity = mActivityTestRule.getActivity(); + } + + @Test + public void checkSignUp1() throws Exception{ + onView(withId(R.id.UsernameInput)).perform(typeText("John123"), closeSoftKeyboard()); + onView(withId(R.id.PasswordInput)).perform(typeText("1234567890"), closeSoftKeyboard()); + onView(withId(R.id.FirstNameInput)).perform(typeText("John"), closeSoftKeyboard()); + onView(withId(R.id.LastNameInput)).perform(typeText("Doe"), closeSoftKeyboard()); + onView(withId(R.id.SignUp)).perform(click()); + } + + @Test + public void checkSignUp2() throws Exception{ + onView(withId(R.id.RoleInput)).perform(click()); + onData(allOf(is(instanceOf(String.class)), is("Service Provider"))).perform(click()); + onView(withId(R.id.UsernameInput)).perform(typeText("Service123"), closeSoftKeyboard()); + onView(withId(R.id.PasswordInput)).perform(typeText("1234567890"), closeSoftKeyboard()); + onView(withId(R.id.FirstNameInput)).perform(typeText("Jane"), closeSoftKeyboard()); + onView(withId(R.id.LastNameInput)).perform(typeText("Doe"), closeSoftKeyboard()); + onView(withId(R.id.SignUp)).perform(click()); + } + + @After + public void tearDown() throws Exception { + mActivity=null; + } +} \ No newline at end of file