Skip to content

test: add e2e tests for Crashlytics #6559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/crashlytics-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Firebase Crashlytics E2E Tests

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}

env:
CRASHLYTICS_E2E_GOOGLE_SERVICES: ${{ secrets.SESSIONS_E2E_GOOGLE_SERVICES }}

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout firebase-crashlytics
uses: actions/[email protected]

- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: "17"
distribution: "temurin"
cache: gradle

- name: Add google-services.json
run: |
echo $CRASHLYTICS_E2E_GOOGLE_SERVICES | base64 -d > google-services.json

- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }}

- uses: google-github-actions/setup-gcloud@v2

- name: Run Crashlytics end-to-end tests
env:
FTL_RESULTS_BUCKET: crashlytics-test-results
run: |
./gradlew :firebase-crashlytics:test-app:deviceCheck withErrorProne -PtargetBackend="prod" -PtriggerCrashes
2 changes: 2 additions & 0 deletions firebase-crashlytics/firebase-crashlytics.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ dependencies {
testImplementation(libs.robolectric)
testImplementation(libs.truth)
testImplementation(project(":integ-testing"))
testImplementation("io.mockk:mockk:1.13.8")


androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.runner)
Expand Down
1 change: 1 addition & 0 deletions firebase-crashlytics/test-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/google-services.json
25 changes: 25 additions & 0 deletions firebase-crashlytics/test-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Firebase Crashlytics Test App

## Setup

Download the `google-services.json` file
from [Firebase Console](https://console.firebase.google.com/) (for whatever Firebase project you
have or want to integrate the `test-app`) and store it under the current directory.

Note: The [Package name](https://firebase.google.com/docs/android/setup#register-app) for your app
created on the Firebase Console (for which the `google-services.json` is downloaded) must match
the [applicationId](https://developer.android.com/studio/build/application-id.html) declared in
the `test-app/test-app.gradle.kts` for the app to link to Firebase.

## Running

Run the test app directly from Android Studio by selecting and running
the `firebase-crashlytics.test-app` run configuration.

## Terminal

Alternatively, you can run the test app from the terminal using the following command:

```bash
./gradlew :firebase-crashlytics:test-app:connectedAndroidTest --info
```
1 change: 1 addition & 0 deletions firebase-crashlytics/test-app/multidex-config.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-keep class com.google.firebase.** { *; }
28 changes: 28 additions & 0 deletions firebase-crashlytics/test-app/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2023 Google LLC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="1"
android:versionName="1.0.0">

<application>

</application>

<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator" />

</manifest>
Loading
Loading