-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 249/compose support #307
Conversation
… logic complicates and has flaky
enabled = false | ||
} | ||
} | ||
// todo doesn't work on AGP 4.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RuslanMingaliev such api is not available now
@@ -1,13 +1,15 @@ | |||
[versions] | |||
kotlin = "1.4.32" | |||
kotlin = "1.5.21" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.5.31 causes weird problems, postponed
} | ||
} | ||
|
||
// temp solution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RuslanMingaliev need your help here
kaspresso/src/main/kotlin/com/kaspersky/kaspresso/autoscroll/ObjectAutoScrollProviderImpl.kt
Show resolved
Hide resolved
@@ -30,7 +30,10 @@ class FlakySafeObjectBehaviorInterceptor( | |||
interaction: UiObjectInteraction, | |||
assertion: UiObjectAssertion, | |||
activity: () -> T | |||
): T = flakySafely(action = activity) | |||
): T = flakySafely(action = { | |||
interaction.reFindUiObject() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improvements of Kautomator stability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you describe the problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This one must be relocated to a separate Interceptor. Thanks that you've highlighted.
- Good question about stability. So, the concept is similar to the one that we had in Loader...Interceptor. But, the architecture solution is better and the same with Jetpack Compose Intercepting (see old weird methods like
loadView
and etc.). Better stability is achieved due to changing the order of behavior interceptors (try to reload earlier). I think, there were cases when SystemDialog and Scrolling Interceptors consumed all allocated time, that's why there was no time to reload Element. But, I don't have tests where I can check it. - Abstractions don't leak because BehaviorInterceptor offers access to all possible data (Interaction, Action, Assert). So, we give broad possibilities to do something with all of this. Also, I tried to reload an Element by using of custom getter where we recalculate the element. But, such a solution provides some edge cases like recalculation in absolutely all cases, possible caching of property that can lead to an inconsistent state, and others.
kaspresso/src/main/kotlin/com/kaspersky/kaspresso/kaspresso/Kaspresso.kt
Show resolved
Hide resolved
…er functionality is relocated from FlakySafety functionality to the separate classes
|
||
[libraries] | ||
# plugins | ||
kotlinPlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } | ||
androidPlugin = "com.android.tools.build:gradle:4.1.0" | ||
androidPlugin = "com.android.tools.build:gradle:4.2.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мб нам его до 7 поднять?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but I got a lot of errors with our plugins =(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nnoooice
interaction.perform(action) | ||
}, | ||
operation = { | ||
acc, deviceBehaviorInterceptor -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Линт внутри меня говорит, что тут форматирование поехало)0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will check it
* @return true if object was found, false otherwise | ||
*/ | ||
fun tryToFindUiObject(): Boolean { | ||
private fun calculateUiObject(): UiObject2? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А почему calculate то? Она вроде не считает ничего
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, maybe there is a sense to put another name.
package com.kaspersky.kaspressample.jetpackcompose.resources | ||
|
||
// Like R, but C | ||
object C { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это твое изобретение или это паттерн типо рекомендованный? Элементы по строке ищутся?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RuslanMingaliev suggested such an approach. I like it =)
kaspresso/src/main/kotlin/com/kaspersky/kaspresso/elementloader/ElementLoaderProviderImpl.kt
Show resolved
Hide resolved
logger.i("Reloading of the element is started") | ||
elementLoader.invoke() | ||
logger.i("Reloading of the element is finished") | ||
logger.i("Repeat action again with the reloaded element") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too verbose logging, I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not. Have a look at logs running examples.
@@ -30,7 +30,10 @@ class FlakySafeObjectBehaviorInterceptor( | |||
interaction: UiObjectInteraction, | |||
assertion: UiObjectAssertion, | |||
activity: () -> T | |||
): T = flakySafely(action = activity) | |||
): T = flakySafely(action = { | |||
interaction.reFindUiObject() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you describe the problem?
kaspresso/src/main/kotlin/com/kaspersky/kaspresso/kaspresso/Kaspresso.kt
Show resolved
Hide resolved
// the implementation is a little bit tricky because | ||
// UiObjectInteractionDelegate throws UnfoundedUiObjectException in case of absence of a related UIObject2 | ||
// that's why we just catch the mentioned exception and do a final check | ||
val notDisplayed = try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change the previous behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous solution required an additional method of UiObjectInteractionDelegate
which was too poor because made an abstraction leak.
...ain/kotlin/com/kaspersky/kaspressample/jetpackcompose/features/flaky/SimpleFlakyViewModel.kt
Outdated
Show resolved
Hide resolved
uiAutomator = "androidx.test.uiautomator:uiautomator:2.2.0" | ||
fragmentTesting = "androidx.fragment:fragment-testing:1.3.2" | ||
fragmentTesting = "androidx.fragment:fragment-testing:1.3.6" | ||
# upgrading to 4.6.1 is blocked by https://github.com/robolectric/robolectric/issues/6593 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a bug, there is a solution in the comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that you are right. Ok, can you try to fix it?
What remains: