Java Code Examples for android.support.test.espresso.ViewAction#wait()

The following examples show how to use android.support.test.espresso.ViewAction#wait() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColumnTest.java    From ChipsLayoutManager with Apache License 2.0 6 votes vote down vote up
@Test
public synchronized void smoothScrollToPosition_ScrollItemIsNotVisible_FirstVisiblePositionsEqualsScrollingTarget() throws Exception {
    //arrange
    InstrumentalUtil.waitForIdle();

    //act
    ViewAction scrollAction = smoothScrollToPosition(18);
    //noinspection SynchronizationOnLocalVariableOrMethodParameter
    synchronized (scrollAction) {
        recyclerView.perform(scrollAction);
        //wait for completion of SmoothScrollAction
        scrollAction.wait();
    }

    //assert
    int actual = layoutManager.findFirstCompletelyVisibleItemPosition();
    assertEquals(18, actual);
}
 
Example 2
Source File: ColumnTest.java    From ChipsLayoutManager with Apache License 2.0 6 votes vote down vote up
@Test
public synchronized void smoothScrollToPosition_ScrollItemIsVisible_ScrollItemDockedToStartBorder() throws Exception {
    //arrange
    InstrumentalUtil.waitForIdle();

    //act
    ViewAction scrollAction = smoothScrollToPosition(3);
    //noinspection SynchronizationOnLocalVariableOrMethodParameter
    synchronized (scrollAction) {
        recyclerView.perform(scrollAction);
        //wait for completion of SmoothScrollAction
        scrollAction.wait();
    }

    //assert
    int actual = layoutManager.findFirstCompletelyVisibleItemPosition();
    assertEquals(3, actual);
}
 
Example 3
Source File: RowTest.java    From ChipsLayoutManager with Apache License 2.0 6 votes vote down vote up
@Test
public synchronized void smoothScrollToPosition_LMInInitialState_FirstVisiblePositionsEqualsScrollingTarget() throws Exception {
    //arrange
    InstrumentalUtil.waitForIdle();

    //act
    ViewAction scrollAction = smoothScrollToPosition(8);
    //noinspection SynchronizationOnLocalVariableOrMethodParameter
    synchronized (scrollAction) {
        recyclerView.perform(scrollAction);
        //wait for completion of SmoothScrollAction
        scrollAction.wait();
    }

    //assert
    int actual = layoutManager.findFirstCompletelyVisibleItemPosition();
    assertEquals(8, actual);
}