package zlotindaniel.memorize;

import org.junit.Test;

import zlotindaniel.memorize.android.cards.CardsView;
import zlotindaniel.memorize.android.topics.TopicsView;

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.withContentDescription;

public class MemorizeE2ETest extends BaseE2ETest {

	@Test
	public void topicsCardsHappyPath() throws Exception {
		launchApp();
		waitForText(TopicsView.TITLE);

		waitForText("Topic Name 1");
		assertDisplayed("Topic Name 1");
		assertDisplayed("Topic Name 2");
		assertDisplayed("Topic Name 3");

		clickOn("Topic Name 1");

		waitForText(CardsView.TITLE);

		waitForText("Card Question 1");
		assertDisplayed("Card Question 1");
		clickOn("Card Question 1");
		assertDisplayed("Card Answer 1");
		clickOn("Card Answer 1");
		assertDisplayed("Card Question 2");
		clickOn("Card Question 2");
		assertDisplayed("Card Answer 2");
		clickOn("Card Answer 2");
		assertDisplayed("Card Question 3");
		clickOn("Card Question 3");
		assertDisplayed("Card Answer 3");
		clickOn("Card Answer 3");
		assertDisplayed("Card Question 1");
	}

	@Test
	public void accessAdminMode() throws Exception {
		launchApp();
		waitForText(TopicsView.TITLE);
		waitForText("Topic Name 1");

		onView(withContentDescription("More options")).perform(click());
		assertDisplayed(TopicsView.ADMIN_MODE_TITLE);
		clickOn(TopicsView.ADMIN_MODE_TITLE);


	}
}

@@ -164,229 +164,8 @@
 w;%0A%0A
-import static android.support.test.espresso.Espresso.onView;%0Aimport static android.support.test.espresso.action.ViewActions.click;%0Aimport static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;%0A%0A
 publ
@@ -995,305 +995,7 @@
 ;%0A%09%7D
-%0A%0A%09@Test%0A%09public void accessAdminMode() throws Exception %7B%0A%09%09launchApp();%0A%09%09waitForText(TopicsView.TITLE);%0A%09%09waitForText(%22Topic Name 1%22);%0A%0A%09%09onView(withContentDescription(%22More options%22)).perform(click());%0A%09%09assertDisplayed(TopicsView.ADMIN_MODE_TITLE);%0A%09%09clickOn(TopicsView.ADMIN_MODE_TITLE);%0A%0A%0A%09%7D
 %0A%7D%0A

fix e2e