mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
attempt to get gridview test more reliable
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
0fae1b7ba3
commit
0a95210d7b
1 changed files with 14 additions and 4 deletions
|
@ -8,8 +8,7 @@ import com.owncloud.android.operations.common.SyncOperation;
|
|||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.ui.activity.SettingsActivity;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
|
@ -19,6 +18,7 @@ import org.junit.runners.JUnit4;
|
|||
|
||||
import androidx.test.core.app.ActivityScenario;
|
||||
import androidx.test.espresso.Espresso;
|
||||
import androidx.test.espresso.NoActivityResumedException;
|
||||
import androidx.test.espresso.action.ViewActions;
|
||||
import androidx.test.espresso.contrib.DrawerActions;
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions;
|
||||
|
@ -56,19 +56,29 @@ public class ScreenshotsIT extends AbstractIT {
|
|||
public void gridViewScreenshot() throws InterruptedException {
|
||||
ActivityScenario.launch(FileDisplayActivity.class);
|
||||
|
||||
Espresso.openContextualActionModeOverflowMenu();
|
||||
openOverflowMenu();
|
||||
onView(anyOf(withText(R.string.action_switch_grid_view), withId(R.id.action_switch_view))).perform(click());
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
Screengrab.screenshot("01_gridView");
|
||||
|
||||
Espresso.openContextualActionModeOverflowMenu();
|
||||
openOverflowMenu();
|
||||
onView(anyOf(withText(R.string.action_switch_list_view), withId(R.id.action_switch_view))).perform(click());
|
||||
|
||||
Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
|
||||
private void openOverflowMenu() throws InterruptedException {
|
||||
try {
|
||||
Espresso.openContextualActionModeOverflowMenu();
|
||||
} catch (NoActivityResumedException e) {
|
||||
ActivityScenario.launch(FileDisplayActivity.class);
|
||||
Thread.sleep(1000);
|
||||
Espresso.openContextualActionModeOverflowMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void listViewScreenshot() {
|
||||
String path = "/Camera/";
|
||||
|
|
Loading…
Reference in a new issue