This repository was archived by the owner on Jan 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +23
-23
lines changed
app/src/androidTest/java/com/emergetools/relaxexamples
relax/src/main/java/com/emergetools/relax
tests/src/main/java/com/emergetools/relaxtests Expand file tree Collapse file tree 8 files changed +23
-23
lines changed Original file line number Diff line number Diff line change 33Relax is a lightweight wrapper around Android's UI Automator library. It helps write clear and concise UI tests:
44
55``` kotlin
6- Relax .flow (" com.example.myapp" ) {
6+ Relax (" com.example.myapp" ) {
77 pressHome()
88 launch()
99 inputText(" me@example.com" , " id/email" )
@@ -56,7 +56,7 @@ dependencies {
5656Relax allows you to build UI test flows as a sequence of actions:
5757
5858``` kotlin
59- Relax .flow (" <your app's package name>" ) {
59+ Relax (" <your app's package name>" ) {
6060 // Arbitrary actions
6161}
6262```
@@ -222,7 +222,7 @@ click("Purchase")
222222Ignoring all failures by default:
223223``` kotlin
224224val config = FlowConfig (errorHandler = NoOpFlowErrorHandler )
225- Relax .flow (" id" , config) {
225+ Relax (" id" , config) {
226226 // …
227227}
228228```
@@ -235,7 +235,7 @@ val errorHandler = object : FlowErrorHandler {
235235 }
236236}
237237val config = FlowConfig (errorHandler = errorHandler)
238- Relax .flow (" id" , config) {
238+ Relax (" id" , config) {
239239 // …
240240}
241241```
@@ -245,7 +245,7 @@ Relax.flow("id", config) {
245245Relax is a lightweight wrapper around UI Automator, therefore it's easy to leverage the full feature set of UI Automator. For example:
246246
247247``` kotlin
248- Relax .flow (/* … */ ) {
248+ Relax (/* … */ ) {
249249 if (! device.isScreenOn) device.wakeUp()
250250 launch()
251251 click(" Next" )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class ExampleInstrumentedTest {
1313 @Test
1414 fun test () {
1515 val config = FlowConfig (debug = true )
16- Relax .flow (" com.emergetools.relaxexamples" , config) {
16+ Relax (" com.emergetools.relaxexamples" , config) {
1717 pressHome()
1818 launch()
1919 click(" id/fab" )
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ object Relax {
44
55 internal val TAG = " Relax"
66
7- fun flow (packageName : String , config : FlowConfig = FlowConfig (), flow : Flow .() -> Unit ) {
7+ operator fun invoke (packageName : String , config : FlowConfig = FlowConfig (), flow : Flow .() -> Unit ) {
88 Flow (packageName, config).flow()
99 }
1010}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class ClickTest {
1313
1414 @Test
1515 fun click () {
16- Relax .flow (" com.emergetools.relaxexamples" ) {
16+ Relax (" com.emergetools.relaxexamples" ) {
1717 pressHome()
1818 launch()
1919
@@ -28,7 +28,7 @@ class ClickTest {
2828
2929 @Test
3030 fun clickObjectDoesntExist () {
31- Relax .flow (" com.emergetools.relaxexamples" ) {
31+ Relax (" com.emergetools.relaxexamples" ) {
3232 pressHome()
3333 launch()
3434
@@ -40,7 +40,7 @@ class ClickTest {
4040
4141 @Test
4242 fun optionalClick () {
43- Relax .flow (" com.emergetools.relaxexamples" ) {
43+ Relax (" com.emergetools.relaxexamples" ) {
4444 pressHome()
4545 launch()
4646
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class FindObjectTest {
1313
1414 @Test
1515 fun findObject () {
16- Relax .flow (" com.emergetools.relaxexamples" ) {
16+ Relax (" com.emergetools.relaxexamples" ) {
1717 pressHome()
1818 launch()
1919 val obj = findObject(" NEXT" )
@@ -24,7 +24,7 @@ class FindObjectTest {
2424
2525 @Test
2626 fun findObjectDoesntExist () {
27- Relax .flow (" com.emergetools.relaxexamples" ) {
27+ Relax (" com.emergetools.relaxexamples" ) {
2828 pressHome()
2929 launch()
3030
@@ -36,7 +36,7 @@ class FindObjectTest {
3636
3737 @Test
3838 fun optionalFindObject () {
39- Relax .flow (" com.emergetools.relaxexamples" ) {
39+ Relax (" com.emergetools.relaxexamples" ) {
4040 pressHome()
4141 launch()
4242
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class InputTextTest {
1515
1616 @Test
1717 fun inputText () {
18- Relax .flow (" com.emergetools.relaxexamples" ) {
18+ Relax (" com.emergetools.relaxexamples" ) {
1919 pressHome()
2020 launch()
2121 click(" NEXT" )
@@ -27,7 +27,7 @@ class InputTextTest {
2727
2828 @Test
2929 fun inputTextObjectDoesntExist () {
30- Relax .flow (" com.emergetools.relaxexamples" ) {
30+ Relax (" com.emergetools.relaxexamples" ) {
3131 pressHome()
3232 launch()
3333 click(" NEXT" )
@@ -40,7 +40,7 @@ class InputTextTest {
4040
4141 @Test
4242 fun optionalInputText () {
43- Relax .flow (" com.emergetools.relaxexamples" ) {
43+ Relax (" com.emergetools.relaxexamples" ) {
4444 pressHome()
4545 launch()
4646 click(" NEXT" )
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class LaunchTest {
1515
1616 @Test
1717 fun launch () {
18- Relax .flow (" com.emergetools.relaxexamples" ) {
18+ Relax (" com.emergetools.relaxexamples" ) {
1919 pressHome()
2020 waitForReportFullyDrawn {
2121 launch()
@@ -28,7 +28,7 @@ class LaunchTest {
2828
2929 @Test
3030 fun launchArbitraryPackage () {
31- Relax .flow (" com.emergetools.relaxexamples" ) {
31+ Relax (" com.emergetools.relaxexamples" ) {
3232 pressHome()
3333 val intent = Intent (Settings .ACTION_SETTINGS )
3434
@@ -43,7 +43,7 @@ class LaunchTest {
4343
4444 @Test
4545 fun launchWithLink () {
46- Relax .flow (" com.emergetools.relaxexamples" ) {
46+ Relax (" com.emergetools.relaxexamples" ) {
4747 pressHome()
4848 launchWithLink(" emerge://deep" )
4949
@@ -53,7 +53,7 @@ class LaunchTest {
5353
5454 @Test
5555 fun coldLaunch () {
56- Relax .flow (" com.emergetools.relaxexamples" ) {
56+ Relax (" com.emergetools.relaxexamples" ) {
5757 pressHome()
5858 coldLaunch()
5959
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class LongClickTest {
1313
1414 @Test
1515 fun longClick () {
16- Relax .flow (" com.emergetools.relaxexamples" ) {
16+ Relax (" com.emergetools.relaxexamples" ) {
1717 pressHome()
1818 launch()
1919
@@ -28,7 +28,7 @@ class LongClickTest {
2828
2929 @Test
3030 fun longClickObjectDoesntExist () {
31- Relax .flow (" com.emergetools.relaxexamples" ) {
31+ Relax (" com.emergetools.relaxexamples" ) {
3232 pressHome()
3333 launch()
3434
@@ -40,7 +40,7 @@ class LongClickTest {
4040
4141 @Test
4242 fun optionalLongClick () {
43- Relax .flow (" com.emergetools.relaxexamples" ) {
43+ Relax (" com.emergetools.relaxexamples" ) {
4444 pressHome()
4545 launch()
4646
You can’t perform that action at this time.
0 commit comments