mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-04 02:09:39 +02:00
Add very basic onboarding and sharing test (#2031)
* Start creating onboarding test * Start adding sharing test * Create very basic sharing test
This commit is contained in:
parent
1b6965e43e
commit
a2ffa4cd5a
7 changed files with 333 additions and 39 deletions
64
androidTest/com/b44t/messenger/SharingTest.java
Normal file
64
androidTest/com/b44t/messenger/SharingTest.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
package com.b44t.messenger;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.test.espresso.contrib.RecyclerViewActions;
|
||||
import androidx.test.ext.junit.rules.ActivityScenarioRule;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.thoughtcrime.securesms.ConversationListActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.ShareActivity;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withHint;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class SharingTest {
|
||||
// ==============================================================================================
|
||||
// PLEASE BACKUP YOUR ACCOUNT BEFORE RUNNING THIS!
|
||||
// ==============================================================================================
|
||||
|
||||
private final static String TAG = SharingTest.class.getSimpleName();
|
||||
|
||||
@Rule
|
||||
public ActivityScenarioRule<ConversationListActivity> activityRule = TestUtils.getOfflineActivityRule();
|
||||
|
||||
@Test
|
||||
public void testNormalSharing() {
|
||||
activityRule.getScenario().onActivity(a -> {
|
||||
DcHelper.getContext(a).createGroupChat(false, "group");
|
||||
});
|
||||
|
||||
Intent i = new Intent(Intent.ACTION_SEND);
|
||||
i.putExtra(Intent.EXTRA_TEXT, "Hello!");
|
||||
i.setComponent(new ComponentName(getInstrumentation().getTargetContext().getApplicationContext(), ShareActivity.class));
|
||||
activityRule.getScenario().onActivity(a -> a.startActivity(i));
|
||||
|
||||
onView(withId(R.id.list)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
|
||||
|
||||
onView(withHint(R.string.chat_input_placeholder)).check(matches(withText("Hello!")));
|
||||
TestUtils.pressSend();
|
||||
}
|
||||
|
||||
// TODO test other things from https://github.com/deltachat/interface/blob/master/user-testing/mailto-links.md
|
||||
|
||||
@After
|
||||
public void cleanup() {
|
||||
TestUtils.cleanup();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue