Skip to content
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

test: add e2e tests for Crashlytics #6559

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 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
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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be removed, was using to attempt to mock a few things but I found it was not needed



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
17 changes: 17 additions & 0 deletions firebase-crashlytics/test-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.
61 changes: 61 additions & 0 deletions firebase-crashlytics/test-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
//kotlin("android") version "1.9.0" apply false
}

android {
namespace = "com.example.test_app"
compileSdk = 35

defaultConfig {
applicationId = "com.example.test_app"
minSdk = 24
targetSdk = 35
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
buildFeatures {
viewBinding = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
//implementation(libs.firebase.crashlytics.ktx)
testImplementation(libs.junit)
testImplementation("io.mockk:mockk:1.13.8")
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation("androidx.test.uiautomator:uiautomator:2.2.0")
androidTestImplementation("com.google.truth:truth:1.1.3")
implementation("androidx.navigation:navigation-fragment-ktx:2.6.0")
implementation("androidx.navigation:navigation-ui-ktx:2.6.0")
implementation("com.google.firebase:firebase-common-ktx:21.0.0")
implementation("com.google.firebase:firebase-crashlytics-ktx:19.2.1")
implementation("androidx.multidex:multidex:2.0.1")
}
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.** { *; }
21 changes: 21 additions & 0 deletions firebase-crashlytics/test-app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
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