Skip to content

Commit

Permalink
Include bluetooth and airplane mode tests in Android pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
piotruela committed Jul 11, 2024
1 parent 534bf7e commit 2b9bf10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test-android-device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ jobs:
- name: Set tests to exclude
id: set_excluded_tests
run: |
TESTS_TO_EXCLUDE="service_airplane_mode_test,\
service_bluetooth_test"
TESTS_TO_EXCLUDE=""
target_paths=""
for target in $(echo $TESTS_TO_EXCLUDE | tr ',' '\n'); do
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-android-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ jobs:
- name: Set tests to exclude
id: set_excluded_tests
run: |
TESTS_TO_EXCLUDE="service_airplane_mode_test,\
service_bluetooth_test,\
permissions/notifications_test,\
TESTS_TO_EXCLUDE="permissions/notifications_test,\
webview_hackernews_test,\
webview_leancode_test,\
webview_stackoverflow_test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class Automator private constructor() {

fun enableAirplaneMode() {
val enabled = isAirplaneModeOn()
if(enabled) {
if (enabled) {
Logger.d("Airplane mode already enabled")
return
}
Expand All @@ -191,7 +191,7 @@ class Automator private constructor() {

fun disableAirplaneMode() {
val enabled = isAirplaneModeOn()
if(!enabled) {
if (!enabled) {
Logger.d("Airplane mode already disabled")
return
}
Expand Down Expand Up @@ -690,8 +690,11 @@ class Automator private constructor() {
}

private fun isAirplaneModeOn(): Boolean {
return Settings.System.getInt(targetContext.contentResolver,
Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
return Settings.System.getInt(
targetContext.contentResolver,
Settings.Global.AIRPLANE_MODE_ON,
0
) != 0
}

private fun toggleAirplaneMode() {
Expand All @@ -702,14 +705,13 @@ class Automator private constructor() {
var uiSelector = UiSelector()
uiSelector = uiSelector.text("Airplane mode")
val uiObject = uiDevice.findObject(uiSelector)
if(uiObject != null) {
if (uiObject != null) {
uiObject.click()
pressBack()
delay()
} else {
throw PatrolException("Could not find airplane mode toggle")
}

}

companion object {
Expand Down

0 comments on commit 2b9bf10

Please sign in to comment.