Skip to content

Commit 46ce4a9

Browse files
gosha212noomorphd4vidi
authored
Yarn/enable e2e (#8148)
* fixed android build * fixed android build * Fixed android app * Moved e2e test to playground * Fixed jest tests * Fixed tests execution * Fixed tests execution on buildkite * Fixed detox tests * removed yarn build * Fixed test execution on ios * Fixed codegen * Fixed Android Tests * test: fix jest tests * Fixed test implementation * Fixe ios execution script * Fixe ios build * Fixed version upgrade script * Force publish * Force publish * Fixed hoist dependency * Undo wait * Update playground/package.json Co-authored-by: d4vidi <amit.d4vidi@gmail.com> * Upgraded to run the tests on Android 35 --------- Co-authored-by: Yaroslav Serhieiev <yaroslavs@wix.com> Co-authored-by: d4vidi <amit.d4vidi@gmail.com>
1 parent 0c78fdb commit 46ce4a9

File tree

67 files changed

+16293
-21618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+16293
-21618
lines changed

.buildkite/jobs/pipeline.publish.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
if: "build.pull_request.id == null"
66
command:
77
- "nvm install"
8-
- "npm install"
9-
- "npm run release"
10-
depends_on:
11-
- ios
12-
- android
8+
- "./scripts/ci.sh"
9+
- "yarn run release"
1310
timeout_in_minutes: 90
1411

1512

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,18 @@ website/package-lock.json
238238
artifacts/
239239

240240
# Navigation mocks
241-
lib/Mock/*.js
242-
lib/Mock/*.d.ts
241+
lib/*
243242
Mock.js
244243
Mock.d.ts
245244

246245
Gemfile.lock
247246
/playground/ios/.xcode.env.local
247+
248+
# Yarn
249+
.yarn/*
250+
!.yarn/patches
251+
!.yarn/plugins
252+
!.yarn/releases
253+
!.yarn/sdks
254+
!.yarn/versions
255+

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
nmHoistingLimits: workspaces
3+

ReactNativeNavigation.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
66
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
77

88
# Detect if this is a Swift project by looking for user AppDelegate.swift files
9-
start_dir = File.expand_path('../../', __dir__)
9+
start_dir = File.expand_path('../', __dir__)
1010
swift_delegate_path = nil
1111
Find.find(start_dir) do |path|
1212
if path =~ /AppDelegate\.swift$/
@@ -39,12 +39,12 @@ Pod::Spec.new do |s|
3939

4040
s.subspec 'Core' do |ss|
4141
s.source = { :git => "https://github.com/wix/react-native-navigation.git", :tag => "#{s.version}" }
42-
s.source_files = 'lib/ios/**/*.{h,m,mm,cpp}'
43-
s.exclude_files = "lib/ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
42+
s.source_files = 'ios/**/*.{h,m,mm,cpp}'
43+
s.exclude_files = "ios/ReactNativeNavigationTests/**/*.*", "lib/ios/OCMock/**/*.*"
4444
# Only expose headers for Swift projects
4545
if swift_project
4646
s.public_header_files = [
47-
'lib/ios/RNNAppDelegate.h'
47+
'ios/RNNAppDelegate.h'
4848
]
4949
end
5050
end

android/app/build.gradle

Lines changed: 0 additions & 146 deletions
This file was deleted.

android/build.gradle

Lines changed: 132 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1+
import groovy.json.JsonSlurper
2+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
23

34
buildscript {
45
ext {
@@ -21,13 +22,13 @@ buildscript {
2122
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
2223
classpath("com.facebook.react:react-native-gradle-plugin")
2324
classpath 'com.android.tools.build:gradle'
24-
// NOTE: Do not place your application dependencies here; they belong
25-
// in the individual module build.gradle files
2625
}
2726
}
2827

2928
allprojects {
3029
repositories {
30+
google()
31+
mavenCentral()
3132
maven { url "$rootDir/../../node_modules/detox/Detox-android" }
3233
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
3334
flatDir {
@@ -36,12 +37,135 @@ allprojects {
3637
}
3738
}
3839

39-
subprojects {
40-
afterEvaluate { p ->
41-
if (p.hasProperty('android')) {
42-
android {
43-
buildToolsVersion rootProject.ext.buildToolsVersion
40+
apply plugin: 'com.android.library'
41+
apply plugin: 'kotlin-android'
42+
apply plugin: "com.facebook.react"
43+
44+
45+
def safeExtGet(prop, fallback) {
46+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
47+
}
48+
49+
def safeExtGetFallbackLowerBound(prop, fallback) {
50+
Math.max(safeExtGet(prop, fallback), fallback)
51+
}
52+
53+
def DEFAULT_COMPILE_SDK_VERSION = 35
54+
def DEFAULT_MIN_SDK_VERSION = 24
55+
def DEFAULT_TARGET_SDK_VERSION = 35
56+
def DEFAULT_KOTLIN_VERSION = "1.5.31"
57+
def DEFAULT_KOTLIN_STDLIB = 'kotlin-stdlib-jdk8'
58+
def DEFAULT_BUILD_TOOLS_VERSION = "35.0.0"
59+
def kotlinVersion = safeExtGet("RNNKotlinVersion", DEFAULT_KOTLIN_VERSION)
60+
def kotlinStdlib = safeExtGet('RNNKotlinStdlib', DEFAULT_KOTLIN_STDLIB)
61+
def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2')
62+
def _buildToolsVersion = safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
63+
64+
android {
65+
namespace 'com.reactnativenavigation'
66+
compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
67+
buildToolsVersion = _buildToolsVersion
68+
defaultConfig {
69+
minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
70+
targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
71+
72+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
73+
}
74+
buildTypes {
75+
release {
76+
minifyEnabled false
77+
}
78+
debug {
79+
minifyEnabled false
80+
}
81+
}
82+
lintOptions {
83+
abortOnError false
84+
}
85+
86+
testOptions {
87+
managedDevices {
88+
localDevices {
89+
pixel3aapi34 {
90+
device = "Pixel 3a"
91+
apiLevel = 34
92+
systemImageSource = "aosp-atd"
93+
}
4494
}
4595
}
96+
unitTests.includeAndroidResources = true
97+
unitTests.all { t ->
98+
maxHeapSize = "4g"
99+
testLogging {
100+
events "PASSED", "SKIPPED", "FAILED"
101+
exceptionFormat TestExceptionFormat.FULL
102+
showExceptions true
103+
showCauses true
104+
showStackTraces true
105+
}
106+
afterSuite { desc, result ->
107+
if (!desc.parent) { // will match the outermost suite
108+
def output = " ${result.resultType} (${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped) "
109+
def repeatLength = output.length()
110+
println '\n\n' + ('-' * repeatLength) + '\n' + output + '\n' + ('-' * repeatLength) + '\n'
111+
112+
println "see report at file://${t.reports.html.outputLocation}/index.html"
113+
}
114+
}
115+
}
116+
}
117+
compileOptions {
118+
sourceCompatibility JavaVersion.VERSION_17
119+
targetCompatibility JavaVersion.VERSION_17
120+
}
121+
kotlinOptions {
122+
jvmTarget = JavaVersion.VERSION_17
123+
}
124+
}
125+
126+
dependencies {
127+
implementation "androidx.core:core-ktx:1.6.0"
128+
implementation "org.jetbrains.kotlin:$kotlinStdlib:$kotlinVersion"
129+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesCore"
130+
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
131+
132+
implementation 'androidx.appcompat:appcompat:1.7.0'
133+
implementation 'androidx.annotation:annotation:1.2.0'
134+
implementation 'com.google.android.material:material:1.2.0-alpha03'
135+
136+
implementation 'com.github.wix-playground:ahbottomnavigation:4.0.0'
137+
implementation 'com.github.Dimezis:BlurView:version-3.0.0'
138+
implementation 'com.github.wix-playground:reflow-animator:1.0.6'
139+
implementation 'com.github.clans:fab:1.6.4'
140+
141+
//noinspection GradleDynamicVersion
142+
implementation 'com.facebook.react:react-native:+'
143+
144+
if ("Playground".toLowerCase() == rootProject.name.toLowerCase()) {
145+
// tests only for our playground
146+
testImplementation 'junit:junit:4.13.2'
147+
testImplementation "org.robolectric:robolectric:4.14.1"
148+
testImplementation 'org.assertj:assertj-core:3.11.1'
149+
testImplementation 'org.mockito:mockito-core:4.0.0'
150+
testImplementation 'com.squareup.assertj:assertj-android:1.2.0'
151+
testImplementation 'org.mockito:mockito-inline:4.6.1'
152+
testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
153+
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
154+
155+
// Core testing libraries
156+
androidTestImplementation "androidx.test.ext:junit:1.2.1"
157+
androidTestImplementation 'org.assertj:assertj-core:3.11.1'
158+
159+
androidTestImplementation "androidx.test.espresso:espresso-core:3.6.1"
160+
161+
androidTestImplementation "com.linkedin.dexmaker:dexmaker-mockito-inline:2.28.4"
162+
androidTestImplementation 'org.opentest4j:opentest4j:1.2.0'
163+
androidTestImplementation ("org.mockito.kotlin:mockito-kotlin:5.4.0") {
164+
exclude group: 'org.mockito', module: 'mockito-core'
165+
}
166+
167+
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.3.0"
168+
169+
androidTestImplementation("com.facebook.react:hermes-android")
46170
}
47171
}

android/src/androidTest/java/com/reactnativenavigation/TestApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.facebook.react.ReactPackage
66
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
77
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
88
import com.facebook.react.shell.MainReactPackage
9-
import com.reactnativenavigation.react.NavigationPackage
9+
import com.reactnativenavigation.NavigationPackage
1010
import com.reactnativenavigation.react.NavigationReactNativeHost
1111

1212
class TestApplication : NavigationApplication() {

android/src/main/java/com/reactnativenavigation/NavigationApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void onCreate() {
5252
* of {@link ReactGateway}. For example, subclasses may wish to provide a custom {@link ReactNativeHost}
5353
* with the ReactGateway. This method will be called exactly once, in the application's {@link #onCreate()} method.
5454
*
55-
* Custom {@link ReactNativeHost}s must be sure to include {@link com.reactnativenavigation.react.NavigationPackage}
55+
* Custom {@link ReactNativeHost}s must be sure to include {@link com.reactnativenavigation.NavigationPackage}
5656
*
5757
* @return a singleton {@link ReactGateway}
5858
*/

0 commit comments

Comments
 (0)