-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ISSUE-630: add new UiAutomatorViewer matchers
- Loading branch information
Showing
13 changed files
with
204 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ configure<BaseExtension> { | |
} | ||
|
||
defaultConfig { | ||
minSdk = 18 | ||
minSdk = 21 | ||
targetSdk = 30 | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...idTest/java/com/kaspersky/kaspresso/kautomatorsample/kaspresso/sanity/HintMatchersTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.kaspersky.kaspresso.kautomatorsample.kaspresso.sanity | ||
|
||
import android.os.Build | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import com.kaspersky.kaspresso.kautomatorsample.ComponentsActivity | ||
import com.kaspersky.kaspresso.kautomatorsample.screen.ComponentsScreen | ||
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase | ||
import org.junit.Assume | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class HintMatchersTest : TestCase() { | ||
|
||
@get:Rule | ||
val activityRule = activityScenarioRule<ComponentsActivity>() | ||
|
||
@Test | ||
fun test() = run { | ||
Assume.assumeTrue("Hint matchers are available on API 26+", Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) | ||
|
||
ComponentsScreen { | ||
editTextByHintResId { isDisplayed() } | ||
editTextByHintText { isDisplayed() } | ||
editTextByHintPattern { isDisplayed() } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...rc/androidTest/java/com/kaspersky/kaspresso/kautomatorsample/screen/ParentSearchScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.kaspersky.kaspresso.kautomatorsample.screen | ||
|
||
import com.kaspersky.components.kautomator.component.text.UiTextView | ||
import com.kaspersky.components.kautomator.screen.UiScreen | ||
import com.kaspersky.kaspresso.kautomatorsample.R | ||
|
||
object ParentSearchScreen : UiScreen<ParentSearchScreen>() { | ||
override val packageName = "com.kaspersky.kaspresso.kautomatorsample" | ||
|
||
val textByParentId = UiTextView { | ||
isFocusable() | ||
withParent { withId(R.id.container1) } | ||
} | ||
|
||
val textByParentChild = UiTextView { | ||
isFocusable() | ||
withParent { | ||
withChild { withId(R.id.title2) } | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...le/src/androidTest/java/com/kaspersky/kaspresso/kautomatorsample/test/ParentSearchTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.kaspersky.kaspresso.kautomatorsample.test | ||
|
||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import com.kaspersky.kaspresso.kautomatorsample.ParentSearchActivity | ||
import com.kaspersky.kaspresso.kautomatorsample.screen.ParentSearchScreen | ||
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import com.kaspersky.kaspresso.kautomatorsample.R | ||
|
||
class ParentSearchTest : TestCase() { | ||
@get:Rule | ||
val activityRule = activityScenarioRule<ParentSearchActivity>() | ||
|
||
@Test | ||
fun test() = run { | ||
ParentSearchScreen { | ||
textByParentId { | ||
val text1 = device.targetContext.resources.getString(R.string.parent_search_value1) | ||
hasText(text1) | ||
} | ||
textByParentChild { | ||
val text2 = device.targetContext.resources.getString(R.string.parent_search_value2) | ||
hasText(text2) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...tor-sample/src/main/java/com/kaspersky/kaspresso/kautomatorsample/ParentSearchActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.kaspersky.kaspresso.kautomatorsample | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class ParentSearchActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_parent_search) | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
samples/kautomator-sample/src/main/res/layout/activity_parent_search.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fillViewport="true"> | ||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<LinearLayout | ||
android:id="@+id/container1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:padding="16dp"> | ||
<TextView | ||
android:id="@+id/title" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Headline" | ||
android:text="Some title" /> | ||
<TextView | ||
android:focusable="true" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" | ||
android:text="@string/parent_search_value1" /> | ||
</LinearLayout> | ||
|
||
<com.google.android.material.divider.MaterialDivider | ||
android:layout_width="match_parent" | ||
android:layout_height="1dp" /> | ||
|
||
<LinearLayout | ||
android:id="@+id/container2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:padding="16dp"> | ||
<TextView | ||
android:id="@+id/title2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Headline" | ||
android:text="Some title" /> | ||
<TextView | ||
android:focusable="true" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" | ||
android:text="@string/parent_search_value2" /> | ||
</LinearLayout> | ||
</LinearLayout> | ||
</ScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters