Releases: open-tool/ultron
ultron-compose
Compose part is separated into another library ultron-compose
From 2.1.0 you need to add 2 dependencies.
dependencies {
androidTestImplementation 'com.atiurin:ultron:<latest_version>'
androidTestImplementation 'com.atiurin:ultron-compose:<latest_version>'
}
com.atiurin:ultron:2.1.0
provides required libs, so you don't need to add them to dependencies.
The list of provided libs:
"androidx.test.espresso:espresso-core:3.4.0"
"androidx.test.espresso:espresso-contrib:3.4.0"
"androidx.test.espresso:espresso-web:3.4.0"
"androidx.test.uiautomator:uiautomator:2.2.0"
"com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:4.0.0"
"org.hamcrest:hamcrest-core:2.2"
You can exclude them from androidTestImplementation
section
com.atiurin:ultron-compose:2.1.0
provides "androidx.compose.ui:ui-test-junit4:1.1.1"
Breaking changes
UltronConfig.Compose
moved to UltronComposeConfig
Internal changes
Move from gradle to kts
Improved framework extensions
2.0.4
Update build tools version to 33.0.1
Add Espresso TextView color assertions:
fun hasCurrentTextColor(@ColorRes colorRes: Int)
fun hasCurrentHintTextColor(@ColorRes colorRes: Int)
fun hasShadowColor(@ColorRes colorRes: Int)
fun hasHighlightColor(@ColorRes colorRes: Int)
For example:
<TextView
android:id="@+id/last_event_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary"
android:textColorHint="@color/colorHint"
android:shadowColor="@color/colorShadow"
android:textColorHighlight="@color/colorHighlight"
android:text="@string/button_text" />
Could be asserted by
fun assertTextViewColors() {
withId(R.id.last_event_status)
.hasCurrentTextColor(R.color.colorPrimary)
.hasCurrentHintTextColor(R.color.colorHint)
.hasShadowColor(R.color.colorShadow)
.hasHighlightColor(R.color.colorHighlight)
}
2.0.3
New cool feature:
- Custom assertion of any operation - read wiki
New cool exception message.
- It contains a full history of exceptions that happened during operation performance
- It provides a detailed an clear information of that's going on wrong.
(feedback is appreciated)
Simplified Ultron extensions:
If you already have custom operations, you are going to find deprecated methods. Custom operation assertion is not working with deprecated extensions. Please modify your extensions.
It's really easy to support, just delete several lines and use new methods as it's described in samples.
Deleted - EspressoActionType.CUSTOM. In case you use it just delete the line. By default will be used CommonOperationType.DEFAULT.
Compose rule factory methods
Add new methods to create compose rule:
fun createDefaultUltronComposeRule(): ComposeContentTestRule
fun createEmptyUltronComposeRule(): ComposeTestRule
Compose support
An amazing support of compose UI testing.
Read wike to know how it works
Espresso 3.4.0
Upd Espresso libs versions to 3.4.0 and also some other libs.
Upd javaCompatibility version to JavaVersion.VERSION_1_8
1.0.18
#17 Add click actions on different view points:.
- clickTopLeft(offsetX: Int = 0, offsetY: Int = 0)
- clickTopCenter(offsetY: Int)
- clickTopRight(offsetX: Int = 0, offsetY: Int = 0)
- clickCenterRight(offsetX: Int = 0)
- clickBottomRight(offsetX: Int = 0, offsetY: Int = 0)
- clickBottomCenter(offsetY: Int = 0)
- clickBottomLeft(offsetX: Int = 0, offsetY: Int = 0)
- clickCenterLeft(offsetX: Int = 0)
Thanks to @flotnik
1.0.17
1.0.16
Features:
- #14 Add scroll offset param for UltronRecyclerView item providers
scrollOffset: Int = 0
specifies an amount of items that are scrolled from target one.
//affected methods
item(..., scrollOffset: Int = 0): UltronRecyclerViewItem
firstItemMatched(..., scrollOffset: Int = 0): UltronRecyclerViewItem
itemMatched(..., scrollOffset: Int = 0): UltronRecyclerViewItem
lastItemMatched(..., scrollOffset: Int = 0): UltronRecyclerViewItem
getItem(..., scrollOffset: Int = 0): T
getFirstItemMatched(..., scrollOffset: Int = 0): T
getItemMatched(..., scrollOffset: Int = 0): T
getLastItemMatched(..., scrollOffset: Int = 0): T
You don't need to worry about out of range error. In case item position + scrollOffset
is greater then RecyclerView size it is scrolled to the last item.
- #14 Add method for UltronRecyclerView:
assertNotEmpty()
throws an exception if RecyclerVIew is empty.