// Path: presentation/src/androidTest/java/presentation/common/BaseTest.java
// @RunWith(AndroidJUnit4.class)
// public abstract class BaseTest {
//     public static final long SHORT_WAIT = 1000;
//     public static final long MEDIUM_WAIT = 2500;
//     public static final long LONG_WAIT = 5000;
// 
//     public static void shortWait() {
//         waitTime(SHORT_WAIT);
//     }
// 
//     public static void mediumWait() {
//         waitTime(MEDIUM_WAIT);
//     }
// 
//     public static void longWait() {
//         waitTime(LONG_WAIT);
//     }
// 
//     private static void waitTime(long time) {
//         try {Thread.sleep(time);
//         } catch (InterruptedException e) { e.printStackTrace();}
//     }
// 
//     @Rule public ActivityTestRule<LaunchActivity> mActivityRule = new ActivityTestRule<>(LaunchActivity.class);
// 
//     @Before public void init() {}
// 
//     protected Activity getCurrentActivity() {
//         BaseApp app = (BaseApp) InstrumentationRegistry.getTargetContext().getApplicationContext();
//         return app.getLiveActivity();
//     }
// 
//     protected void takeScreenShot(String name) {
//         try {
//             Spoon.screenshot(getCurrentActivity(), name);
//         } catch (Exception ignore){}
//     }
// }
// 
// Path: presentation/src/androidTest/java/presentation/common/ViewActions.java
// public static ViewAction actionCloseDrawer() {
//     return new ViewAction() {
//         @Override public Matcher<View> getConstraints() {
//             return isAssignableFrom(DrawerLayout.class);
//         }
// 
//         @Override public String getDescription() {
//             return "close drawer";
//         }
// 
//         @Override public void perform(UiController uiController, View view) {
//             ((DrawerLayout) view).closeDrawer(GravityCompat.START);
//         }
//     };
// }
// 
// Path: presentation/src/androidTest/java/presentation/common/ViewActions.java
// public static ViewAction actionOpenDrawer() {
//     return new ViewAction() {
//         @Override public Matcher<View> getConstraints() {
//             return isAssignableFrom(DrawerLayout.class);
//         }
// 
//         @Override public String getDescription() {
//             return "open drawer";
//         }
// 
//         @Override public void perform(UiController uiController, View view) {
//             ((DrawerLayout) view).openDrawer(GravityCompat.START);
//         }
//     };
// }


import android.support.test.espresso.contrib.RecyclerViewActions;
import org.junit.Test;
import base.app.android.R;
import presentation.common.BaseTest;
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.withId;
import static presentation.common.ViewActions.actionCloseDrawer;
import static presentation.common.ViewActions.actionOpenDrawer;
/*
 * Copyright 2015 RefineriaWeb
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package presentation.sections.dashboard;





public class DashboardTest extends BaseTest {

    @Test public void Open_And_Close_Users() {
        onView(withId(R.id.drawer_layout)).perform(actionOpenDrawer());
        mediumWait();
        onView(withId(R.id.rv_menu_items)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));

        takeScreenShot("Users");
        onView(withId(R.id.drawer_layout)).perform(actionCloseDrawer());
    }

    @Test public void Open_And_Close_User() {
        onView(withId(R.id.drawer_layout)).perform(actionOpenDrawer());
        mediumWait();

        onView(withId(R.id.rv_menu_items)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));

        takeScreenShot("User");
// Path: presentation/src/androidTest/java/presentation/common/BaseTest.java
// @RunWith(AndroidJUnit4.class)
// public abstract class BaseTest {
//     public static final long SHORT_WAIT = 1000;
//     public static final long MEDIUM_WAIT = 2500;
//     public static final long LONG_WAIT = 5000;
// 
//     public static void shortWait() {
//         waitTime(SHORT_WAIT);
//     }
// 
//     public static void mediumWait() {
//         waitTime(MEDIUM_WAIT);
//     }
// 
//     public static void longWait() {
//         waitTime(LONG_WAIT);
//     }
// 
//     private static void waitTime(long time) {
//         try {Thread.sleep(time);
//         } catch (InterruptedException e) { e.printStackTrace();}
//     }
// 
//     @Rule public ActivityTestRule<LaunchActivity> mActivityRule = new ActivityTestRule<>(LaunchActivity.class);
// 
//     @Before public void init() {}
// 
//     protected Activity getCurrentActivity() {
//         BaseApp app = (BaseApp) InstrumentationRegistry.getTargetContext().getApplicationContext();
//         return app.getLiveActivity();
//     }
// 
//     protected void takeScreenShot(String name) {
//         try {
//             Spoon.screenshot(getCurrentActivity(), name);
//         } catch (Exception ignore){}
//     }
// }
// 
// Path: presentation/src/androidTest/java/presentation/common/ViewActions.java
// public static ViewAction actionCloseDrawer() {
//     return new ViewAction() {
//         @Override public Matcher<View> getConstraints() {
//             return isAssignableFrom(DrawerLayout.class);
//         }
// 
//         @Override public String getDescription() {
//             return "close drawer";
//         }
// 
//         @Override public void perform(UiController uiController, View view) {
//             ((DrawerLayout) view).closeDrawer(GravityCompat.START);
//         }
//     };
// }
// 
// Path: presentation/src/androidTest/java/presentation/common/ViewActions.java
// public static ViewAction actionOpenDrawer() {
//     return new ViewAction() {
//         @Override public Matcher<View> getConstraints() {
//             return isAssignableFrom(DrawerLayout.class);
//         }
// 
//         @Override public String getDescription() {
//             return "open drawer";
//         }
// 
//         @Override public void perform(UiController uiController, View view) {
//             ((DrawerLayout) view).openDrawer(GravityCompat.START);
//         }
//     };
// }


// Path: presentation/src/androidTest/java/presentation/sections/dashboard/DashboardTest.java
import android.support.test.espresso.contrib.RecyclerViewActions;
import org.junit.Test;
import base.app.android.R;
import presentation.common.BaseTest;
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.withId;
import static presentation.common.ViewActions.actionCloseDrawer;
import static presentation.common.ViewActions.actionOpenDrawer;

/*
 * Copyright 2015 RefineriaWeb
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package presentation.sections.dashboard;





public class DashboardTest extends BaseTest {

    @Test public void Open_And_Close_Users() {
        onView(withId(R.id.drawer_layout)).perform(actionOpenDrawer());
        mediumWait();
        onView(withId(R.id.rv_menu_items)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));

        takeScreenShot("Users");
        onView(withId(R.id.drawer_layout)).perform(actionCloseDrawer());
    }

    @Test public void Open_And_Close_User() {
        onView(withId(R.id.drawer_layout)).perform(actionOpenDrawer());
        mediumWait();

        onView(withId(R.id.rv_menu_items)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));

        takeScreenShot("User");
        onView(withId(R.id.drawer_layout)).perform(actionCloseDrawer());