Skip to content

Commit

Permalink
Relax.flow -> Relax
Browse files Browse the repository at this point in the history
  • Loading branch information
ngsilverman committed Dec 15, 2022
1 parent 38bd90d commit b8b4b54
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Relax is a lightweight wrapper around Android's UI Automator library. It helps write clear and concise UI tests:

```kotlin
Relax.flow("com.example.myapp") {
Relax("com.example.myapp") {
pressHome()
launch()
inputText("[email protected]", "id/email")
Expand Down Expand Up @@ -56,7 +56,7 @@ dependencies {
Relax allows you to build UI test flows as a sequence of actions:

```kotlin
Relax.flow("<your app's package name>") {
Relax("<your app's package name>") {
// Arbitrary actions
}
```
Expand Down Expand Up @@ -222,7 +222,7 @@ click("Purchase")
Ignoring all failures by default:
```kotlin
val config = FlowConfig(errorHandler = NoOpFlowErrorHandler)
Relax.flow("id", config) {
Relax("id", config) {
//
}
```
Expand All @@ -235,7 +235,7 @@ val errorHandler = object : FlowErrorHandler {
}
}
val config = FlowConfig(errorHandler = errorHandler)
Relax.flow("id", config) {
Relax("id", config) {
//
}
```
Expand All @@ -245,7 +245,7 @@ Relax.flow("id", config) {
Relax is a lightweight wrapper around UI Automator, therefore it's easy to leverage the full feature set of UI Automator. For example:

```kotlin
Relax.flow(/**/) {
Relax(/**/) {
if (!device.isScreenOn) device.wakeUp()
launch()
click("Next")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ExampleInstrumentedTest {
@Test
fun test() {
val config = FlowConfig(debug = true)
Relax.flow("com.emergetools.relaxexamples", config) {
Relax("com.emergetools.relaxexamples", config) {
pressHome()
launch()
click("id/fab")
Expand Down
2 changes: 1 addition & 1 deletion relax/src/main/java/com/emergetools/relax/Relax.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Relax {

internal val TAG = "Relax"

fun flow(packageName: String, config: FlowConfig = FlowConfig(), flow: Flow.() -> Unit) {
operator fun invoke(packageName: String, config: FlowConfig = FlowConfig(), flow: Flow.() -> Unit) {
Flow(packageName, config).flow()
}
}
6 changes: 3 additions & 3 deletions tests/src/main/java/com/emergetools/relaxtests/ClickTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ClickTest {

@Test
fun click() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()

Expand All @@ -28,7 +28,7 @@ class ClickTest {

@Test
fun clickObjectDoesntExist() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()

Expand All @@ -40,7 +40,7 @@ class ClickTest {

@Test
fun optionalClick() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FindObjectTest {

@Test
fun findObject() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()
val obj = findObject("NEXT")
Expand All @@ -24,7 +24,7 @@ class FindObjectTest {

@Test
fun findObjectDoesntExist() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()

Expand All @@ -36,7 +36,7 @@ class FindObjectTest {

@Test
fun optionalFindObject() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class InputTextTest {

@Test
fun inputText() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()
click("NEXT")
Expand All @@ -27,7 +27,7 @@ class InputTextTest {

@Test
fun inputTextObjectDoesntExist() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()
click("NEXT")
Expand All @@ -40,7 +40,7 @@ class InputTextTest {

@Test
fun optionalInputText() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()
click("NEXT")
Expand Down
8 changes: 4 additions & 4 deletions tests/src/main/java/com/emergetools/relaxtests/LaunchTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LaunchTest {

@Test
fun launch() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
waitForReportFullyDrawn {
launch()
Expand All @@ -28,7 +28,7 @@ class LaunchTest {

@Test
fun launchArbitraryPackage() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
val intent = Intent(Settings.ACTION_SETTINGS)

Expand All @@ -43,7 +43,7 @@ class LaunchTest {

@Test
fun launchWithLink() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launchWithLink("emerge://deep")

Expand All @@ -53,7 +53,7 @@ class LaunchTest {

@Test
fun coldLaunch() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
coldLaunch()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LongClickTest {

@Test
fun longClick() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()

Expand All @@ -28,7 +28,7 @@ class LongClickTest {

@Test
fun longClickObjectDoesntExist() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()

Expand All @@ -40,7 +40,7 @@ class LongClickTest {

@Test
fun optionalLongClick() {
Relax.flow("com.emergetools.relaxexamples") {
Relax("com.emergetools.relaxexamples") {
pressHome()
launch()

Expand Down

0 comments on commit b8b4b54

Please sign in to comment.