Package com.tomtom.ivi.platform.tools.api.testing.functional

Types

Link copied to clipboard
class ActivityLifecycleWatcher(testedApplication: Application) : Application.ActivityLifecycleCallbacks

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
annotation class Android8

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
annotation class Android8Only

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
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
fun interface GetServiceIdsCallback

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

Link copied to clipboard
typealias InitialLocationSimulationDataProvider = () -> LocationSimulationData?

Callback to obtain the initial LocationSimulationData.

Link copied to clipboard
abstract class IviActivityTestCase(activityIntent: Intent) : IviFunctionalTestCase

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

Link copied to clipboard
interface IviE2eTestCase : IviServiceAwareTestCase

Interface of E2E test case.

Link copied to clipboard
abstract class IviFunctionalTestCase : TtFunctionalTestCase
Link copied to clipboard
class IviServiceApiRule(testLifecycleOwner: LifecycleOwner) : ResourceRule

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

Link copied to clipboard
interface IviServiceAwareTestCase

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

Link copied to clipboard
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
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
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
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 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
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
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
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.

Link copied to clipboard
typealias WebserviceConfigProvider = () -> WebserviceMockRuleConfig
Link copied to clipboard
class WebserviceMockRule(configProvider: WebserviceConfigProvider) : ResourceRule

Starts a WebserviceMockServer before starting a test when the config provided by the configProvider is not empty.

Link copied to clipboard
data class WebserviceMockRuleConfig(    val isCaptureRun: Boolean,     val captureYieldAfterTest: Boolean,     val webserviceMockConfigs: Set<WebserviceMockConfig>)

The config of the WebserviceMockRule.

Link copied to clipboard
class WhitelistTraceEventErrorsRule : ResourceRule

TODO(IVI-8848): Fix trace event errors This rule is a temporary solution to whitelist concrete trace event errors, which popped up after re-enabling TraceEventErrorsListener in tests. After events are fixed, this rule shall be removed.

Properties

Link copied to clipboard
const val DEFAULT_WAIT_FOR_TIMEOUT_MS: Long

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

Functions

Link copied to clipboard
fun callOnClick(): ViewAction

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
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
fun injectTap(): ViewAction

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

Link copied to clipboard
fun longPressKey(keyCode: Int): ViewAction

Returns a ViewAction to long press a given keyCode.

Link copied to clipboard
fun onViewDoesNotExist(viewMatcher: Matcher<View>): ViewInteraction

Checks that not any view matches viewMatcher.

Link copied to clipboard
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
fun recordScrollPosition(recordList: MutableList<Int>): ViewAction

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

Link copied to clipboard
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
fun selectSpinnerItemByText(text: String): ViewAction

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
fun selectSpinnerItemByTextReference(textReference: KProperty<Int>): ViewAction

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
fun selectSpinnerPosition(position: Int): ViewAction

Selects position in a Spinner.

Link copied to clipboard
fun showSoftInput(): ViewAction

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

Link copied to clipboard
fun swipeLeftEaseIn(): ViewAction

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
fun swipeUpEaseIn(): ViewAction

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
fun thatIsListItemContent(primaryText: String, secondaryText: String? = null): Matcher<View>
Link copied to clipboard
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
fun waitForViewCompletelyDisplayed(viewMatcher: Matcher<View>): ViewInteraction

Wait for a view to be completely displayed.

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

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

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.