<commit_before>package org.mercycorps.translationcards;

import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mercycorps.translationcards.activity.DecksActivity;

import static android.support.test.espresso.Espresso.closeSoftKeyboard;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.replaceText;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static java.lang.Thread.sleep;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class UserFlow {

    public static final String ORIGIN_TEXT = "Where does it hurt?";
    public static final String TRANSLATION_TEXT = "حيث أنها لا تؤذي؟";
    @Rule
    public ActivityTestRule<DecksActivity> activityTestRule = new ActivityTestRule<>(DecksActivity.class);

    @Test
    public void shouldFindTheDefaultDeck() throws InterruptedException {
        onView(withText("Default")).perform(click());
        onView(withId(R.id.add_button)).perform(click());
        onView(withId(R.id.recording_instructions_start)).perform(click());
        onView(withText("Flashcard phrase")).perform(typeText(ORIGIN_TEXT));
        closeSoftKeyboard();
        onView(withText("Phrase translation (Optional)")).perform(replaceText(TRANSLATION_TEXT));
        onView(withId(R.id.recording_label_next)).perform(click());
        onView(withId(R.id.recording_audio_button_record)).perform(click());
        sleep(2000);
        onView(withId(R.id.recording_audio_button_record)).perform(click());
        onView(withId(R.id.recording_audio_save)).perform(click());
        onView(withText(ORIGIN_TEXT));
        onView(withText(TRANSLATION_TEXT));
        onView(withId(R.id.recording_done)).perform(click());
    }
}<commit_msg>#56 Pav Refactor user flow test and add the step of deleting a card so that there is some kind of test clean up.<commit_after>package org.mercycorps.translationcards;

import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mercycorps.translationcards.activity.DecksActivity;

import static android.support.test.espresso.Espresso.closeSoftKeyboard;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.replaceText;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.PositionAssertions.isRightOf;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static java.lang.Thread.sleep;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class UserFlow {

    public static final String ORIGIN_TEXT = "Where does it hurt?";
    public static final String TRANSLATION_TEXT = "حيث أنها لا تؤذي؟";

    @Rule
    public ActivityTestRule<DecksActivity> activityTestRule = new ActivityTestRule<>(DecksActivity.class);

    @Test
    public void createAndDeleteCardFlow() throws InterruptedException {

        onView(withText("Default")).perform(click());

        onView(withId(R.id.add_button)).perform(click());
        onView(withId(R.id.recording_instructions_start)).perform(click());

        onView(withText("Flashcard phrase")).perform(typeText(ORIGIN_TEXT));
        closeSoftKeyboard();
        onView(withText("Phrase translation (Optional)")).perform(replaceText(TRANSLATION_TEXT));
        onView(withId(R.id.recording_label_next)).perform(click());

        onView(withId(R.id.recording_audio_button_record)).perform(click());
        sleep(2000);
        onView(withId(R.id.recording_audio_button_record)).perform(click());
        onView(withId(R.id.recording_audio_save)).perform(click());

        onView(withId(R.id.origin_translation_text)).check(matches(withText(ORIGIN_TEXT)));
        onView(withId(R.id.translated_text)).check(matches(withText(TRANSLATION_TEXT)));
        onView(withId(R.id.recording_done)).perform(click());

        onView(withId(R.id.indicator_icon)).check(isRightOf(withText(ORIGIN_TEXT))).perform(click());
        onView(withText("Delete this flashcard")).perform(click());
        onView(withText("OK")).perform(click());
    }
}
{'fraction_non_alphanumeric': 0.12007314099959367, 'fraction_numerical': 0.0028443722064201544, 'mean_word_length': 5.418513689700131, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3317036', 'n_tokens_mistral': 1529, 'n_tokens_neox': 1504, 'n_words': 218}