Skip to content

Commit

Permalink
Merge branch 'task/patrol-extension' into refactor/remove_integration…
Browse files Browse the repository at this point in the history
…_test_plugin
  • Loading branch information
bartekpacia authored Nov 13, 2023
2 parents 354f8f1 + 5cf10a1 commit 8d359c1
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 63 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/patrol-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
run:
Expand All @@ -27,8 +29,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.17.0-5.0.pre.20'
channel: master
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Set up Java
uses: actions/setup-java@v3
Expand Down Expand Up @@ -60,6 +62,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
run:
Expand All @@ -72,7 +76,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.x'
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Generate Gradle wrapper
working-directory: packages/patrol/example
Expand Down Expand Up @@ -104,6 +109,8 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest]
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
run:
Expand Down Expand Up @@ -137,7 +144,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.x'
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Generate iOS build files
working-directory: packages/patrol/example
Expand Down Expand Up @@ -171,7 +179,8 @@ jobs:
strategy:
fail-fast: false
matrix:
flutter-version: ['3.3.x', '3.7.x', '3.10.x', '3.13.x']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
run:
Expand All @@ -185,6 +194,13 @@ jobs:
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Set up Melos
run: dart pub global activate melos

- name: Activate Melos workspace
run: cd ../.. && melos bootstrap

- name: flutter pub get
run: flutter pub get
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patrol_cli-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
flutter-version: ['3.17.0-5.0.pre.20']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patrol_devtools_extension-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
flutter-version: ['3.17.0-5.0.pre.20']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patrol_finders-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
flutter-version: ['3.17.0-5.0.pre.20']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-android-device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ on:

jobs:
run_tests:
name: Flutter ${{ matrix.flutter_version }} on ${{ matrix.os }} ${{ matrix.os_version }}
name: Flutter ${{ matrix.flutter-version }} on ${{ matrix.os }} ${{ matrix.os_version }}
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter_version }} on ${{ matrix.os }} ${{ matrix.os_version }}
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} on ${{ matrix.os }} ${{ matrix.os_version }}
TESTS_EXIT_CODE: ${{ steps.tests_step.outputs.TESTS_EXIT_CODE }}
EXCLUDED_TESTS: ${{ steps.set_excluded_tests.outputs.EXCLUDED_TESTS }}
URL_TO_DETAILS: ${{ steps.tests_step.outputs.URL_TO_DETAILS }}

strategy:
fail-fast: false
matrix:
flutter_version: ['3.13.x']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']
device_model: ['oriole']
os: ['Android API']
os_version: ['33']
Expand Down Expand Up @@ -54,7 +55,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter_version }}
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-android-emulator-webview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ on:

jobs:
run_tests:
name: Flutter ${{ matrix.flutter_version }} webview on emulator.wtf
name: Flutter ${{ matrix.flutter-version }} webview on emulator.wtf
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter_version }} webview on emulator.wtf
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} webview on emulator.wtf
TESTS_EXIT_CODE: ${{ steps.tests_step.outputs.TESTS_EXIT_CODE }}
URL_TO_DETAILS: ${{ steps.tests_step.outputs.URL_TO_DETAILS }}

strategy:
fail-fast: false
matrix:
flutter_version: ['3.13.x']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
run:
Expand All @@ -42,7 +43,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter_version }}
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-android-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ on:

jobs:
run_tests:
name: Flutter ${{ matrix.flutter_version }} on emulator.wtf
name: Flutter ${{ matrix.flutter-version }} on emulator.wtf
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter_version }} on emulator.wtf
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} on emulator.wtf
TESTS_EXIT_CODE: ${{ steps.tests_step.outputs.TESTS_EXIT_CODE }}
EXCLUDED_TESTS: ${{ steps.set_excluded_tests.outputs.EXCLUDED_TESTS }}
URL_TO_DETAILS: ${{ steps.tests_step.outputs.URL_TO_DETAILS }}

strategy:
fail-fast: false
matrix:
flutter_version: ['3.13.x']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']

defaults:
run:
Expand All @@ -43,7 +44,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter_version }}
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-ios-device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ on:

jobs:
run_tests:
name: Flutter ${{ matrix.flutter_version }} on ${{ matrix.device_model }} ${{ matrix.os }} ${{ matrix.os_version }} on FTL
name: Flutter ${{ matrix.flutter-version }} on ${{ matrix.device_model }} ${{ matrix.os }} ${{ matrix.os_version }} on FTL
runs-on: macos-latest
timeout-minutes: 40
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter_version }} on ${{ matrix.os }} ${{ matrix.os_version }}
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} on ${{ matrix.os }} ${{ matrix.os_version }}
TESTS_EXIT_CODE: ${{ steps.tests_step.outputs.TESTS_EXIT_CODE }}
EXCLUDED_TESTS: ${{ steps.set_excluded_tests.outputs.EXCLUDED_TESTS }}
URL_TO_DETAILS: ${{ steps.tests_step.outputs.URL_TO_DETAILS }}

strategy:
fail-fast: false
matrix:
flutter_version: ['3.13.x']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']
device_model: ['iphone14pro']
os_version: ['16.6']
os: [iOS]
Expand Down Expand Up @@ -69,7 +70,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter_version }}
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-ios-simulator-webview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ on:

jobs:
run_tests:
name: Flutter ${{ matrix.flutter_version }} webview on ${{ matrix.device_model }} (${{ matrix.os_version }}) simulator
name: Flutter ${{ matrix.flutter-version }} webview on ${{ matrix.device_model }} (${{ matrix.os_version }}) simulator
runs-on: macos-latest
timeout-minutes: 40
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter_version }} on ${{ matrix.os }} ${{ matrix.os_version }} simulator
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} on ${{ matrix.os }} ${{ matrix.os_version }} simulator
TESTS_EXIT_CODE: ${{ steps.tests_step.outputs.TESTS_EXIT_CODE }}
FAILURE_STATUS: ${{ steps.status_step.outputs.FAILURE_STATUS }}
ERROR_STATUS: ${{ steps.status_step.outputs.ERROR_STATUS }}

strategy:
fail-fast: false
matrix:
flutter_version: ['3.13.x']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']
device_model: [iPhone 14]
os: [iOS]
os_version: ['16.2']
Expand All @@ -35,7 +36,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter_version }}
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-ios-simulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:

jobs:
run_tests:
name: Flutter ${{ matrix.flutter_version }} on ${{ matrix.device_model }} (${{ matrix.os_version }}) simulator
name: Flutter ${{ matrix.flutter-version }} on ${{ matrix.device_model }} (${{ matrix.os_version }}) simulator
runs-on: macos-latest
timeout-minutes: 40
outputs:
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter_version }} on ${{ matrix.os }} ${{ matrix.os_version }} simulator
SLACK_MESSAGE_TITLE: Flutter ${{ matrix.flutter-version }} on ${{ matrix.os }} ${{ matrix.os_version }} simulator
TESTS_EXIT_CODE: ${{ steps.tests_step.outputs.TESTS_EXIT_CODE }}
FAILURE_STATUS: ${{ steps.status_step.outputs.FAILURE_STATUS }}
ERROR_STATUS: ${{ steps.status_step.outputs.ERROR_STATUS }}
Expand All @@ -20,7 +20,8 @@ jobs:
strategy:
fail-fast: false
matrix:
flutter_version: ['3.13.x']
flutter-version: ['3.17.0-5.0.pre.26']
flutter-channel: ['master']
device_model: [iPhone 8, iPhone 14, iPad (9th generation)]
os: [iOS]
os_version: ['16.2']
Expand All @@ -36,7 +37,8 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter_version }}
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache
Expand Down
38 changes: 20 additions & 18 deletions packages/patrol/ios/Classes/AutomatorServer/Automator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -395,27 +395,27 @@
return views
}
}
func getUITreeRoots(installedApps: [String]) async throws -> [NativeView] {
try await runAction("getting ui tree roots") {
let foregroundApp = self.getForegroundApp(installedApps: installedApps)
let snapshot = try foregroundApp.snapshot()
return [NativeView.fromXCUIElementSnapshot(snapshot, foregroundApp.identifier)]

func getUITreeRoots(installedApps: [String]) throws -> [NativeView] {
try runAction("getting ui tree roots") {
let foregroundApp = self.getForegroundApp(installedApps: installedApps)
let snapshot = try foregroundApp.snapshot()
return [NativeView.fromXCUIElementSnapshot(snapshot, foregroundApp.identifier)]
}
}

private func getForegroundApp(installedApps: [String]) -> XCUIApplication {
let app = XCUIApplication()
if app.state == .runningForeground {
return app
return app
} else {
for bundleIdentifier in installedApps {
let app = XCUIApplication(bundleIdentifier: bundleIdentifier)
if app.state == .runningForeground {
return app
}
for bundleIdentifier in installedApps {
let app = XCUIApplication(bundleIdentifier: bundleIdentifier)
if app.state == .runningForeground {
return app
}
return self.springboard
}
return self.springboard
}
}

Expand Down Expand Up @@ -849,12 +849,14 @@
return NativeView.fromXCUIElement(child, bundleId)
})
}

static func fromXCUIElementSnapshot(_ xcuielement: XCUIElementSnapshot, _ bundleId: String) -> NativeView {

static func fromXCUIElementSnapshot(_ xcuielement: XCUIElementSnapshot, _ bundleId: String)
-> NativeView
{
return NativeView(
className: getElementTypeName(elementType: xcuielement.elementType),
text: xcuielement.label,
contentDescription: "", // TODO: Separate request
contentDescription: "", // TODO: Separate request
focused: xcuielement.hasFocus,
enabled: xcuielement.isEnabled,
resourceName: xcuielement.identifier,
Expand All @@ -863,6 +865,6 @@
return NativeView.fromXCUIElementSnapshot(child, bundleId)
})
}
}
}

#endif
Loading

0 comments on commit 8d359c1

Please sign in to comment.