Skip to content

Commit e4d647e

Browse files
committed
Fixes UI tests failing in landscape
1 parent 367f8f2 commit e4d647e

File tree

1 file changed

+24
-21
lines changed
  • todoapp/app/src/androidTest/java/com/example/android/architecture/blueprints/todoapp/tasks

1 file changed

+24
-21
lines changed

todoapp/app/src/androidTest/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksScreenTest.java

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,6 @@
1616

1717
package com.example.android.architecture.blueprints.todoapp.tasks;
1818

19-
import android.support.test.InstrumentationRegistry;
20-
import android.support.test.rule.ActivityTestRule;
21-
import android.support.test.runner.AndroidJUnit4;
22-
import android.test.suitebuilder.annotation.LargeTest;
23-
import android.text.TextUtils;
24-
import android.view.View;
25-
import android.widget.ListView;
26-
27-
import com.example.android.architecture.blueprints.todoapp.Injection;
28-
import com.example.android.architecture.blueprints.todoapp.R;
29-
import com.example.android.architecture.blueprints.todoapp.TestUtils;
30-
import com.example.android.architecture.blueprints.todoapp.data.source.TasksDataSource;
31-
32-
import org.hamcrest.Description;
33-
import org.hamcrest.Matcher;
34-
import org.hamcrest.TypeSafeMatcher;
35-
import org.junit.Rule;
36-
import org.junit.Test;
37-
import org.junit.runner.RunWith;
38-
3919
import static android.support.test.InstrumentationRegistry.getTargetContext;
4020
import static android.support.test.espresso.Espresso.onView;
4121
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
@@ -53,10 +33,32 @@
5333
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
5434
import static android.support.test.espresso.matcher.ViewMatchers.withId;
5535
import static android.support.test.espresso.matcher.ViewMatchers.withText;
36+
5637
import static com.google.common.base.Preconditions.checkArgument;
38+
5739
import static org.hamcrest.Matchers.allOf;
5840
import static org.hamcrest.core.IsNot.not;
5941

42+
import android.support.test.InstrumentationRegistry;
43+
import android.support.test.rule.ActivityTestRule;
44+
import android.support.test.runner.AndroidJUnit4;
45+
import android.test.suitebuilder.annotation.LargeTest;
46+
import android.text.TextUtils;
47+
import android.view.View;
48+
import android.widget.ListView;
49+
50+
import com.example.android.architecture.blueprints.todoapp.Injection;
51+
import com.example.android.architecture.blueprints.todoapp.R;
52+
import com.example.android.architecture.blueprints.todoapp.TestUtils;
53+
import com.example.android.architecture.blueprints.todoapp.data.source.TasksDataSource;
54+
55+
import org.hamcrest.Description;
56+
import org.hamcrest.Matcher;
57+
import org.hamcrest.TypeSafeMatcher;
58+
import org.junit.Rule;
59+
import org.junit.Test;
60+
import org.junit.runner.RunWith;
61+
6062
/**
6163
* Tests for the tasks screen, the main screen which contains a list of all tasks.
6264
*/
@@ -404,7 +406,8 @@ private void createTask(String title, String description) {
404406
onView(withId(R.id.fab_add_task)).perform(click());
405407

406408
// Add task title and description
407-
onView(withId(R.id.add_task_title)).perform(typeText(title)); // Type new task title
409+
onView(withId(R.id.add_task_title)).perform(typeText(title),
410+
closeSoftKeyboard()); // Type new task title
408411
onView(withId(R.id.add_task_description)).perform(typeText(description),
409412
closeSoftKeyboard()); // Type new task description and close the keyboard
410413

0 commit comments

Comments
 (0)