AuthenticatorActivityIT.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Nextcloud Android client application
  3. *
  4. * @author Andy Scherzinger
  5. * Copyright (C) 2021 Andy Scherzinger
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. package com.nextcloud.client;
  21. import com.owncloud.android.AbstractIT;
  22. import com.owncloud.android.R;
  23. import com.owncloud.android.authentication.AuthenticatorActivity;
  24. import com.owncloud.android.utils.ScreenshotTest;
  25. import org.junit.Rule;
  26. import org.junit.Test;
  27. import org.junit.rules.TestRule;
  28. import androidx.test.espresso.intent.rule.IntentsTestRule;
  29. import static androidx.test.espresso.Espresso.onView;
  30. import static androidx.test.espresso.action.ViewActions.typeText;
  31. import static androidx.test.espresso.matcher.ViewMatchers.withId;
  32. public class AuthenticatorActivityIT extends AbstractIT {
  33. private static final String URL = "cloud.nextcloud.com";
  34. @Rule public IntentsTestRule<AuthenticatorActivity> activityRule = new IntentsTestRule<>(AuthenticatorActivity.class,
  35. true,
  36. false);
  37. @Rule
  38. public final TestRule permissionRule = GrantStoragePermissionRule.grant();
  39. @Test
  40. @ScreenshotTest
  41. public void login() {
  42. AuthenticatorActivity sut = activityRule.launchActivity(null);
  43. onView(withId(R.id.host_url_input)).perform(typeText(URL));
  44. sut.runOnUiThread(() -> sut.getAccountSetupBinding().hostUrlInput.clearFocus());
  45. screenshot(sut);
  46. }
  47. }