Skip to content

Commit 6c3fa18

Browse files
committed
testing tutorials
1 parent f5d112f commit 6c3fa18

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/src/androidTest/java/com/testingandroid/Tutorial5/GalleryPickerTesting.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.support.test.rule.ActivityTestRule;
1010
import android.support.test.runner.AndroidJUnit4;
1111

12+
import com.testingandroid.R;
1213
import com.testingandroid.login.LoginActivity;
1314

1415
import org.hamcrest.Matcher;
@@ -27,6 +28,7 @@
2728
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
2829
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData;
2930
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
31+
import static android.support.test.espresso.matcher.ViewMatchers.withId;
3032
import static android.support.test.espresso.matcher.ViewMatchers.withText;
3133
import static org.hamcrest.Matchers.allOf;
3234

@@ -53,8 +55,9 @@ public void checkTextOnScreen() {
5355
intending(MediaPickIntent).respondWith(new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));
5456

5557
onView(withText("Gallery")).perform(click());
56-
onView(withText("gallery pick")).perform(click());
58+
onView(withId(R.id.btnGalleryPick)).perform(click());
5759
intended(MediaPickIntent);
60+
//To check the image pick works or not
5861
try{
5962
Thread.sleep(4500);
6063
} catch (InterruptedException e) {

app/src/main/res/layout/activity_gallerypick.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
app:layout_constraintTop_toTopOf="parent"/>
3030

3131
<Button
32-
android:id="@+id/btnLoginButton"
32+
android:id="@+id/btnGalleryPick"
3333
android:layout_width="130dp"
3434
android:layout_height="wrap_content"
3535
android:layout_gravity="center_horizontal"

0 commit comments

Comments
 (0)