0
所以,我有一個測試,通過我的整個應用程序。現在,我想拍攝一切。由於它有2個活動和大量的片段,所以我無法完成它的工作,因爲它只需要每個活動的第一個片段。勺子和濃咖啡測試
我怎樣才能實現我拍攝的每一個片段?
@RunWith(AndroidJUnit4.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class HearthBeatUITest {
private final int MILISECONDS_TIMEOUT = 700;
@Rule
public ActivityTestRule<IntroActivity> mActivityRule = new ActivityTestRule<>(IntroActivity.class);
@Rule
public ActivityTestRule<LoginActivity> mLoginActivityRule = new ActivityTestRule<>(LoginActivity.class);
@Test
/**
* Testing all the screens on the application if they are actually there
*/
public void startTest() {
Session.clear();
Spoon.screenshot(mActivityRule.getActivity(), "initial_state");
threadSleep(MILISECONDS_TIMEOUT);
onView(withId(R.id.button_register)).check(matches(isDisplayed())).perform(click());
threadSleep(MILISECONDS_TIMEOUT);
Spoon.screenshot(mLoginActivityRule.getActivity(), "register_intro");
onView(withId(R.id.register_with_email)).check(matches(isDisplayed())).perform(click());
threadSleep(MILISECONDS_TIMEOUT);
Spoon.screenshot(mLoginActivityRule.getActivity(), "register_detailed");
onView(withId(R.id.image_left_button)).check(matches(isDisplayed())).perform(click());
threadSleep(MILISECONDS_TIMEOUT);
Spoon.screenshot(mLoginActivityRule.getActivity(), "register_intro");
onView(withId(R.id.image_left_button)).check(matches(isDisplayed())).perform(click());
threadSleep(MILISECONDS_TIMEOUT);
Spoon.screenshot(mActivityRule.getActivity(), "initial_state");
onView(withId(R.id.button_signin)).check(matches(isDisplayed())).perform(click());
threadSleep(MILISECONDS_TIMEOUT);
Spoon.screenshot(mLoginActivityRule.getActivity(), "login_intro");
onView(withId(R.id.sign_in_emal)).check(matches(isDisplayed())).perform(click());
threadSleep(MILISECONDS_TIMEOUT);
Spoon.screenshot(mLoginActivityRule.getActivity(), "login_detailed");
}
}
你的片段是否有動畫?刪除動畫並關閉開發設置中的動畫。 – WenChao