Package-level declarations

Types

Link copied to clipboard

An Application.ActivityLifecycleCallbacks watcher for testedApplication. This class can be used to wait for the activity recreation after calling a function that triggers a configuration change.

Link copied to clipboard

Used to specify the screen size bucket for adaptive UI tests. A bucket is an area that defines a specific range of screen sizes for which UI will be adapted to a single specification. This range can have an upper and lower bound for its supported screen sizes both in the horizontal and vertical dimension and will not overlap other ranges. For testing these bounds are not relevant, but rather a screen size within the area that represents the entire bucket. This default screen size is described by a defaultWidthDp and a defaultHeightDp.

Link copied to clipboard

Used to mark tests which should be ran on an Android 8.1 emulator. Note: Marking tests with this annotation does not exclude them from usual tests suites. Note: Android8Plugin is referring to this annotation by class name.

Link copied to clipboard
annotation class Android8Ignore(val reason: String)

Used to mark tests which should be ignored when ran on an Android 8.1 emulator to allow developers to quickly find ignored tests. Note: Marking tests with this annotation does not exclude them from usual tests suites. Note: Android8Plugin is referring to this annotation by class name.

Link copied to clipboard

Used to mark tests which should be ran on an Android 8.1 emulator only. Note: Marking tests with this annotation does exclude them from usual tests suites. Note: Android8Plugin is referring to this annotation by class name.

Link copied to clipboard
@IviExperimental(reasons = [])
fun interface CreateApiCallback<R>

Callback to invoke a <Service>.createApi() call.

Link copied to clipboard

A JUnit rule that registers an idling resource for all fragment views that use data binding.

Link copied to clipboard
@IviExperimental(reasons = [])
fun interface GetServiceIdsCallback

Callback to invoke a <Service>.getServiceIds() call.

Link copied to clipboard
Link copied to clipboard
@IviExperimental(reasons = [])
abstract class IviActivityTestCase(activityIntent: Intent) : IviFunctionalTestCase

Base class for tests that require an IVI activity to be launched.

Link copied to clipboard

Interface of E2E test case.

Link copied to clipboard
@IviExperimental(reasons = [])
abstract class IviFunctionalTestCase : TtFunctionalTestCase
Link copied to clipboard
@IviExperimental(reasons = [])
class IviServiceApiRule(testLifecycleOwner: LifecycleOwner) : ResourceRule

Provides test access to IVI service APIs instances from the test thread.

Link copied to clipboard

Interface for test case (base) classes that can create IVI service API instances.

Link copied to clipboard
@IviExperimental(reasons = [])
class IviServiceInitialisationRule : ResourceRule

Resets all IVI services within this process. This method facilitates starting with a clean slate between test executions without fully killing the process.

Link copied to clipboard
@IviExperimental(reasons = [])
class LocationSimulationRule(iviServiceApiRule: IviServiceApiRule, initialLocationSimulationDataProvider: InitialLocationSimulationDataProvider?) : ResourceRule

Manages the simulated position during tests.

Link copied to clipboard
typealias OnRootView = ((View?) -> Unit) -> Unit

A typealias of a function that executes another function, providing it with the root view.

Link copied to clipboard
@IviExperimental(reasons = [])
abstract class OnRootViewIdlingResource(onRootView: OnRootView) : IdlingResource

An idling resource that waits for a condition on the app's root view to be satisfied.

Link copied to clipboard
@IviExperimental(reasons = [])
abstract class OnRootViewIdlingResourceRule(onRootView: OnRootView) : ResourceRule

An idling resource rule that waits for a condition on the app's root view to be satisfied.

Link copied to clipboard
class RepeatTestOnExceptionRule(attemptsCount: Int, runBeforeTest: () -> Unit? = null, runAfterTest: () -> Unit? = null) : TestRule

Try running a test at most attemptsCount times, only failing after the last attempt ends with an exception. When an attempt succeeds, no more attempts are made.

Link copied to clipboard
@IviExperimental(reasons = [])
class ScreenSizeRule(bucket: AdaptivenessBucket) : TestRule

Used to fix a test to a specific AdaptivenessBucket when a test depends on the screen size.

Link copied to clipboard
class TraceEventConsumersRule : ResourceRule

Allows tests to create and register a TraceEventConsumer that can be used to verify whether a trace event was generated during a test.

Link copied to clipboard
@IviExperimental(reasons = [])
class TraceEventErrorsListener : RunListener

A JUnit RunListener that catches TraceEvent errors during test execution. And reports these errors to Instrumentation. A test will fail at the end when one or more error events were caught during that test. The error events will be shown in JUnit reports. Any error events that were caught will be cleared before the next test is started.

Link copied to clipboard
@IviExperimental(reasons = [])
data class ViewReference(view: View)

Data class containing a reference to a view. The view is internal by design. If you need access to a view property, use a ViewAction or an ViewAssertion. See TtViewAssertion.

Link copied to clipboard
@IviExperimental(reasons = [])
class ViewShowingIdlingResourceRule : ResourceRule

A JUnit rule that registers an idling resource to wait for a view to be shown or stop being shown using View.isShown.

Properties

Link copied to clipboard

Default timeout for waitForView, tryMultipleTimes, ViewInteraction.waitFor and ViewInteraction.tryMultipleTimes.

Functions

Link copied to clipboard

A ViewAction similar to ViewActions.click, which calls a view's OnClickListener without emitting a touch event. While normally using a touch event is preferred to simulate real user scenarios, there may be situations where touch events have unintended side-effects. In these cases, this action may be used instead.

Link copied to clipboard
@IviExperimental(reasons = [])
fun clickAt(x: Int, y: Int): ViewAction

A ViewAction which clicks at the given x and y coordinates within the view.

Link copied to clipboard
@IviExperimental(reasons = [])
fun injectTap(): ViewAction

ViewAction shortcut to inject a tap on a view without using Espresso's input injection.

Link copied to clipboard
@IviExperimental(reasons = [])
fun longPressKey(keyCode: Int): ViewAction

Returns a ViewAction to long press a given keyCode.

Link copied to clipboard
@IviExperimental(reasons = [])
fun onViewDoesNotExist(viewMatcher: Matcher<View>): ViewInteraction

Checks that not any view matches viewMatcher.

Link copied to clipboard
@IviExperimental(reasons = [])
fun onViewWithText(viewMatcher: Matcher<View>, @StringRes expectedText: Int): ViewInteraction

Returns a ViewInteraction on a view matching viewMatcher and a given expectedText. The expectedText is a string resource ID.

Link copied to clipboard

Returns a ViewAction to record the scroll position of a view.

Link copied to clipboard
@IviExperimental(reasons = [])
fun sameViewReference(viewReference: ViewReference): Matcher<View>

Returns a matcher that matches only when the examined view is the same instance as the view referenced by the specified viewReference.

Link copied to clipboard

Selects an item from a Spinner which matches the given text exactly. Items are matched with a simple Any.toString equality comparison and thus this might not be suitable for complex adapters.

Link copied to clipboard

Selects an item from a Spinner which matches the given textReference exactly. Items are matched with a simple Any.toString equality comparison and thus this might not be suitable for complex adapters.

Link copied to clipboard
@IviExperimental(reasons = [])
fun selectSpinnerPosition(position: Int): ViewAction

Selects position in a Spinner.

Link copied to clipboard

A ViewAction that shows the input method for the given view, focusing the view in the process.

Link copied to clipboard

Taken from ViewActions.swipeLeft to modify the Swiper. This swipe action can be used to scroll the contents of a nested scroll view. Android's default scroll behaviour scrolls a parent when performing a fast swipe, but scroll the nested scroll view when the swipe starts off slow. By using a swipe action that eases in its velocity we can scroll through nested scroll views while still having momentum at the end to reach the end of a list.

Link copied to clipboard

Taken from ViewActions.swipeUp to modify the Swiper. This swipe action can be used to scroll the contents of a nested scroll view. Android's default scroll behaviour scrolls a parent when performing a fast swipe, but scroll the nested scroll view when the swipe starts off slow. By using a swipe action that eases in its velocity we can scroll through nested scroll views while still having momentum at the end to reach the end of a list.

Link copied to clipboard
@IviExperimental(reasons = [])
fun thatIsListItemContent(primaryText: String, secondaryText: String? = null): Matcher<View>
Link copied to clipboard
@IviExperimental(reasons = [])
fun waitForViewAndCheckNotDisplayed(viewMatcher: Matcher<View>): ViewInteraction

Wait for a view to become available and then check that it is not visible.

Link copied to clipboard
@IviExperimental(reasons = [])
fun waitForViewCompletelyDisplayed(viewMatcher: Matcher<View>): ViewInteraction

Wait for a view to be completely displayed.

Link copied to clipboard
@IviExperimental(reasons = [])
fun waitForViewCompletelyDisplayedWithText(viewMatcher: Matcher<View>, @StringRes expectedTextRes: Int): ViewInteraction

Wait for a view to be completely displayed with the given expectedTextRes.

@IviExperimental(reasons = [])
fun waitForViewCompletelyDisplayedWithText(viewMatcher: Matcher<View>, expectedText: String): ViewInteraction

Wait for a view to be completely displayed with the given expectedText.

Link copied to clipboard
inline fun <VM> withViewModel(crossinline viewModelMatcher: (View, VM) -> Boolean): Matcher<View>

A matcher that performs a check on the ViewModel attached to the checked View's data binding.