Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Latest commit

 

History

History
115 lines (99 loc) · 26.6 KB

File metadata and controls

115 lines (99 loc) · 26.6 KB

kakao / com.agoda.kakao.common.views / KBaseView

KBaseView

open class KBaseView<out T> : BaseActions, BaseAssertions, Interceptable<ViewInteraction, ViewAssertion, ViewAction>

Base class for all Kakao views

This base class allows create new custom view with ease. All you have to do is to extend this class, implement all necessarily additional actions/assertions interfaces and override necessary constructors

Parameters

T - Type of your custom view. Needs to be defined to enable invoke() and perform() for descendants

Constructors

Name Summary
<init> KBaseView(function: ViewBuilder.() -> Unit)
Constructs view class with view interaction from given ViewBuilderKBaseView(parent: Matcher<View>, function: ViewBuilder.() -> Unit)
KBaseView(parent: DataInteraction, function: ViewBuilder.() -> Unit)
Constructs view class with parent and view interaction from given ViewBuilder

Properties

Name Summary
root open var root: Matcher<Root>
view open val view: ViewInteractionDelegate

Functions

Name Summary
invoke operator fun invoke(function: T.() -> Unit): Unit
Operator that allows usage of DSL style
perform infix fun perform(function: T.() -> Unit): T
Infix function for invoking lambda on your view

Inherited Functions

Name Summary
act open fun act(function: () -> ViewAction): Unit
Performs custom action on a view
assert open fun assert(function: () -> ViewAssertion): Unit
Check the view with the given custom assertion
click open fun click(location: GeneralLocation = GeneralLocation.VISIBLE_CENTER): Unit
Performs click on view
doesNotExist open fun doesNotExist(): Unit
Checks if the matched view does not exist
doubleClick open fun doubleClick(location: GeneralLocation = GeneralLocation.VISIBLE_CENTER): Unit
Performs double click on view
hasAnyTag open fun hasAnyTag(vararg tags: String): Unit
Checks if the view has at least one of the given tags
hasBackgroundColor open fun hasBackgroundColor(resId: Int): Unit
open fun hasBackgroundColor(colorCode: String): Unit
Checks if the view has given background color
hasDescendant open fun hasDescendant(function: ViewBuilder.() -> Unit): Unit
Checks if the view has given descendant
hasNotDescendant open fun hasNotDescendant(function: ViewBuilder.() -> Unit): Unit
Checks if the view has not given descendant
hasNotSibling open fun hasNotSibling(function: ViewBuilder.() -> Unit): Unit
Checks if the view has not given sibling
hasSibling open fun hasSibling(function: ViewBuilder.() -> Unit): Unit
Checks if the view has given sibling
hasTag open fun hasTag(tag: String): Unit
Checks if the view has given tag
inRoot open fun inRoot(function: RootBuilder.() -> Unit): Unit
Check if the view is in given root
intercept open fun intercept(builder: Interceptor.Builder<INTERACTION, ASSERTION, ACTION>.() -> Unit): Unit
Sets the interceptors for the instance. Interceptors will be invoked on the interaction with the KView.
isClickable open fun isClickable(): Unit
Checks if the view is clickable
isCompletelyAbove open fun isCompletelyAbove(function: ViewBuilder.() -> Unit): Unit
Checks if the view displayed is completely above of the view matching the given matcher.
isCompletelyBelow open fun isCompletelyBelow(function: ViewBuilder.() -> Unit): Unit
Checks if the view displayed is completely below of the view matching the given matcher.
isCompletelyDisplayed open fun isCompletelyDisplayed(): Unit
Checks if the view is completely displayed
isCompletelyLeftOf open fun isCompletelyLeftOf(function: ViewBuilder.() -> Unit): Unit
Checks if the view displayed is completely right of the view matching the given matcher.
isCompletelyRightOf open fun isCompletelyRightOf(function: ViewBuilder.() -> Unit): Unit
Checks if the view displayed is completely right of the view matching the given matcher.
isDisabled open fun isDisabled(): Unit
Checks if the view is disabled
isDisplayed open fun isDisplayed(): Unit
Checks if the view is displayed
isEnabled open fun isEnabled(): Unit
Checks if the view is enabled
isFocusable open fun isFocusable(): Unit
Checks if the view is focusable
isFocused open fun isFocused(): Unit
Checks if the view is focused
isGone open fun isGone(): Unit
Checks if the view has GONE visibility
isInvisible open fun isInvisible(): Unit
Checks if the view has INVISIBLE visibility
isNotClickable open fun isNotClickable(): Unit
Checks if the view is not clickable
isNotCompletelyDisplayed open fun isNotCompletelyDisplayed(): Unit
Checks if the view is not completely displayed
isNotDisplayed open fun isNotDisplayed(): Unit
Checks if the view is not displayed
isNotFocusable open fun isNotFocusable(): Unit
Checks if the view is not focusable
isNotFocused open fun isNotFocused(): Unit
Checks if the view is not focused
isNotSelected open fun isNotSelected(): Unit
Checks if the view is not selected
isSelected open fun isSelected(): Unit
Checks if the view is selected
isVisible open fun isVisible(): Unit
Checks if the view has VISIBLE visibility
longClick open fun longClick(location: GeneralLocation = GeneralLocation.VISIBLE_CENTER): Unit
Performs long click on view
matches open fun matches(function: ViewBuilder.() -> Unit): Unit
Check if the view matches given matcher
notMatches open fun notMatches(function: ViewBuilder.() -> Unit): Unit
Check if the view does not match given matcher
onFailure open fun onFailure(function: (error: Throwable, matcher: Matcher<View>) -> Unit): Unit
Adds failure handler to the view
pressImeAction open fun pressImeAction(): Unit
Presses IME action, if supported view is in focus
repeatUntil open fun repeatUntil(maxAttempts: Int= 1, action: () -> ViewAction, matcher:ViewBuilder.() -> Unit): Unit
Repeats given action on the view until this view will match the given matcher
reset open fun reset(): Unit
Removes the interceptors from the instance.
scrollTo open fun scrollTo(): Unit
Scrolls to the view, if possible

Inheritors

Name Summary
KAlertDialog class KAlertDialog : KBaseView<KAlertDialog>
View for interact with default alert dialog
KBottomNavigationView class KBottomNavigationView : KBaseView<KBottomNavigationView>, BottomNavigationViewActions, BottomNavigationViewAssertions
View for acting and asserting on BottomNavigationView
KButton class KButton : KBaseView<KButton>, TextViewAssertions
View with BaseActions and TextViewAssertions
KCheckBox class KCheckBox : KBaseView<KCheckBox>, CheckableActions, TextViewAssertions, CheckableAssertions
View with CheckableActions, CheckableAssertions and TextViewAssertions
KChipGroup class KChipGroup : KBaseView<KChipGroup>, ChipGroupActions, ChipGroupAssertions
View with ChipGroupActions and ChipGroupAssertions
KDatePicker class KDatePicker : KBaseView<KDatePicker>, DatePickerAction, DatePickerAssertion
View for interact with default date picker
KDatePickerDialog class KDatePickerDialog : KBaseView<KDatePickerDialog>
View for interact with default date picker dialog
KDrawerView class KDrawerView : KBaseView<KDrawerView>, DrawerActions
View with DrawerActions and BaseAssertions
KEditText class KEditText : KBaseView<KEditText>, EditableActions, TextViewAssertions
View with EditableActions and TextViewAssertions
KImageView class KImageView : KBaseView<KImageView>, ImageViewAssertions
View with BaseActions and ImageViewAssertions
KNavigationView class KNavigationView : KBaseView<KNavigationView>, NavigationViewActions, NavigationViewAssertions
View with NavigationViewActions and NavigationViewAssertions
KProgressBar class KProgressBar : KBaseView<KProgressBar>, ProgressBarActions, ProgressBarAssertions
View with ProgressBarActions and ProgressBarAssertions
KRatingBar class KRatingBar : KBaseView<KRatingBar>, RatingBarActions, RatingBarAssertions
View with RatingBarActions and RatingBarAssertions
KScrollView class KScrollView : KBaseView<KScrollView>, ScrollViewActions, BaseAssertions
View with ScrollViewActions and BaseAssertions
KSeekBar class KSeekBar : KBaseView<KSeekBar>, SeekBarActions, ProgressBarAssertions
View with SeekBarActions and ProgressBarAssertions
KSnackbar class KSnackbar : KBaseView<KSnackbar>
View with internal TextView and a Button
KSwipeRefreshLayout class KSwipeRefreshLayout : KBaseView<KSwipeRefreshLayout>, SwipeRefreshLayoutActions, SwipeRefreshLayoutAssertions
View with SwipeRefreshLayoutActions and SwipeRefreshLayoutAssertions
KSwipeView class KSwipeView : KBaseView<KSwipeView>, SwipeableActions
View with SwipeableActions and BaseAssertions
KSwitch class KSwitch : KBaseView<KSwitch>, SwitchableActions, TextViewAssertions, CheckableAssertions
View with SwitchableActions, CheckableAssertions and TextViewAssertions
KTabLayout class KTabLayout : KBaseView<KTabLayout>, TabLayoutActions, TabLayoutAssertions
View with TabLayoutActions and TabLayoutAssertions
KTextInputLayout class KTextInputLayout : KBaseView<KTextInputLayout>, TextInputLayoutAssertions
View with TextInputLayoutAssertions
KTextView class KTextView : KBaseView<KTextView>, TextViewActions, TextViewAssertions
View with BaseActions and TextViewAssertions
KTimePicker class KTimePicker : KBaseView<KTimePicker>, TimePickerAction, TimePickerAssertion
View for interact with default time picker
KTimePickerDialog class KTimePickerDialog : KBaseView<KTimePickerDialog>
View for interact with default date picker dialog
KToolbar class KToolbar : KBaseView<KToolbar>, ToolbarViewActions, ToolbarViewAssertions
View for acting and asserting on Toolbar
KView class KView : KBaseView<KView>
Simple view with BaseActions and BaseAssertions
KViewPager class KViewPager : KBaseView<KViewPager>, SwipeableActions, ViewPagerAssertions
View with SwipeableActions and ViewPagerAssertions