Skip to content
Open

V3 #1

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
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"Ma réu"


Cette application permet aux collaborateurs de Lamzone de réserver une salle pour une réunion.

Développé sur Android Studio, Java 8, APImax 21.
Fonctions principales

Afficher les différentes réunions
Afficher en détail chacune des réunions
Filtrer ces réunions selon une date ou une salle
Ajouter une réunion
Supprimer une réunion

Installation

Récupérer le programme via le bouton Download ou en utilisant git clone via ce lien https://github.com/SWvp/P4_Formation_OC/tree/v3

Lancer Android Studio, Open/File et choisir le fichier téléchargé

Lancement

Dans Android Studio :

Choisir un émulateur (virtuel ou réel)

Cliquer sur Run

Bibliothèques utilisées

Material.io
RecyclerView
Cardview
CircleImageView
Lifecycle

Junit
Mockito

Architecture

MVVM

Renseignements supplémentaires sur les fonctions présentes

LiveData
Mediator
SingleLiveEvent
646 changes: 646 additions & 0 deletions Test Results - AddMeetingActivityInstrumentedTest.html

Large diffs are not rendered by default.

631 changes: 631 additions & 0 deletions Test Results - DetailsActivityInstrumentedTest.html

Large diffs are not rendered by default.

646 changes: 646 additions & 0 deletions Test Results - MainActivityInstrumentedTest.html

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ android {
}
}

testOptions {
unitTests.returnDefaultValues = true
}


buildTypes {
release {
Expand All @@ -30,29 +34,37 @@ android {
}
}
compileOptions {
coreLibraryDesugaringEnabled true

sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

implementation 'de.hdodenhof:circleimageview:3.1.0'

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.recyclerview:recyclerview:1.2.0-rc01'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'



annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

testImplementation 'junit:junit:4.+'
testImplementation 'android.arch.core:core-testing:1.1.1'
testImplementation 'junit:junit:4.13.2'
//Mockito
testImplementation 'org.mockito:mockito-core:3.8.0'
testImplementation 'org.mockito:mockito-inline:3.8.0'
//Instrumented
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
package com.kardabel.mareu;

import android.widget.DatePicker;
import android.widget.TimePicker;

import androidx.test.core.app.ActivityScenario;
import androidx.test.espresso.ViewAssertion;
import androidx.test.espresso.action.ViewActions;
import androidx.test.espresso.contrib.PickerActions;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.rules.ActivityScenarioRule;

import com.google.android.material.chip.ChipGroup;
import com.kardabel.mareu.ui.add.AddMeetingActivity;
import com.kardabel.mareu.utils.ToastMatcher;

import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import static android.service.autofill.Validators.not;
import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.replaceText;
import static androidx.test.espresso.action.ViewActions.scrollTo;
import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.RootMatchers.withDecorView;
import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static com.kardabel.mareu.utils.RecyclerViewItemCountAssertion.withItemCount;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.core.AllOf.allOf;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;


@RunWith(JUnit4.class)
public class AddMeetingActivityInstrumentedTest {
@Rule
public ActivityScenarioRule<AddMeetingActivity> mActivityScenarioRule =
new ActivityScenarioRule(AddMeetingActivity.class);

@Before
public void launchActivity() { ActivityScenario.launch(AddMeetingActivity.class); }

@Test
public void selected_date_shows_date(){
// When: click on the date text and choose a date via datepicker
onView(ViewMatchers.withId(R.id.date_setter)).perform(scrollTo(), click());
onView(isAssignableFrom(DatePicker.class)).perform(PickerActions.setDate(2021, 06, 12));
onView(withText("OK")).perform(click());
// Then: text shows date picked
onView(withId(R.id.date_setter)).check(matches(allOf(withText("2021-06-12"), isDisplayed())));

}

@Test
public void selected_start_time_shows_hour(){
// When: click on the start time text and choose a time via timepicker
onView(ViewMatchers.withId(R.id.start_time_setter)).perform(scrollTo(), click());
onView(isAssignableFrom(TimePicker.class)).perform(PickerActions.setTime(12, 05));
onView(withText("OK")).perform(click());
// Then: text shows time picked
onView(withId(R.id.start_time_setter)).check(matches(allOf(withText("12:05"), isDisplayed())));

}

@Test
public void selected_end_time_shows_hour(){
// When: click on the end time text and choose a time via timePicker
onView(ViewMatchers.withId(R.id.end_time_setter)).perform(scrollTo(), click());
onView(isAssignableFrom(TimePicker.class)).perform(PickerActions.setTime(14, 21));
onView(withText("OK")).perform(click());
// Then: text shows time picked
onView(withId(R.id.end_time_setter)).check(matches(allOf(withText("14:21"), isDisplayed())));

}

@Test
public void selected_start_time_is_out_of_bound_should_not_display_time(){
// When: click on the start time text and choose a time via timepicker
onView(ViewMatchers.withId(R.id.start_time_setter)).perform(scrollTo(), click());
onView(isAssignableFrom(TimePicker.class)).perform(PickerActions.setTime(05, 00));
onView(withText("OK")).perform(click());
// Then: text don't shows time picked
onView(withId(R.id.start_time_setter)).check(matches(allOf(withText(""), isDisplayed())));

}

@Test
public void selected_end_time_is_out_of_bound_should_not_display_time(){
// When: click on the end time text and choose a time via timepicker
onView(ViewMatchers.withId(R.id.end_time_setter)).perform(scrollTo(), click());
onView(isAssignableFrom(TimePicker.class)).perform(PickerActions.setTime(19, 33));
onView(withText("OK")).perform(click());
// Then: text don't shows time picked
onView(withId(R.id.end_time_setter)).check(matches(allOf(withText(""), isDisplayed())));

}

@Test
public void add_email_button_add_chip_with_email_inside(){
// When: email is added
onView(ViewMatchers.withId(R.id.email_input)).perform(scrollTo(), click());
onView(ViewMatchers.withId(R.id.email_text)).perform(replaceText("test@test.com"));
onView(ViewMatchers.withId(R.id.add_mail_button)).perform(scrollTo(), click());
onView(ViewMatchers.isRoot()).perform(ViewActions.closeSoftKeyboard());
// Then: chipGroup is updated with new email
onView(withId(R.id.mail_chip_model)).check(matches(allOf(withText("test@test.com"), isDisplayed())));

}

@Test
public void add_email_button_show_toast_when_wrong_email_entry(){
// When: email is added
onView(ViewMatchers.withId(R.id.email_input)).perform(scrollTo(), click());
onView(ViewMatchers.withId(R.id.email_text)).perform(replaceText("testtest.com@"));
onView(ViewMatchers.withId(R.id.create)).perform(scrollTo(), click());
onView(ViewMatchers.isRoot()).perform(ViewActions.closeSoftKeyboard());
// Then: chipGroup do not shows email and toast popup

}

@Test
public void save_button_stay_on_addMeeting_activity_when_reunion_is_not_complete(){
// When: click on save button before complete fields
onView(ViewMatchers.withId(R.id.create)).perform(scrollTo(), click());
// Then:
assertFalse(mActivityScenarioRule.getScenario() == null);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package com.kardabel.mareu;

import androidx.test.core.app.ActivityScenario;
import androidx.test.espresso.contrib.RecyclerViewActions;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.kardabel.mareu.ui.list.MainActivity;
import com.kardabel.mareu.utils.ItemViewAction;

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

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;


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

@Before
public void launchActivity() { ActivityScenario.launch(MainActivity.class); }

@Test
public void details_activity_display_neighbour_name(){
// When: click on recyclerview item
onView(ViewMatchers.withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItemAtPosition(2, new ItemViewAction()));
// Then: display meeting name
onView(withId(R.id.detail_meeting_name)).check(matches((withText("Reunion c"))));

}

@Test
public void details_Activity_display_room_name(){
// When: click on recyclerview item
onView(ViewMatchers.withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItemAtPosition(0, new ItemViewAction()));
// Then: display meeting room name
onView(withId(R.id.detail_room_name)).check(matches((withText("Mario"))));

}

@Test
public void details_Activity_display_date(){
// When: click on recyclerview item
onView(ViewMatchers.withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItemAtPosition(1, new ItemViewAction()));
// Then: display meeting date
onView(withId(R.id.detail_date)).check(matches((withText("2021-05-01"))));

}

@Test
public void details_Activity_display_time(){
// When: click on recyclerview item
onView(ViewMatchers.withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItemAtPosition(3, new ItemViewAction()));
// Then: display meeting time
onView(withId(R.id.detail_hour)).check(matches((withText("16:50 to 18:00"))));

}

@Test
public void details_Activity_display_time_with_0_first_number_if_inferior_to_ten(){
// When: click on recyclerview item
onView(ViewMatchers.withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItemAtPosition(1, new ItemViewAction()));
// Then: display meeting time
onView(withId(R.id.detail_hour)).check(matches((withText("09:00 to 11:20"))));

}
}

This file was deleted.

Loading