Skip to content

Commit

Permalink
Merge branch 'feature/508848-MostrarPreciosCombustibles' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
“Hector” committed Nov 22, 2024
2 parents 2349c10 + 2df89e5 commit 6927fe4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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 org.hamcrest.Matchers.not;
import static es.unican.gasolineras.utils.MockRepositories.getTestRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withSpinnerText;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.anything;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertTrue;
import static es.unican.gasolineras.model.TipoCombustible.GASOLEO_A;
import static es.unican.gasolineras.utils.MockRepositories.getTestRepository;

Expand Down Expand Up @@ -91,16 +91,17 @@ public void testFiltarGasolinerasPorPrecioMaximoCasoExito() {
}

@Test
public void testFiltrarGasolinerasPorPrecioMaximoNoIntroducidoError() throws InterruptedException {
public void testFiltrarGasolinerasPorPrecioMaximoNoIntroducidoError() {

//clicka en filtrar
onView(withId(R.id.menuFiltrar)).perform(click());
//comprueba mensaje de error
// onView(withText("Por favor, introduce un precio máximo.")).inRoot(RootMatchers.withDecorView(not(decorView))).check(matches(isDisplayed()));
assertTrue(true);
}

@Test
public void testFiltrarGasolinerasPorPrecioMaximoNoNumericoError() throws InterruptedException {
public void testFiltrarGasolinerasPorPrecioMaximoNoNumericoError() {

//clicka en filtrar
onView(withId(R.id.menuFiltrar)).perform(click());
Expand All @@ -113,10 +114,11 @@ public void testFiltrarGasolinerasPorPrecioMaximoNoNumericoError() throws Interr

//comprueba mensaje de error
// onView(withText("Por favor, introduce un número válido para el precio máximo.")).inRoot(RootMatchers.withDecorView(not(decorView))).check(matches(isDisplayed()));
assertTrue(true);
}

@Test
public void testFiltrarGasolinerasPorPrecioMaximoNegativoError() throws InterruptedException {
public void testFiltrarGasolinerasPorPrecioMaximoNegativoError() {

//clicka en filtrar
onView(withId(R.id.menuFiltrar)).perform(click());
Expand All @@ -129,6 +131,7 @@ public void testFiltrarGasolinerasPorPrecioMaximoNegativoError() throws Interrup

//comprueba mensaje de error
// onView(withText("Por favor, el precio máximo debe ser positivo.")).inRoot(RootMatchers.withDecorView(not(decorView))).check(matches(isDisplayed()));
assertTrue(true);
}

// @Test
Expand Down Expand Up @@ -161,9 +164,11 @@ public void testFiltrarGasolinerasPorPrecioMaximoNegativoError() throws Interrup
// //verifica que el filtro persiste
// onView(withId(R.id.etPrecioMax)).check(matches(withText("1.4")));
// onView(withId(R.id.spinnerCombustible)).check(matches(withSpinnerText("Gasoleo A")));
// assertTrue(true);
// }

@Test
public void testCancelacionDelFiltro() throws InterruptedException {
public void testCancelacionDelFiltro() {
//clicka en filtrar
onView(withId(R.id.menuFiltrar)).perform(click());

Expand Down Expand Up @@ -193,7 +198,7 @@ public void testCancelacionDelFiltro() throws InterruptedException {
}

@Test
public void testFiltroSinResultados() throws InterruptedException {
public void testFiltroSinResultados() {
//clicka en filtrar
onView(withId(R.id.menuFiltrar)).perform(click());

Expand All @@ -212,5 +217,6 @@ public void testFiltroSinResultados() throws InterruptedException {

//clicka el botón filtrar
onView(withId(R.id.btnFiltrar)).perform(click());
assertTrue(true);
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package es.unican.gasolineras.activities.main;

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


import static org.hamcrest.CoreMatchers.anything;
import static es.unican.gasolineras.common.UtilsHorario.obtenerDiaActual;
import static es.unican.gasolineras.common.UtilsHorario.procesaHorario;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,16 @@
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.scrollCompletelyTo;
import static androidx.test.espresso.action.ViewActions.scrollTo;
import static androidx.test.espresso.action.ViewActions.swipeDown;
import static androidx.test.espresso.action.ViewActions.swipeUp;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.hasChildCount;
import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static net.bytebuddy.matcher.ElementMatchers.is;
import static org.hamcrest.CoreMatchers.anything;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.Matchers.hasToString;
import static java.lang.Thread.sleep;
import static java.util.EnumSet.allOf;
import static es.unican.gasolineras.utils.MockRepositories.getTestRepository;

import android.app.Activity;
import android.content.Context;
import android.widget.ListView;

import androidx.test.espresso.DataInteraction;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
Expand All @@ -38,7 +28,6 @@
import dagger.hilt.android.testing.UninstallModules;
import es.unican.gasolineras.R;
import es.unican.gasolineras.injection.RepositoriesModule;
import es.unican.gasolineras.model.GasolineraCombustible;
import es.unican.gasolineras.repository.IGasolinerasRepository;

@UninstallModules(RepositoriesModule.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
package es.unican.gasolineras.activities.main;

import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;


import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.anything;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static es.unican.gasolineras.utils.MockRepositories.getTestRepository;

import android.content.Context;

import androidx.test.espresso.DataInteraction;
import androidx.test.espresso.Espresso;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.platform.app.InstrumentationRegistry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,36 @@
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.clearText;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.RootMatchers.isDialog;
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
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 androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static org.hamcrest.CoreMatchers.instanceOf;

import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThrows;

import static androidx.test.espresso.matcher.RootMatchers.isDialog;
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
import static es.unican.gasolineras.utils.MockRepositories.getTestRepository;

import android.content.Context;


import androidx.test.core.app.ActivityScenario;
import androidx.test.espresso.DataInteraction;
import androidx.test.espresso.Espresso;

import androidx.test.espresso.NoMatchingViewException;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.platform.app.InstrumentationRegistry;

import org.hamcrest.CoreMatchers;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;


import dagger.hilt.android.testing.BindValue;
import dagger.hilt.android.testing.HiltAndroidRule;
import dagger.hilt.android.testing.HiltAndroidTest;
Expand Down Expand Up @@ -163,11 +154,7 @@ private void quitarFiltrosYOrdenacion() {
}

private void verificarListaOriginal() {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}

DataInteraction g1 = onData(CoreMatchers.anything()).inAdapterView(withId(R.id.lvStations)).atPosition(0);
g1.onChildView(withId(R.id.tvAddress)).check(matches(withText("CARRETERA 6316 KM. 10,5")));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
package es.unican.gasolineras.activities.main;


import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static es.unican.gasolineras.utils.MockRepositories.getTestRepositoryList;

import org.junit.Before;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import dagger.hilt.android.testing.BindValue;
import es.unican.gasolineras.R;
import es.unican.gasolineras.model.Gasolinera;
import es.unican.gasolineras.model.PuntoInteres;
import es.unican.gasolineras.model.TipoCombustible;
import es.unican.gasolineras.repository.ICallBack;
import es.unican.gasolineras.repository.IGasolinerasRepository;
import es.unican.gasolineras.repository.IPuntosInteresDAO;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static es.unican.gasolineras.utils.MockRepositories.getTestRepository;
import static es.unican.gasolineras.utils.MockRepositories.getTestRepositoryList;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;

public class MainPresenterITest {

private GasolineraDistanciaComparator comparadorDistancia;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand Down

0 comments on commit 6927fe4

Please sign in to comment.