PositionAssertions


class PositionAssertions


A collection of ViewAssertions for checking relative position of elements on the screen.

These comparisons are on the x,y plane; they ignore the z plane.

Summary

Public functions

java-static ViewAssertion!
isAbove(matcher: Matcher<View!>!)

This function is deprecated.

Use isCompletelyAbove instead.

java-static ViewAssertion!
isBelow(matcher: Matcher<View!>!)

This function is deprecated.

Use isCompletelyBelow instead.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is bottom aligned with the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely above the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely below the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely left of the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely right of the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is left aligned with the view matching the given matcher.

java-static ViewAssertion!
isLeftOf(matcher: Matcher<View!>!)

This function is deprecated.

Use isCompletelyLeftOf instead.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is partially above the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is partially below the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is partially left of the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is partially right of the view matching the given matcher.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is right aligned with the view matching the given matcher.

java-static ViewAssertion!
isRightOf(matcher: Matcher<View!>!)

This function is deprecated.

Use isCompletelyRightOf instead.

java-static ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is top aligned with the view matching the given matcher.

Public functions

isAbove

java-static fun isAbove(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely above the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is any vertical overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isBelow

java-static fun isBelow(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely below the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there any vertical overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isBottomAlignedWith

java-static fun isBottomAlignedWith(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is bottom aligned with the view matching the given matcher.

The bottom 'y' coordinate of the view displayed must equal the bottom 'y' coordinate of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if the views are not aligned bottom.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isCompletelyAbove

java-static fun isCompletelyAbove(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely above the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is any vertical overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isCompletelyBelow

java-static fun isCompletelyBelow(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely below the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is any vertical overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isCompletelyLeftOf

java-static fun isCompletelyLeftOf(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely left of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is any horizontal overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isCompletelyRightOf

java-static fun isCompletelyRightOf(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely right of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is any horizontal overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isLeftAlignedWith

java-static fun isLeftAlignedWith(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is left aligned with the view matching the given matcher.

The left 'x' coordinate of the view displayed must equal the left 'x' coordinate of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if the views are not aligned to the left.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isLeftOf

java-static fun isLeftOf(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely left of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is any horizontal overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isPartiallyAbove

java-static fun isPartiallyAbove(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is partially above the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is no vertical overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isPartiallyBelow

java-static fun isPartiallyBelow(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is partially below the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is no vertical overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isPartiallyLeftOf

java-static fun isPartiallyLeftOf(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is partially left of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is no horizontal overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isPartiallyRightOf

java-static fun isPartiallyRightOf(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is partially right of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is no horizontal overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isRightAlignedWith

java-static fun isRightAlignedWith(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is right aligned with the view matching the given matcher.

The right 'x' coordinate of the view displayed must equal the right 'x' coordinate of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if the views are not aligned to the right.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isRightOf

java-static fun isRightOf(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is completely right of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if there is any horizontal overlap.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.

isTopAlignedWith

java-static fun isTopAlignedWith(matcher: Matcher<View!>!): ViewAssertion!

Returns a ViewAssertion that asserts that view displayed is top aligned with the view matching the given matcher.

The top 'y' coordinate of the view displayed must equal the top 'y' coordinate of the view matching the given matcher.

Throws
junit.framework.AssertionFailedError: junit.framework.AssertionFailedError

if the views are not aligned top.

androidx.test.espresso.AmbiguousViewMatcherException: androidx.test.espresso.AmbiguousViewMatcherException

if more than one view matches the given matcher.

androidx.test.espresso.NoMatchingViewException: androidx.test.espresso.NoMatchingViewException

if no views match the given matcher.