Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Test: Login Button UI Test Completed #16

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ dependencies {
implementation libs.google.firebase.firestore
implementation libs.recyclerview

// androidTestImplementation libs.espresso.core.v340
// androidTestImplementation libs.espresso.intents
// androidTestImplementation libs.runner
// androidTestImplementation libs.rules
// androidTestImplementation libs.firebase.auth.v2101
// testImplementation libs.mockito.core
// androidTestImplementation libs.mockito.android
// androidTestImplementation libs.byte.buddy.android
// androidTestImplementation libs.byte.buddy.agent
// androidTestImplementation libs.espresso.idling.resource
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'




Expand Down
46 changes: 46 additions & 0 deletions app/src/androidTest/java/com/example/notemania/logintestUI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.example.notemania;

import androidx.test.espresso.Espresso;
import androidx.test.espresso.action.ViewActions;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public class logintestUI {
@Rule
public ActivityScenarioRule<MainActivity> activityScenarioRule = new ActivityScenarioRule<>(MainActivity.class);

@Test
public void testwithoutinputs()
{
Espresso.onView(ViewMatchers.withId(R.id.login)).perform(ViewActions.click());
Espresso.onView(ViewMatchers.withText("All fields are required"));
}
@Test
public void testwithoutemail()
{
Espresso.onView(ViewMatchers.withId(R.id.loginemail)).perform(ViewActions.typeText(""));
Espresso.onView(ViewMatchers.withText("All fields are required"));
}
@Test
public void testwithoutpass()
{
Espresso.onView(ViewMatchers.withId(R.id.loginpassword)).perform(ViewActions.typeText(""));
Espresso.onView(ViewMatchers.withText("All fields are required"));
}
@Test
public void testwithallinputs()
{
Espresso.onView(ViewMatchers.withId(R.id.loginemail)).perform(ViewActions.typeText("[email protected]"));
Espresso.onView(ViewMatchers.withId(R.id.loginpassword)).perform(ViewActions.typeText("test"));
Espresso.onView(ViewMatchers.withText("Logged In"));
}



}
9 changes: 1 addition & 8 deletions app/src/main/java/com/example/notemania/signup.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,15 @@
import android.widget.TextView;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;

import org.w3c.dom.Text;

import java.util.Objects;

public class signup extends AppCompatActivity {

private EditText msignupemail,msignuppassword;
Expand Down Expand Up @@ -67,6 +59,7 @@ public void onClick(View v) {
String password=msignuppassword.getText().toString().trim();

if(mail.isEmpty() || password.isEmpty()){
//Log.d("signup","Button");
Toast.makeText(getApplicationContext(),"All fields are required",Toast.LENGTH_SHORT).show();
}
else if(password.length()<7){
Expand Down
17 changes: 17 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[versions]
agp = "8.4.1"
byteBuddyAgent = "1.12.5"
espressoCoreVersion = "3.4.0"
firebaseAuthVersion = "latest_version"
firebaseFirestoreVersion = "latest_version"
firebaseuiFirebaseUiFirestore = "8.0.2"
firebaseUiFirestore = "4.1.0"
firebaseUiFirestoreVersion = "latest_version"
googleFirebaseAuth = "21.0.1"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
Expand All @@ -15,9 +18,19 @@ constraintlayout = "2.1.4"
googleGmsGoogleServices = "4.4.1"
firebaseAuth = "23.0.0"
firebaseFirestore = "25.0.0"
mockitoAndroid = "4.1.0"
mockitoCore = "4.1.0"
recyclerview = "1.3.2"
rules = "1.5.0"
runner = "1.5.2"

[libraries]
byte-buddy-agent = { module = "net.bytebuddy:byte-buddy-agent", version.ref = "byteBuddyAgent" }
byte-buddy-android = { module = "net.bytebuddy:byte-buddy-android", version.ref = "byteBuddyAgent" }
espresso-core-v340 = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCoreVersion" }
espresso-idling-resource = { module = "androidx.test.espresso:espresso-idling-resource", version.ref = "espressoCoreVersion" }
espresso-intents = { module = "androidx.test.espresso:espresso-intents", version.ref = "espressoCoreVersion" }
firebase-auth-v2101 = { module = "com.google.firebase:firebase-auth", version.ref = "googleFirebaseAuth" }
firebase-auth-vlatestversion = { module = "com.google.firebase:firebase-auth", version.ref = "firebaseAuthVersion" }
firebase-firestore-vlatestversion = { module = "com.google.firebase:firebase-firestore", version.ref = "firebaseFirestoreVersion" }
firebase-ui-firestore = { module = "com.firebaseui:firebase-ui-firestore", version.ref = "firebaseUiFirestore" }
Expand All @@ -33,7 +46,11 @@ activity = { group = "androidx.activity", name = "activity", version.ref = "acti
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
firebase-auth = { group = "com.google.firebase", name = "firebase-auth", version.ref = "firebaseAuth" }
firebase-firestore = { group = "com.google.firebase", name = "firebase-firestore", version.ref = "firebaseFirestore" }
mockito-android = { module = "org.mockito:mockito-android", version.ref = "mockitoAndroid" }
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoCore" }
recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" }
rules = { module = "androidx.test:rules", version.ref = "rules" }
runner = { module = "androidx.test:runner", version.ref = "runner" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down
Loading