Skip to content

Commit

Permalink
feature=kas_kau_improvements: elementClassName => description
Browse files Browse the repository at this point in the history
  • Loading branch information
matzuk committed Jan 30, 2020
1 parent 78bea79 commit 7e7d3fd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class LoggingObjectWatcherInterceptor(
* @param assertion responsible for performing an activity (assertion) on the given [interaction]
*/
override fun interceptCheck(interaction: UiObjectInteraction, assertion: UiObjectAssertion) {
logger.i("Check=${assertion.type}(description={${assertion.description}} is executing on " +
"${interaction.elementClassName}) that was founded by selector=${interaction.selector.bySelector}")
logger.i("The object: ${interaction.description}. " +
"The operation: Check=${assertion.type}(description={${assertion.description}}. " +
"Additional info: the object was founded by selector=${interaction.selector.bySelector}")
}

/**
Expand All @@ -32,7 +33,8 @@ class LoggingObjectWatcherInterceptor(
* @param action responsible for performing an activity (action) on the given [interaction]
*/
override fun interceptPerform(interaction: UiObjectInteraction, action: UiObjectAction) {
logger.i("Action=${action.type}(description={${action.description}} is executing on " +
"${interaction.elementClassName}) that was founded by selector=${interaction.selector.bySelector}")
logger.i("The object: ${interaction.description}. " +
"The operation: Action=${action.type}(description={${action.description}}. " +
"Additional info: the object was founded by selector=${interaction.selector.bySelector}")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ open class UiBaseView<out T>(selector: UiViewSelector) : UiBaseActions, UiBaseAs
val delegate = UiObjectDelegate(
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()),
selector,
this::class.java.simpleName
"Object type=${this::class.java.simpleName}"
)
delegate.loadView()
delegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import com.kaspersky.components.kautomator.intercepting.operation.UiOperationTyp
class UiObjectDelegate(
val device: UiDevice,
val selector: UiViewSelector,
elementClassName: String
description: String
) : UiDelegate<UiObjectInteraction, UiObjectAssertion, UiObjectAction> {

override val interaction: UiObjectInteraction = UiObjectInteraction(device, selector, elementClassName)
override val interaction: UiObjectInteraction = UiObjectInteraction(device, selector, description)
override var interceptor: UiInterceptor<UiObjectInteraction, UiObjectAssertion, UiObjectAction>? = null

fun loadView(): Boolean = interaction.tryToFindUiObject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import com.kaspersky.components.kautomator.intercepting.operation.UiObjectAssert
class UiObjectInteraction(
val device: UiDevice,
val selector: UiViewSelector,
// UiButton, UiTextView, UiEditText, etc.
val elementClassName: String
val description: String
) : UiInteraction<UiObjectAssertion, UiObjectAction> {

var uiObject2: UiObject2? = null
Expand Down

0 comments on commit 7e7d3fd

Please sign in to comment.