[tests] wip test infra
@ -59,3 +59,25 @@ detox test --configuration ios.sim.debug
|
||||
```
|
||||
|
||||
This action will open a new simulator and run the tests on it.
|
||||
|
||||
### TODO
|
||||
|
||||
Gradle issues... https://stackoverflow.com/questions/46917365/error-could-not-initialize-class-com-android-sdklib-repository-androidsdkhandle?rq=1
|
||||
|
||||
mac: `export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"`
|
||||
windows `"C://Program Files/Java/jdk_1.x_"`
|
||||
|
||||
android sdk root `export ANDROID_SDK_ROOT="/Users/mike/Library/Android/sdk"`
|
||||
|
||||
Add platform-tools to your path
|
||||
|
||||
echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
|
||||
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile
|
||||
|
||||
Name: TestingAVD
|
||||
|
||||
CPU/ABI: null (null)
|
||||
|
||||
Path: /Users/mike/.android/avd/Actually_THIS_one.avd
|
||||
|
||||
Error: Failed to parse properties from /Users/mike/.android/avd/Actually_THIS_one.avd/config.ini
|
||||
|
10
tests-new/android/.editorconfig
Normal file
@ -0,0 +1,10 @@
|
||||
# editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
@ -5,7 +5,7 @@ apply plugin: 'io.fabric'
|
||||
import com.android.build.OutputFile
|
||||
|
||||
project.ext.react = [
|
||||
entryFile: "index.js"
|
||||
entryFile: "index.js"
|
||||
]
|
||||
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
@ -14,89 +14,108 @@ def enableSeparateBuildPerCPUArchitecture = false
|
||||
def enableProguardInReleaseBuilds = false
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion '27.0.2'
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion '27.0.2'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.detox.rn.example"
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
|
||||
testBuildType System.getProperty('testBuildType', 'debug')
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
missingDimensionStrategy "minReactNative", "minReactNative46"
|
||||
multiDexEnabled true
|
||||
}
|
||||
splits {
|
||||
abi {
|
||||
reset()
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk false // If true, also generate a universal APK
|
||||
include "armeabi-v7a", "x86"
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file("keystore.jks")
|
||||
storePassword "12345678"
|
||||
keyAlias "key0"
|
||||
keyPassword "12345678"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
// applicationVariants are e.g. debug, release
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
// For each separate APK per architecture, set a unique version code as described here:
|
||||
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
|
||||
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
|
||||
def abi = output.getFilter(OutputFile.ABI)
|
||||
if (abi != null) { // null for the universal-debug, universal-release variants
|
||||
output.versionCodeOverride =
|
||||
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
|
||||
}
|
||||
}
|
||||
defaultConfig {
|
||||
applicationId "com.testing"
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 27
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
exclude 'META-INF/NOTICE'
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/LICENSE.txt'
|
||||
exclude 'META-INF/NOTICE.txt'
|
||||
testBuildType System.getProperty('testBuildType', 'debug')
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
missingDimensionStrategy "minReactNative", "minReactNative46"
|
||||
multiDexEnabled true
|
||||
}
|
||||
splits {
|
||||
abi {
|
||||
reset()
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk false // If true, also generate a universal APK
|
||||
include "armeabi-v7a", "x86"
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file("keystore.jks")
|
||||
storePassword "12345678"
|
||||
keyAlias "key0"
|
||||
keyPassword "12345678"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
// applicationVariants are e.g. debug, release
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
// For each separate APK per architecture, set a unique version code as described here:
|
||||
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
|
||||
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
|
||||
def abi = output.getFilter(OutputFile.ABI)
|
||||
if (abi != null) { // null for the universal-debug, universal-release variants
|
||||
output.versionCodeOverride =
|
||||
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
exclude 'META-INF/NOTICE'
|
||||
exclude 'META-INF/LICENSE'
|
||||
exclude 'META-INF/LICENSE.txt'
|
||||
exclude 'META-INF/NOTICE.txt'
|
||||
}
|
||||
}
|
||||
|
||||
project.ext.firebaseVersion = '11.8.0'
|
||||
project.ext.firebaseVersion = '12.0.0'
|
||||
|
||||
dependencies {
|
||||
implementation "com.android.support:appcompat-v7:27.0.2"
|
||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation "com.facebook.react:react-native:+"
|
||||
implementation(project(':react-native-firebase')) {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
compile project(':react-native-firebase')
|
||||
|
||||
androidTestImplementation(project(path: ":detox"))
|
||||
androidTestImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
||||
androidTestImplementation 'com.android.support.test:rules:1.0.1'
|
||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||
compile "com.google.android.gms:play-services-base:$firebaseVersion"
|
||||
// compile "com.google.firebase:firebase-ads:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-auth:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-config:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-core:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-crash:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-database:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-messaging:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-perf:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-storage:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-firestore:$firebaseVersion"
|
||||
compile "com.google.firebase:firebase-invites:$firebaseVersion"
|
||||
compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
|
||||
transitive = true
|
||||
}
|
||||
compile "com.android.support:appcompat-v7:27.1.0"
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
androidTestImplementation(project(path: ":detox"))
|
||||
androidTestImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
||||
androidTestImplementation 'com.android.support.test:rules:1.0.1'
|
||||
}
|
||||
|
||||
// Run this once to be able to run the application with BUCK
|
||||
// puts all compile dependencies into folder libs for BUCK to use
|
||||
task copyDownloadableDepsToLibs(type: Copy) {
|
||||
from configurations.compile
|
||||
into 'libs'
|
||||
from configurations.compile
|
||||
into 'libs'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
@ -1,27 +1,38 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "305229645282",
|
||||
"firebase_url": "https://rnfirebase-b9ad4.firebaseio.com",
|
||||
"project_id": "rnfirebase-b9ad4",
|
||||
"storage_bucket": "rnfirebase-b9ad4.appspot.com"
|
||||
"project_number": "17067372085",
|
||||
"firebase_url": "https://rnfirebase-5579a.firebaseio.com",
|
||||
"project_id": "rnfirebase",
|
||||
"storage_bucket": "rnfirebase.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:305229645282:android:efe37851d57e1d05",
|
||||
"mobilesdk_app_id": "1:17067372085:android:efe37851d57e1d05",
|
||||
"android_client_info": {
|
||||
"package_name": "com.reactnativefirebasedemo"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "305229645282-j8ij0jev9ut24odmlk9i215pas808ugn.apps.googleusercontent.com",
|
||||
"client_id": "17067372085-ltes2e70ehnlp4s5bl7uljuqvjul2l9s.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.reactnativefirebasedemo",
|
||||
"certificate_hash": "34d770365973b7580e04dab50692506aff7bd32f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "17067372085-n572o9802h9jbv9oo60h53117pk9333k.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCzbBYFyX8d6VdSu7T4s10IWYbPc-dguwM"
|
||||
"current_key": "AIzaSyB-z0ytgXRRiClvslJl0tp-KbhDub9o6AM"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyAJw8mR1fPcEYC9ouZbkCStJufcCQrhmjQ"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
@ -29,8 +40,74 @@
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "17067372085-n572o9802h9jbv9oo60h53117pk9333k.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "17067372085-siujfe334vool17t2mtrmjrsgl81nhd9.apps.googleusercontent.com",
|
||||
"client_type": 2,
|
||||
"ios_info": {
|
||||
"bundle_id": "com.invertase.RNFirebaseTests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:17067372085:android:af36d4d29a83e04c",
|
||||
"android_client_info": {
|
||||
"package_name": "com.testing"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "17067372085-066pi4ln798odtdrifoktb3mea9dtipt.apps.googleusercontent.com",
|
||||
"client_type": 1,
|
||||
"android_info": {
|
||||
"package_name": "com.testing",
|
||||
"certificate_hash": "34d770365973b7580e04dab50692506aff7bd32f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_id": "17067372085-n572o9802h9jbv9oo60h53117pk9333k.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyB-z0ytgXRRiClvslJl0tp-KbhDub9o6AM"
|
||||
},
|
||||
{
|
||||
"current_key": "AIzaSyAJw8mR1fPcEYC9ouZbkCStJufcCQrhmjQ"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 2,
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "17067372085-n572o9802h9jbv9oo60h53117pk9333k.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
},
|
||||
{
|
||||
"client_id": "17067372085-siujfe334vool17t2mtrmjrsgl81nhd9.apps.googleusercontent.com",
|
||||
"client_type": 2,
|
||||
"ios_info": {
|
||||
"bundle_id": "com.invertase.RNFirebaseTests"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example;
|
||||
package com.testing;
|
||||
|
||||
import android.support.test.filters.LargeTest;
|
||||
import android.support.test.rule.ActivityTestRule;
|
@ -1,31 +1,71 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
package="com.testing">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
android:targetSdkVersion="22" />
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name="com.testing.MainApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppTheme">
|
||||
<service
|
||||
android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService" android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
|
||||
|
||||
<receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver"/>
|
||||
<receiver android:enabled="true" android:exported="true" android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
|
||||
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- App Links -->
|
||||
<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:host="je786.app.goo.gl" android:scheme="http"/>
|
||||
<data android:host="je786.app.goo.gl" android:scheme="https"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
|
||||
|
||||
<activity
|
||||
android:name="com.testing.MainActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
@ -1,15 +0,0 @@
|
||||
package com.example;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
|
||||
public class MainActivity extends ReactActivity {
|
||||
|
||||
/**
|
||||
* Returns the name of the main component registered from JavaScript.
|
||||
* This is used to schedule rendering of the component.
|
||||
*/
|
||||
@Override
|
||||
protected String getMainComponentName() {
|
||||
return "example";
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.example;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.facebook.react.ReactApplication;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MainApplication extends Application implements ReactApplication {
|
||||
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
||||
@Override
|
||||
public boolean getUseDeveloperSupport() {
|
||||
return BuildConfig.DEBUG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
return Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public ReactNativeHost getReactNativeHost() {
|
||||
return mReactNativeHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
SoLoader.init(this, /* native exopackage */ false);
|
||||
}
|
||||
|
||||
}
|
80
tests-new/android/app/src/main/java/com/testing/MainActivity.java
Executable file
@ -0,0 +1,80 @@
|
||||
package com.testing;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
|
||||
public class MainActivity extends ReactActivity {
|
||||
|
||||
public static final int PERMISSION_REQ_CODE = 1234;
|
||||
public static final int OVERLAY_PERMISSION_REQ_CODE = 1235;
|
||||
|
||||
String[] perms = {
|
||||
"android.permission.READ_EXTERNAL_STORAGE",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the name of the main component registered from JavaScript.
|
||||
* This is used to schedule rendering of the component.
|
||||
*/
|
||||
@Override
|
||||
protected String getMainComponentName() {
|
||||
return "testing";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// checkWindowPerms();
|
||||
}
|
||||
|
||||
public void checkWindowPerms() {
|
||||
// Checking if device version > 22 and we need to use new permission model
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
// Checking if we can draw window overlay
|
||||
if (!Settings.canDrawOverlays(this)) {
|
||||
// Requesting permission for window overlay(needed for all react-native apps)
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:" + getPackageName()));
|
||||
startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
|
||||
}
|
||||
for (String perm : perms) {
|
||||
// Checking each permission and if denied then requesting permissions
|
||||
if (checkSelfPermission(perm) == PackageManager.PERMISSION_DENIED) {
|
||||
requestPermissions(perms, PERMISSION_REQ_CODE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Window overlay permission intent result
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
|
||||
checkWindowPerms();
|
||||
}
|
||||
}
|
||||
|
||||
// Permission results
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int permsRequestCode, String[] permissions, int[] grantResults) {
|
||||
switch (permsRequestCode) {
|
||||
case PERMISSION_REQ_CODE:
|
||||
// example how to get result of permissions requests (there can be more then one permission dialog)
|
||||
// boolean readAccepted = grantResults[0]==PackageManager.PERMISSION_GRANTED;
|
||||
// boolean writeAccepted = grantResults[1]==PackageManager.PERMISSION_GRANTED;
|
||||
// checking permissions to prevent situation when user denied some permission
|
||||
checkWindowPerms();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
73
tests-new/android/app/src/main/java/com/testing/MainApplication.java
Executable file
@ -0,0 +1,73 @@
|
||||
package com.testing;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.facebook.react.ReactApplication;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
import io.invertase.firebase.RNFirebasePackage;
|
||||
//import io.invertase.firebase.admob.RNFirebaseAdMobPackage;
|
||||
import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage;
|
||||
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
|
||||
import io.invertase.firebase.config.RNFirebaseRemoteConfigPackage;
|
||||
import io.invertase.firebase.crash.RNFirebaseCrashPackage;
|
||||
import io.invertase.firebase.database.RNFirebaseDatabasePackage;
|
||||
import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage;
|
||||
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;
|
||||
import io.invertase.firebase.instanceid.RNFirebaseInstanceIdPackage;
|
||||
import io.invertase.firebase.invites.RNFirebaseInvitesPackage;
|
||||
import io.invertase.firebase.links.RNFirebaseLinksPackage;
|
||||
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
|
||||
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
|
||||
import io.invertase.firebase.perf.RNFirebasePerformancePackage;
|
||||
import io.invertase.firebase.storage.RNFirebaseStoragePackage;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MainApplication extends Application implements ReactApplication {
|
||||
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
||||
@Override
|
||||
public boolean getUseDeveloperSupport() {
|
||||
return BuildConfig.DEBUG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
return Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage(),
|
||||
new RNFirebasePackage(),
|
||||
// new RNFirebaseAdMobPackage(),
|
||||
new RNFirebaseAnalyticsPackage(),
|
||||
new RNFirebaseAuthPackage(),
|
||||
new RNFirebaseRemoteConfigPackage(),
|
||||
new RNFirebaseCrashPackage(),
|
||||
new RNFirebaseCrashlyticsPackage(),
|
||||
new RNFirebaseDatabasePackage(),
|
||||
new RNFirebaseFirestorePackage(),
|
||||
new RNFirebaseInstanceIdPackage(),
|
||||
new RNFirebaseInvitesPackage(),
|
||||
new RNFirebaseLinksPackage(),
|
||||
new RNFirebaseMessagingPackage(),
|
||||
new RNFirebaseNotificationsPackage(),
|
||||
new RNFirebasePerformancePackage(),
|
||||
new RNFirebaseStoragePackage()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public ReactNativeHost getReactNativeHost() {
|
||||
return mReactNativeHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
SoLoader.init(this, /* native exopackage */ false);
|
||||
}
|
||||
|
||||
}
|
BIN
tests-new/android/app/src/main/res/drawable-hdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 5.1 KiB |
BIN
tests-new/android/app/src/main/res/drawable-mdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 3.0 KiB |
BIN
tests-new/android/app/src/main/res/drawable-xhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 7.1 KiB |
BIN
tests-new/android/app/src/main/res/drawable-xxhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
tests-new/android/app/src/main/res/drawable-xxxhdpi/ic_launcher.png
Executable file
After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 7.5 KiB |
@ -1,3 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">example</string>
|
||||
<string name="app_name">RNF Test</string>
|
||||
</resources>
|
||||
|
@ -1,49 +1,50 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
maven {
|
||||
url 'https://maven.fabric.io/public'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath 'com.google.gms:google-services:3.1.2'
|
||||
classpath 'com.google.firebase:firebase-plugins:1.1.1'
|
||||
classpath 'io.fabric.tools:gradle:1.25.1'
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
maven {
|
||||
url 'https://maven.fabric.io/public'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath 'com.google.gms:google-services:3.1.2'
|
||||
classpath 'com.google.firebase:firebase-plugins:1.1.1'
|
||||
classpath 'io.fabric.tools:gradle:1.25.1'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
google()
|
||||
maven {
|
||||
url "$projectDir/../../node_modules/react-native/android"
|
||||
}
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
google()
|
||||
maven {
|
||||
url "$rootDir/../node_modules/react-native/android"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
ext {
|
||||
compileSdk = 27
|
||||
buildTools = "27.0.2"
|
||||
minSdk = 18
|
||||
targetSdk = 26
|
||||
}
|
||||
ext {
|
||||
compileSdk = 27
|
||||
buildTools = "27.0.2"
|
||||
minSdk = 18
|
||||
targetSdk = 26
|
||||
}
|
||||
|
||||
afterEvaluate { project ->
|
||||
if (!project.name.equalsIgnoreCase("app")
|
||||
&& project.hasProperty("android")) {
|
||||
android {
|
||||
compileSdkVersion compileSdk
|
||||
buildToolsVersion buildTools
|
||||
defaultConfig {
|
||||
minSdkVersion minSdk
|
||||
targetSdkVersion targetSdk
|
||||
}
|
||||
}
|
||||
afterEvaluate { project ->
|
||||
if (!project.name.equalsIgnoreCase("app")
|
||||
&& project.hasProperty("android")) {
|
||||
android {
|
||||
compileSdkVersion compileSdk
|
||||
buildToolsVersion buildTools
|
||||
defaultConfig {
|
||||
minSdkVersion minSdk
|
||||
targetSdkVersion targetSdk
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
0
tests-new/android/gradle/wrapper/gradle-wrapper.jar
vendored
Executable file → Normal file
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip
|
||||
|
@ -1,4 +1,4 @@
|
||||
rootProject.name = 'DetoxRNExample'
|
||||
rootProject.name = 'RNFTests'
|
||||
include ':react-native-firebase'
|
||||
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, './../../android')
|
||||
|
||||
|
@ -5,51 +5,34 @@
|
||||
*/
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
AppRegistry,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
TouchableOpacity
|
||||
} from 'react-native';
|
||||
import rnModule, { AppRegistry, Text, View } from 'react-native';
|
||||
|
||||
class example extends Component {
|
||||
import testModule from './firebase';
|
||||
|
||||
class Root extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
greeting: undefined
|
||||
};
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (global.__initializeEnvironment) {
|
||||
console.log('Initializing environment...');
|
||||
global.__initializeEnvironment({
|
||||
root: this,
|
||||
rnModule,
|
||||
testModule,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.greeting) return this.renderAfterButton();
|
||||
return (
|
||||
<View testID='welcome' style={{flex: 1, paddingTop: 20, justifyContent: 'center', alignItems: 'center'}}>
|
||||
<Text style={{fontSize: 25, marginBottom: 30}}>
|
||||
Welcome
|
||||
</Text>
|
||||
<TouchableOpacity testID='hello_button' onPress={this.onButtonPress.bind(this, 'Hello')}>
|
||||
<Text style={{color: 'blue', marginBottom: 20}}>Say Hello</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity testID='world_button' onPress={this.onButtonPress.bind(this, 'World')}>
|
||||
<Text style={{color: 'blue', marginBottom: 20}}>Say World</Text>
|
||||
</TouchableOpacity>
|
||||
<View>
|
||||
<Text>React Native Firebase Test App</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
renderAfterButton() {
|
||||
return (
|
||||
<View style={{flex: 1, paddingTop: 20, justifyContent: 'center', alignItems: 'center'}}>
|
||||
<Text style={{fontSize: 25}}>
|
||||
{this.state.greeting}!!!
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
onButtonPress(greeting) {
|
||||
this.setState({
|
||||
greeting: greeting
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
AppRegistry.registerComponent('example', () => example);
|
||||
AppRegistry.registerComponent('testing', () => Root);
|
||||
|
@ -1,19 +1,31 @@
|
||||
describe('Example', () => {
|
||||
// describe('Example', () => {
|
||||
// beforeEach(async () => {
|
||||
// await device.reloadReactNative();
|
||||
// });
|
||||
//
|
||||
// it('should have welcome screen', async () => {
|
||||
// await expect(element(by.id('welcome'))).toBeVisible();
|
||||
// });
|
||||
//
|
||||
// it('should show hello screen after tap', async () => {
|
||||
// await element(by.id('hello_button')).tap();
|
||||
// await expect(element(by.text('Hello!!!'))).toBeVisible();
|
||||
// });
|
||||
//
|
||||
// it('should show world screen after tap', async () => {
|
||||
// await element(by.id('world_button')).tap();
|
||||
// await expect(element(by.text('World!!!'))).toBeVisible();
|
||||
// });
|
||||
// });
|
||||
|
||||
describe('should work inside node', () => {
|
||||
beforeEach(async () => {
|
||||
await device.reloadReactNative();
|
||||
});
|
||||
|
||||
it('should have welcome screen', async () => {
|
||||
await expect(element(by.id('welcome'))).toBeVisible();
|
||||
|
||||
it('should require', () => {
|
||||
const firebase = bridge.module;
|
||||
// const { Platform } = bridge.rnModule;
|
||||
should.equal(firebase.auth.nativeModuleExists, true);
|
||||
});
|
||||
|
||||
it('should show hello screen after tap', async () => {
|
||||
await element(by.id('hello_button')).tap();
|
||||
await expect(element(by.text('Hello!!!'))).toBeVisible();
|
||||
});
|
||||
|
||||
it('should show world screen after tap', async () => {
|
||||
await element(by.id('world_button')).tap();
|
||||
await expect(element(by.text('World!!!'))).toBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,3 +1,5 @@
|
||||
--delay
|
||||
--recursive
|
||||
--timeout 120000
|
||||
--bail
|
||||
--bail
|
||||
--require bridge
|
||||
|
8903
tests-new/package-lock.json
generated
Normal file
@ -3,7 +3,8 @@
|
||||
"version": "7.2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node node_modules/react-native/local-cli/cli.js start --platforms ios,android",
|
||||
"start": "REACT_DEBUGGER='todo' node node_modules/react-native/local-cli/cli.js start --platforms ios,android --skipflow",
|
||||
"start-ci": "REACT_DEBUGGER='todo' node node_modules/react-native/local-cli/cli.js start --platforms ios,android --skipflow --nonPersistent",
|
||||
"android:dev": "react-native run-android",
|
||||
"android:prod": "react-native run-android --configuration=release",
|
||||
"ios:dev": "react-native run-ios",
|
||||
@ -51,13 +52,13 @@
|
||||
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
|
||||
"build": "pushd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && popd",
|
||||
"type": "android.emulator",
|
||||
"name": "Nexus_5X_API_24_-_GPlay"
|
||||
"name": "TestingAVD"
|
||||
},
|
||||
"android.emu.release": {
|
||||
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
|
||||
"build": "pushd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && popd",
|
||||
"type": "android.emulator",
|
||||
"name": "Nexus_5X_API_24_-_GPlay"
|
||||
"name": "TestingAVD"
|
||||
}
|
||||
}
|
||||
}
|
||||
|