ActivitiesActivityIT.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. *
  3. * Nextcloud Android client application
  4. *
  5. * @author Tobias Kaminsky
  6. * Copyright (C) 2020 Tobias Kaminsky
  7. * Copyright (C) 2020 Nextcloud GmbH
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. */
  22. package com.nextcloud.client;
  23. import android.view.View;
  24. import com.owncloud.android.AbstractIT;
  25. import com.owncloud.android.R;
  26. import com.owncloud.android.ui.activities.ActivitiesActivity;
  27. import com.owncloud.android.utils.ScreenshotTest;
  28. import org.junit.Rule;
  29. import org.junit.Test;
  30. import org.junit.rules.TestRule;
  31. import androidx.test.espresso.contrib.DrawerActions;
  32. import androidx.test.espresso.intent.rule.IntentsTestRule;
  33. import static androidx.test.espresso.Espresso.onView;
  34. import static androidx.test.espresso.matcher.ViewMatchers.withId;
  35. public class ActivitiesActivityIT extends AbstractIT {
  36. @Rule public IntentsTestRule<ActivitiesActivity> activityRule = new IntentsTestRule<>(ActivitiesActivity.class,
  37. true,
  38. false);
  39. @Rule
  40. public final TestRule permissionRule = GrantStoragePermissionRule.grant();
  41. @Test
  42. @ScreenshotTest
  43. public void openDrawer() {
  44. ActivitiesActivity sut = activityRule.launchActivity(null);
  45. shortSleep();
  46. onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
  47. sut.runOnUiThread(() -> {
  48. sut.getBinding().emptyList.emptyListView.setVisibility(View.VISIBLE);
  49. sut.getBinding().list.setVisibility(View.INVISIBLE);
  50. });
  51. waitForIdleSync();
  52. screenshot(sut);
  53. }
  54. }