Skip to content

Commit

Permalink
Enable native controls (#63)
Browse files Browse the repository at this point in the history
* replace com.orhanobut:logger with default Logger

* add ktlint

* add Conditions and NativeWidget classes

* add wifi, celluar, dark mode

* maestro_cli: fix bug with flavor being required

* downgrade freezed

* bump versions

* bunch of fixes

* simplify delay

* stop server on start

* add install Gradle task

* use global 'debug' option

* AutomatorServer: create 'printer' and 'catcher' Filters

* consider all HTTP 2xx status codes to be successful
  • Loading branch information
bartekpacia committed Jun 14, 2022
1 parent 2141ace commit 3f87ea1
Show file tree
Hide file tree
Showing 37 changed files with 1,275 additions and 210 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/maestro_cli-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ on:
ignore-tags: ["maestro_cli-v*"]
paths:
- "packages/maestro_cli/**"
- "AutomatorServer/**"
pull_request:
branches: [main]
paths:
- "packages/maestro_cli/**"
- "AutomatorServer/**"

jobs:
main:
Expand Down Expand Up @@ -49,3 +51,11 @@ jobs:

- name: dart format
run: dart format --set-exit-if-changed .

- name: ktlint check
working-directory: ./AutomatorServer
run: ./gradlew ktlintCheck

- name: ktlint format
working-directory: ./AutomatorServer
run: ./gradlew ktlintFormat
17 changes: 6 additions & 11 deletions AutomatorServer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
*.iml
*.out
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/navEditor.xml
.idea/compiler.xml
/.idea/assetWizardSettings.xml
/.idea/deploymentTargetDropDown.xml
/.idea/gradle.xml
/.idea/jarRepositories.xml
/.idea/misc.xml
/.idea/workspace.xml
.idea/*
!.idea/inspectionProfiles
!.idea/runConfigurations
!.idea/.gitignore
!.idea/vcs.xml
.DS_Store
/build
/captures
Expand Down
21 changes: 21 additions & 0 deletions AutomatorServer/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion AutomatorServer/.idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions AutomatorServer/.idea/inspectionProfiles/ktlint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 23 additions & 16 deletions AutomatorServer/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,55 +1,62 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id "com.android.application"
id "kotlin-android"
id "org.jlleitschuh.gradle.ktlint" version "10.3.0"
}

apply plugin: "kotlinx-serialization"


android {
compileSdkVersion 32

namespace 'pl.leancode.automatorserver'
namespace "pl.leancode.automatorserver"

defaultConfig {
applicationId "pl.leancode.automatorserver"
minSdkVersion 26
targetSdkVersion 32
versionCode 1
versionName "0.1.2"
versionName "0.1.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = "1.8"
}

packagingOptions {
exclude 'META-INF/*'
exclude "META-INF/*"
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.appcompat:appcompat:1.4.2"
implementation "com.google.android.material:material:1.6.1"

androidTestImplementation 'com.orhanobut:logger:2.2.0'
androidTestImplementation platform("org.http4k:http4k-bom:4.25.14.0")
androidTestImplementation "org.http4k:http4k-core"
androidTestImplementation "org.http4k:http4k-server-netty"
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3"

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test:rules:1.4.0"
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
package pl.leancode.automatorserver

import androidx.test.ext.junit.runners.AndroidJUnit4
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.Logger
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class AutomatorServer {
@Test
fun startServer() {
Logger.addLogAdapter(AndroidLogAdapter())
Logger.i("Starting server")

if (serverInstrumentation == null) {
serverInstrumentation = ServerInstrumentation.instance
Logger.i("Starting server")
try {
serverInstrumentation!!.startServer()
Logger.i("Server started")
while (!serverInstrumentation!!.isStopped) {
}
} catch (e: Exception) {
e.printStackTrace()
Logger.w("Exception thrown: ", e)
val serverInstrumentation = ServerInstrumentation.instance
try {
serverInstrumentation.start()
Logger.i("Server started")
while (serverInstrumentation.running) {
}
} catch (e: Exception) {
e.printStackTrace()
Logger.e("Exception thrown: ", e)
}
}

companion object {
private var serverInstrumentation: ServerInstrumentation? = null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package pl.leancode.automatorserver

import android.util.Log

object Logger {
private const val TAG = "Maestro"

fun e(msg: String) {
Log.e(TAG, msg)
}

fun e(msg: String, tr: Throwable?) {
Log.e(TAG, msg, tr)
}

fun i(msg: String) {
Log.i(TAG, msg)
}

fun d(msg: String) {
Log.d(TAG, msg)
}
}
Loading

0 comments on commit 3f87ea1

Please sign in to comment.