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

The following are Jave code examples for showing how to use wait() of the android.support.test.espresso.ViewAction class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ChipsLayoutManager   File: ColumnTest.java   Source Code and License Vote up 6 votes
@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
Project: ChipsLayoutManager   File: ColumnTest.java   Source Code and License Vote up 6 votes
@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
Project: ChipsLayoutManager   File: RowTest.java   Source Code and License Vote up 6 votes
@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);
}