Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into group6_C2
Browse files Browse the repository at this point in the history
  • Loading branch information
pranjalesh authored Nov 27, 2023
2 parents 0e79d43 + f6ee7bb commit a0d835e
Show file tree
Hide file tree
Showing 52 changed files with 1,497 additions and 47 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ apply plugin: 'org.sonarqube'

sonarqube {
properties {
property "sonar.projectName", "Group 8 SOEN 6431"
property "sonar.projectKey", "Group-8-SOEN-6431"
property "sonar.projectName", "Group 11 SOEN 6431"
property "sonar.projectKey", "Group-11-SOEN-6431"
property "sonar.host.url", "http://localhost:9000"
property "sonar.login", "sqp_7f8adc6706b839b752be96c5d687384252602ab5"
}
Expand Down
Binary file added src/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@

import androidx.test.espresso.DataInteraction;
import androidx.test.espresso.ViewInteraction;
import androidx.test.filters.LargeTest;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;

import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.pressBack;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.*;
import static androidx.test.espresso.assertion.ViewAssertions.*;
import static androidx.test.espresso.matcher.ViewMatchers.*;

import de.dennisguse.opentracks.debug.R;

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anything;
import static org.hamcrest.Matchers.is;

@LargeTest
@RunWith(AndroidJUnit4.class)
public class IntroductionActivityTest {

@Rule
public ActivityScenarioRule<IntroductionActivity> mActivityScenarioRule =
new ActivityScenarioRule<>(IntroductionActivity.class);

@Test
public void introductionActivityTest() {
ViewInteraction floatingActionButton = onView(
allOf(withId(R.id.track_list_fab_action), withContentDescription("Record"),
childAtPosition(
childAtPosition(
withId(android.R.id.content),
0),
3),
isDisplayed()));
floatingActionButton.perform(click());

ViewInteraction textView = onView(
allOf(withId(android.R.id.text1), withText("Speed"),
withParent(allOf(IsInstanceOf.<View>instanceOf(android.widget.ListView.class),
withParent(IsInstanceOf.<View>instanceOf(android.widget.FrameLayout.class)))),
isDisplayed()));
textView.check(matches(withText("Speed")));

ViewInteraction textView2 = onView(
allOf(withId(android.R.id.text1), withText("Heart Rate"),
withParent(allOf(IsInstanceOf.<View>instanceOf(android.widget.ListView.class),
withParent(IsInstanceOf.<View>instanceOf(android.widget.FrameLayout.class)))),
isDisplayed()));
textView2.check(matches(withText("Heart Rate")));

ViewInteraction textView3 = onView(
allOf(withId(android.R.id.text1), withText("Distance"),
withParent(allOf(IsInstanceOf.<View>instanceOf(android.widget.ListView.class),
withParent(IsInstanceOf.<View>instanceOf(android.widget.FrameLayout.class)))),
isDisplayed()));
textView3.check(matches(withText("Distance")));
}

private static Matcher<View> childAtPosition(
final Matcher<View> parentMatcher, final int position) {

return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
description.appendText("Child at position " + position + " in parent ");
parentMatcher.describeTo(description);
}

@Override
public boolean matchesSafely(View view) {
ViewParent parent = view.getParent();
return parent instanceof ViewGroup && parentMatcher.matches(parent)
&& view.equals(((ViewGroup) parent).getChildAt(position));
}
};
}
}
Binary file added src/main/.DS_Store
Binary file not shown.
Binary file added src/main/java/.DS_Store
Binary file not shown.
Binary file added src/main/java/de/.DS_Store
Binary file not shown.
Binary file added src/main/java/de/dennisguse/.DS_Store
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit a0d835e

Please sign in to comment.