Skip to content

Commit af50104

Browse files
committed
upd cmp docs
1 parent 3916eef commit af50104

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and deploy docs
33
on:
44
push:
55
branches:
6-
- docs
6+
- master
77

88
jobs:
99
github-pages:

docs/docs/compose/lazylist.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ class ComposeFriendListItem : UltronComposeListItem(){
123123
```
124124
**Note: you have to use delegated initialisation with `by child`.**
125125

126+
For Compose Multiplatform `commonTest` you need to register Item class instances, like:
127+
128+
```kotlin
129+
composeList(.., initBlock = {
130+
registerItem { ComposeFriendListItem() }
131+
registerItem { AnotherListItem() }
132+
})
133+
```
134+
It is required cause Kotlin Multiplatfor Project has limited reflation API for different platforms.
135+
136+
You don't need to register Items for Android UI tests (and JVM).
137+
126138
Now you're able to get `ComposeFriendListItem` object using methods `getItem`, `getVisibleItem`, `getFirstVisibleItem`, `getLastVisibleItem`
127139

128140
```kotlin
@@ -138,7 +150,7 @@ lazyList.getItem<ComposeFriendListItem>(hasTestTag(..))
138150
Mark such methods with `private` visibility modifier. e.g. `getContactItem`
139151
```kotlin
140152
object ComposeListPage : Page<ComposeListPage>() {
141-
private val lazyList = composeList(hasContentDescription(contactsListContentDesc))
153+
private val lazyList = composeList(hasContentDescription(contactsListContentDesc), ..)
142154
private fun getContactItem(contact: Contact): ComposeFriendListItem = lazyList.getItem(hasTestTag(contact.id))
143155

144156
class ComposeFriendListItem : UltronComposeListItem(){
@@ -168,7 +180,7 @@ It's pretty much the same as [simple node api](../compose/api.md), but extends i
168180
Let's start with approaches that you can use without additional efforts. For example, you have identified `LazyList` in your tests code like
169181

170182
```kotlin
171-
val lazyList = composeList(listMatcher = hasTestTag("listTestTag"))
183+
val lazyList = composeList(listMatcher = hasTestTag("listTestTag"), ..)
172184

173185
class ComposeListItem : UltronComposeListItem() {
174186
val name by lazy { getChild(hasTestTag(contactNameTestTag)) }

docs/docs/intro/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ UltronComposeConfig.apply {
3434
lazyColumnOperationTimeoutMs = 15_000
3535
operationPollingTimeoutMs = 100
3636
lazyColumnItemSearchLimit = 100
37+
useUnmergedTree = true //set up this value as a default for all SemanticNodeInteractions
3738
}
3839
```
3940

docs/docs/intro/connect.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repositories {
1818
}
1919
```
2020

21-
For Android application instrumented UI tests
21+
### Android application instrumented UI tests
2222
```kotlin
2323
dependencies {
2424
androidTestImplementation("com.atiurin:ultron-compose:<latest_version>")
@@ -27,7 +27,8 @@ dependencies {
2727
}
2828
```
2929

30-
For Compose Multiplatform UI tests
30+
### Compose Multiplatform UI tests
31+
3132
```kotlin
3233
kotlin {
3334
sourceSets {
@@ -36,4 +37,27 @@ kotlin {
3637
}
3738
}
3839
}
40+
```
41+
Since Multiplatform support in alpha state it's possible to have some problems with `commonTest` usage.
42+
43+
In this case you can specify dependencies in relevant part.
44+
```kotlin
45+
kotlin {
46+
androidTarget {
47+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
48+
instrumentedTestVariant {
49+
...
50+
dependencies {
51+
implementation("com.atiurin:ultron-compose:<latest_version>")
52+
}
53+
}
54+
}
55+
sourceSets {
56+
val desktopTest by getting {
57+
dependencies {
58+
implementation("com.atiurin:ultron-compose:<latest_version>")
59+
}
60+
}
61+
}
62+
}
3963
```

0 commit comments

Comments
 (0)