Skip to content

Commit

Permalink
Merge pull request #2547 from leancodepl/add-mocking-location
Browse files Browse the repository at this point in the history
Add mock location
  • Loading branch information
pdenert authored Mar 5, 2025
2 parents bc38432 + ca4fd31 commit 1186c34
Show file tree
Hide file tree
Showing 35 changed files with 923 additions and 24 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/prepare-e2e_app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ jobs:
run: .\gradlew.bat :patrol:ktlintFormat

- name: Build app with Gradle
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: .\gradlew.bat :app:assembleDebug

- name: Build app with Flutter tool
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: flutter build apk --debug

prepare-android-on-linux:
Expand Down Expand Up @@ -108,9 +112,13 @@ jobs:
run: ./gradlew :patrol:ktlintFormat

- name: Build app with Gradle
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: ./gradlew :app:assembleDebug

- name: Build app with Flutter tool
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: flutter build apk --debug

prepare-ios:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-android-emulator-webview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ jobs:
run: dart pub global activate --source path . && patrol

- name: Generate Gradle wrapper
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: flutter build apk --config-only

- name: Install ew-cli
Expand All @@ -104,6 +106,8 @@ jobs:
echo "INCLUDED_TESTS=$target_paths" >> "$GITHUB_ENV"
- name: patrol build android
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: patrol build android --target ${{ env.INCLUDED_TESTS }} --verbose

- name: Upload APKs to emulator.wtf and wait for tests to finish
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-android-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ jobs:
run: dart pub global activate --source path . && patrol

- name: Generate Gradle wrapper
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: flutter build apk --config-only

- name: Install ew-cli
Expand Down Expand Up @@ -114,6 +116,8 @@ jobs:
echo "EXCLUDED_TESTS=$target_paths" >> "$GITHUB_ENV"
- name: patrol build android
env:
MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
run: |
patrol build android --exclude ${{ env.EXCLUDED_TESTS }} \
--dart-define-from-file=defines_1.json --dart-define-from-file=defines_2.json --dart-define-from-file=defines_3.env \
Expand Down
3 changes: 3 additions & 0 deletions dev/e2e_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ android {
targetSdk 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
manifestPlaceholders = [
mapsApiKey: System.getenv("MAPS_API_KEY") ?: ""
]
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: "true"
}
Expand Down
18 changes: 10 additions & 8 deletions dev/e2e_app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
Expand All @@ -15,7 +16,6 @@

<application
android:label="example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down Expand Up @@ -48,17 +48,19 @@
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:exported="false"
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2"/>
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="${mapsApiKey}"/>
</application>
</manifest>
Loading

0 comments on commit 1186c34

Please sign in to comment.