mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 02:17:43 +03:00
move disabled tests to its own package
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
1c8daeb0f7
commit
ebdd4207ed
3 changed files with 170 additions and 170 deletions
131
src/androidTest/disabledTests/screenshots/ScreenshotsIT.java
Normal file
131
src/androidTest/disabledTests/screenshots/ScreenshotsIT.java
Normal file
|
@ -0,0 +1,131 @@
|
|||
package com.owncloud.android.screenshots;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.test.espresso.Espresso;
|
||||
import android.support.test.espresso.action.ViewActions;
|
||||
import android.support.test.espresso.contrib.DrawerActions;
|
||||
import android.support.test.espresso.matcher.PreferenceMatchers;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.ui.activity.Preferences;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
import tools.fastlane.screengrab.Screengrab;
|
||||
import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy;
|
||||
import tools.fastlane.screengrab.locale.LocaleTestRule;
|
||||
|
||||
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.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.Matchers.anything;
|
||||
import static org.hamcrest.core.AnyOf.anyOf;
|
||||
|
||||
@RunWith(JUnit4.class)
|
||||
public class ScreenshotsIT {
|
||||
@ClassRule
|
||||
public static final LocaleTestRule localeTestRule = new LocaleTestRule();
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<FileDisplayActivity> fileDisplayRule = new ActivityTestRule<>(FileDisplayActivity.class);
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<Preferences> preferencesRule = new ActivityTestRule<>(Preferences.class, true, false);
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() {
|
||||
Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gridViewScreenshot() throws InterruptedException {
|
||||
fileDisplayRule.launchActivity(new Intent());
|
||||
|
||||
Espresso.openContextualActionModeOverflowMenu();
|
||||
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();
|
||||
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
|
||||
}
|
||||
|
||||
@Test
|
||||
public void listViewScreenshot() throws InterruptedException {
|
||||
fileDisplayRule.launchActivity(new Intent());
|
||||
|
||||
// go into work folder
|
||||
onData(anything()).inAdapterView(withId(R.id.list_root)).atPosition(0).perform(click());
|
||||
|
||||
Screengrab.screenshot("02_listView");
|
||||
|
||||
Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
|
||||
@Test
|
||||
public void drawerScreenshot() throws InterruptedException {
|
||||
fileDisplayRule.launchActivity(new Intent());
|
||||
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
|
||||
Screengrab.screenshot("03_drawer");
|
||||
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
|
||||
|
||||
Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleAccountsScreenshot() throws InterruptedException {
|
||||
fileDisplayRule.launchActivity(new Intent());
|
||||
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
onView(withId(R.id.drawer_active_user)).perform(click());
|
||||
|
||||
Screengrab.screenshot("04_accounts");
|
||||
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
|
||||
|
||||
Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoUploadScreenshot() throws InterruptedException {
|
||||
fileDisplayRule.launchActivity(new Intent());
|
||||
|
||||
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
onView(anyOf(withText(R.string.drawer_synced_folders), withId(R.id.nav_synced_folders))).perform(click());
|
||||
|
||||
Screengrab.screenshot("05_autoUpload");
|
||||
|
||||
Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
|
||||
@Test
|
||||
public void davdroidScreenshot() throws InterruptedException {
|
||||
preferencesRule.launchActivity(new Intent());
|
||||
|
||||
onData(PreferenceMatchers.withTitle(R.string.prefs_category_more)).perform(ViewActions.scrollTo());
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
Screengrab.screenshot("06_davdroid");
|
||||
|
||||
Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
}
|
||||
}
|
|
@ -65,51 +65,51 @@ public class InitialTest {
|
|||
/**
|
||||
* Start Nextcloud app
|
||||
*/
|
||||
// @Test
|
||||
// public void startAppFromHomeScreen() {
|
||||
// // Perform a short press on the HOME button
|
||||
// mDevice.pressHome();
|
||||
//
|
||||
// // Wait for launcher
|
||||
// final String launcherPackage = getLauncherPackageName();
|
||||
// assertThat(launcherPackage, notNullValue());
|
||||
// mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT);
|
||||
//
|
||||
// // Launch the app
|
||||
// Context context = InstrumentationRegistry.getContext();
|
||||
// final Intent intent = context.getPackageManager()
|
||||
// .getLaunchIntentForPackage(OWNCLOUD_APP_PACKAGE);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
// context.startActivity(intent);
|
||||
//
|
||||
// // Wait for the app to appear
|
||||
// mDevice.wait(Until.hasObject(By.pkg(OWNCLOUD_APP_PACKAGE).depth(0)), LAUNCH_TIMEOUT);
|
||||
// }
|
||||
@Test
|
||||
public void startAppFromHomeScreen() {
|
||||
// Perform a short press on the HOME button
|
||||
mDevice.pressHome();
|
||||
|
||||
// Wait for launcher
|
||||
final String launcherPackage = getLauncherPackageName();
|
||||
assertThat(launcherPackage, notNullValue());
|
||||
mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT);
|
||||
|
||||
// Launch the app
|
||||
Context context = InstrumentationRegistry.getContext();
|
||||
final Intent intent = context.getPackageManager()
|
||||
.getLaunchIntentForPackage(OWNCLOUD_APP_PACKAGE);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivity(intent);
|
||||
|
||||
// Wait for the app to appear
|
||||
mDevice.wait(Until.hasObject(By.pkg(OWNCLOUD_APP_PACKAGE).depth(0)), LAUNCH_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Settings app
|
||||
*
|
||||
* @throws UiObjectNotFoundException
|
||||
*/
|
||||
// @Test
|
||||
// public void startSettingsFromHomeScreen() throws UiObjectNotFoundException {
|
||||
//
|
||||
// mDevice.pressHome();
|
||||
//
|
||||
// // Wait for launcher
|
||||
// final String launcherPackage = getLauncherPackageName();
|
||||
// assertThat(launcherPackage, notNullValue());
|
||||
// mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT);
|
||||
//
|
||||
// // Launch the app
|
||||
// Context context = InstrumentationRegistry.getContext();
|
||||
// final Intent intent = context.getPackageManager()
|
||||
// .getLaunchIntentForPackage(ANDROID_SETTINGS_PACKAGE);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
// context.startActivity(intent);
|
||||
//
|
||||
// clickByText(SETTINGS_DATA_USAGE_OPTION);
|
||||
// }
|
||||
@Test
|
||||
public void startSettingsFromHomeScreen() throws UiObjectNotFoundException {
|
||||
|
||||
mDevice.pressHome();
|
||||
|
||||
// Wait for launcher
|
||||
final String launcherPackage = getLauncherPackageName();
|
||||
assertThat(launcherPackage, notNullValue());
|
||||
mDevice.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT);
|
||||
|
||||
// Launch the app
|
||||
Context context = InstrumentationRegistry.getContext();
|
||||
final Intent intent = context.getPackageManager()
|
||||
.getLaunchIntentForPackage(ANDROID_SETTINGS_PACKAGE);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivity(intent);
|
||||
|
||||
clickByText(SETTINGS_DATA_USAGE_OPTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses package manager to find the package name of the device launcher. Usually this package
|
|
@ -1,131 +0,0 @@
|
|||
//package com.owncloud.android.screenshots;
|
||||
//
|
||||
//import android.content.Intent;
|
||||
//import android.support.test.espresso.Espresso;
|
||||
//import android.support.test.espresso.action.ViewActions;
|
||||
//import android.support.test.espresso.contrib.DrawerActions;
|
||||
//import android.support.test.espresso.matcher.PreferenceMatchers;
|
||||
//import android.support.test.rule.ActivityTestRule;
|
||||
//
|
||||
//import com.owncloud.android.R;
|
||||
//import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
//import com.owncloud.android.ui.activity.Preferences;
|
||||
//
|
||||
//import junit.framework.Assert;
|
||||
//
|
||||
//import org.junit.BeforeClass;
|
||||
//import org.junit.ClassRule;
|
||||
//import org.junit.Rule;
|
||||
//import org.junit.Test;
|
||||
//import org.junit.runner.RunWith;
|
||||
//import org.junit.runners.JUnit4;
|
||||
//
|
||||
//import tools.fastlane.screengrab.Screengrab;
|
||||
//import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy;
|
||||
//import tools.fastlane.screengrab.locale.LocaleTestRule;
|
||||
//
|
||||
//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.matcher.ViewMatchers.withId;
|
||||
//import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
//import static org.hamcrest.Matchers.anything;
|
||||
//import static org.hamcrest.core.AnyOf.anyOf;
|
||||
//
|
||||
//@RunWith(JUnit4.class)
|
||||
//public class ScreenshotsIT {
|
||||
// @ClassRule
|
||||
// public static final LocaleTestRule localeTestRule = new LocaleTestRule();
|
||||
//
|
||||
// @Rule
|
||||
// public ActivityTestRule<FileDisplayActivity> fileDisplayRule = new ActivityTestRule<>(FileDisplayActivity.class);
|
||||
//
|
||||
// @Rule
|
||||
// public ActivityTestRule<Preferences> preferencesRule = new ActivityTestRule<>(Preferences.class, true, false);
|
||||
//
|
||||
// @BeforeClass
|
||||
// public static void beforeAll() {
|
||||
// Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void gridViewScreenshot() throws InterruptedException {
|
||||
// fileDisplayRule.launchActivity(new Intent());
|
||||
//
|
||||
// Espresso.openContextualActionModeOverflowMenu();
|
||||
// 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();
|
||||
// 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
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void listViewScreenshot() throws InterruptedException {
|
||||
// fileDisplayRule.launchActivity(new Intent());
|
||||
//
|
||||
// // go into work folder
|
||||
// onData(anything()).inAdapterView(withId(R.id.list_root)).atPosition(0).perform(click());
|
||||
//
|
||||
// Screengrab.screenshot("02_listView");
|
||||
//
|
||||
// Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void drawerScreenshot() throws InterruptedException {
|
||||
// fileDisplayRule.launchActivity(new Intent());
|
||||
//
|
||||
// onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
//
|
||||
// Screengrab.screenshot("03_drawer");
|
||||
//
|
||||
// onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
|
||||
//
|
||||
// Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void multipleAccountsScreenshot() throws InterruptedException {
|
||||
// fileDisplayRule.launchActivity(new Intent());
|
||||
//
|
||||
// onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
// onView(withId(R.id.drawer_active_user)).perform(click());
|
||||
//
|
||||
// Screengrab.screenshot("04_accounts");
|
||||
//
|
||||
// onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
|
||||
//
|
||||
// Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void autoUploadScreenshot() throws InterruptedException {
|
||||
// fileDisplayRule.launchActivity(new Intent());
|
||||
//
|
||||
// onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
|
||||
// onView(anyOf(withText(R.string.drawer_synced_folders), withId(R.id.nav_synced_folders))).perform(click());
|
||||
//
|
||||
// Screengrab.screenshot("05_autoUpload");
|
||||
//
|
||||
// Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void davdroidScreenshot() throws InterruptedException {
|
||||
// preferencesRule.launchActivity(new Intent());
|
||||
//
|
||||
// onData(PreferenceMatchers.withTitle(R.string.prefs_category_more)).perform(ViewActions.scrollTo());
|
||||
//
|
||||
// Thread.sleep(1000);
|
||||
//
|
||||
// Screengrab.screenshot("06_davdroid");
|
||||
//
|
||||
// Assert.assertTrue(true); // if we reach this, everything is ok
|
||||
// }
|
||||
//}
|
Loading…
Reference in a new issue