Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Try to fix tests
  • Loading branch information
PeterKrcmar0 committed Oct 20, 2018
1 parent 635e574 commit f543b9d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/build.gradle
Expand Up @@ -76,6 +76,7 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation "com.android.support.test.espresso:espresso-intents:3.0.2"
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
}

configurations.all {
Expand All @@ -88,7 +89,7 @@ configurations.all {

}
}

/*
def adb = android.getAdbExe().toString()
tasks.whenTaskAdded { task ->
if (task.name.startsWith('install')) {
Expand All @@ -105,6 +106,7 @@ tasks.whenTaskAdded { task ->
}
}
}
*/

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
Expand Down
Expand Up @@ -162,7 +162,6 @@ public void slideBarCorrectlyUpdatesDifficulty() {
.inRoot(isDialog())
.check(matches(isDisplayed()))
.perform(click());
sleep(500);
onView(withText("Default run time was chosen"))
.inRoot(withDecorView(not(mActivityRule.getActivity().getWindow().getDecorView())))
.check(matches(isDisplayed()));
Expand Down
Expand Up @@ -2,6 +2,7 @@

import android.Manifest;
import android.os.SystemClock;
import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.espresso.intent.Intents;
import android.support.test.rule.ActivityTestRule;
import android.support.test.rule.GrantPermissionRule;
Expand All @@ -21,12 +22,22 @@

import ch.epfl.sweng.runpharaa.tracks.Track;

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.swipeLeft;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.AllOf.allOf;

@RunWith(AndroidJUnit4.class)
public class FavoritesFragmentTest {
Expand Down Expand Up @@ -58,7 +69,8 @@ public void testFavoritesAppears() {
onView(withId(R.id.viewPagerId)).perform(swipeLeft());
onView(withId(R.id.viewPagerId)).perform(swipeLeft());
SystemClock.sleep(5_000);
onView(withId(R.id.cardItemId)).perform(click());
onView(allOf(withId(R.id.cardListId), isDisplayed())).perform(
actionOnItemAtPosition(0, click()));
intended(hasComponent(TrackPropertiesActivity.class.getName()));
}

Expand Down

0 comments on commit f543b9d

Please sign in to comment.