Skip to content

Commit

Permalink
Revert "Rn73 revert (#4380)"
Browse files Browse the repository at this point in the history
This reverts commit e56e9d9.
  • Loading branch information
d4vidi authored and gosha212 committed Mar 7, 2024
1 parent a97c48d commit 125f7b5
Show file tree
Hide file tree
Showing 61 changed files with 648 additions and 527 deletions.
2 changes: 1 addition & 1 deletion .buildkite/jobs/pipeline.android_demo_app_rn_71.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
- "./scripts/demo-projects.android.sh"
env:
REACT_NATIVE_VERSION: 0.71.10
REACT_NATIVE_COMPAT_TEST: true # Only set 'true' in jobs with the latest supported RN
DETOX_DISABLE_POD_INSTALL: true
DETOX_DISABLE_POSTINSTALL: true
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
artifact_paths:
- "/Users/builder/work/coverage/**/*.lcov"
- "/Users/builder/work/artifacts*.tar.gz"
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
- label: ":android::react: RN .72 + Android: Demo app"
- label: ":android::react: RN .73 + Android: Demo app"
command:
- "nvm install"
- "./scripts/demo-projects.android.sh"
env:
REACT_NATIVE_VERSION: 0.72.8
REACT_NATIVE_VERSION: 0.73.2
REACT_NATIVE_COMPAT_TEST: true # Only set 'true' in jobs with the latest supported RN
DETOX_DISABLE_POD_INSTALL: true
DETOX_DISABLE_POSTINSTALL: true
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
artifact_paths:
- "/Users/builder/work/coverage/**/*.lcov"
- "/Users/builder/work/artifacts*.tar.gz"
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
- label: ":android::detox: RN .72 + Android: Tests app"
- label: ":android::detox: RN .73 + Android: Tests app"
command:
- "nvm install"
- "./scripts/ci.android.sh"
env:
REACT_NATIVE_VERSION: 0.72.8
REACT_NATIVE_VERSION: 0.73.2
DETOX_DISABLE_POD_INSTALL: true
DETOX_DISABLE_POSTINSTALL: true
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
artifact_paths:
- "/Users/builder/work/coverage/**/*.lcov"
- "/Users/builder/work/**/allure-report-*.html"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- label: ":ios::react: RN .72 + iOS: Demo app"
- label: ":ios::react: RN .73 + iOS: Demo app"
command:
- "nvm install"
- "./scripts/demo-projects.ios.sh"
env:
REACT_NATIVE_VERSION: 0.72.8
REACT_NATIVE_VERSION: 0.73.2
artifact_paths:
- "/Users/builder/work/coverage/**/*.lcov"
- "/Users/builder/work/artifacts*.tar.gz"
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- label: ":ios::detox: RN .72 + iOS: Tests app"
- label: ":ios::detox: RN .73 + iOS: Tests app"
command:
- "nvm install"
- "./scripts/ci.ios.sh"
env:
REACT_NATIVE_VERSION: 0.72.8
REACT_NATIVE_VERSION: 0.73.2
artifact_paths:
- "/Users/builder/work/coverage/**/*.lcov"
- "/Users/builder/work/**/allure-report-*.html"
Expand Down
8 changes: 4 additions & 4 deletions .buildkite/pipeline_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

echo "steps:"

cat .buildkite/jobs/pipeline.ios_rn_72.yml
cat .buildkite/jobs/pipeline.ios_rn_73.yml
cat .buildkite/jobs/pipeline.ios_rn_71.yml
cat .buildkite/jobs/pipeline.ios_demo_app_rn_72.yml
cat .buildkite/jobs/pipeline.ios_demo_app_rn_73.yml
cat .buildkite/jobs/pipeline.ios_demo_app_rn_71.yml
cat .buildkite/jobs/pipeline.android_rn_72.yml
cat .buildkite/jobs/pipeline.android_rn_73.yml
cat .buildkite/jobs/pipeline.android_rn_71.yml
cat .buildkite/jobs/pipeline.android_demo_app_rn_72.yml
cat .buildkite/jobs/pipeline.android_demo_app_rn_73.yml
cat .buildkite/jobs/pipeline.android_demo_app_rn_71.yml
cat .buildkite/pipeline.post_processing.yml
8 changes: 4 additions & 4 deletions detox/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ buildscript {

ext {
isOfficialDetoxLib = true
kotlinVersion = '1.6.21'
kotlinVersion = '1.8.0'
dokkaVersion = '1.9.10'
buildToolsVersion = '33.0.0'
compileSdkVersion = 33
targetSdkVersion = 33
buildToolsVersion = '34.0.0'
compileSdkVersion = 34
targetSdkVersion = 34
minSdkVersion = 21
}
ext.detoxKotlinVersion = ext.kotlinVersion
Expand Down
26 changes: 23 additions & 3 deletions detox/android/detox/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
apply from: '../rninfo.gradle'

def _kotlinMinVersion = '1.2.0'
def _materialMinVersion = '1.2.1'
def _materialMinVersion = '1.11.0'

def _ext = rootProject.ext
def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 31
Expand Down Expand Up @@ -65,7 +65,7 @@ android {
def repeatLength = output.length()
println '\n' + ('-' * repeatLength) + '\n' + output + '\n' + ('-' * repeatLength) + '\n'

println "see report at file://${t.reports.html.destination}/index.html"
println "see report at file://${t.reports.html.outputLocation}/index.html"
}
}
}
Expand All @@ -82,6 +82,26 @@ android {
lintOptions {
abortOnError false
}

if (rnInfo.isRN72OrHigher) {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}
} else {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = '11'
}
}
}

// In a nutshell:
Expand Down Expand Up @@ -151,7 +171,7 @@ dependencies {
testImplementation 'org.assertj:assertj-core:3.16.1'
testImplementation "org.jetbrains.kotlin:kotlin-test:$_kotlinVersion"
testImplementation 'org.apache.commons:commons-io:1.3.2'
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0'
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.2.1'
testImplementation 'org.robolectric:robolectric:4.11.1'

testImplementation("com.google.android.material:material:$_materialMinVersion") {
Expand Down
4 changes: 4 additions & 0 deletions detox/android/detox/proguard-rules-app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@
-keep class okhttp3.** { *; }

-keep class androidx.concurrent.futures.** { *; }

-dontwarn androidx.appcompat.**
-dontwarn javax.lang.model.element.**

3 changes: 3 additions & 0 deletions detox/android/detox/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@

-keep class com.wix.detoxprofiler.** { *; }
-dontnote com.wix.detox.instruments.reflected.**

-dontwarn androidx.appcompat.**
-dontwarn javax.lang.model.element.**
4 changes: 2 additions & 2 deletions detox/android/detox/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ publishing {

// Register sources, javadoc as published artifacts (via equivalent tasks' output)
artifact sourcesJar
artifact dokkaDocJar
//artifact dokkaDocJar // waiting for dokka to fix https://github.com/Kotlin/dokka/issues/3153

// Also register source, javadoc as archive-artifacts, for signing
declareArchive sourcesJar
declareArchive dokkaDocJar
//declareArchive dokkaDocJar // waiting for dokka to fix https://github.com/Kotlin/dokka/issues/3153

// Add detox package metadata to the .pom
pom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public static ViewAction setDatePickerDate(String dateString, String formatStrin
return PickerActions.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
}

public static ViewAction adjustSliderToPosition(final double newPosition) {
public static ViewAction adjustSliderToPosition(final Float newPosition) {
return new AdjustSliderToPositionAction(newPosition);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.wix.detox.espresso.common.ReactSliderHelper
import org.hamcrest.Matcher
import org.hamcrest.Matchers

class AdjustSliderToPositionAction(private val targetPositionPct: Double) : ViewAction {
class AdjustSliderToPositionAction(private val targetPositionPct: Float) : ViewAction {
override fun getDescription() = "adjustSliderToPosition"
override fun getConstraints(): Matcher<View?>? =
Matchers.allOf( isDisplayed(), isAssignableFrom(AppCompatSeekBar::class.java) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ abstract class ReactSliderHelper(protected val slider: AppCompatSeekBar) {
}

// TODO Make this more testable (e.g. by delegating the set action away)
fun setProgressPct(valuePct: Double) {
fun setProgressPct(valuePct: Float) {
val maxJSProgress = calcMaxJSProgress()
val valueJS = valuePct * maxJSProgress
setProgressJS(valueJS)
setProgressJS(valueJS.toFloat())
}

protected abstract fun setProgressJS(valueJS: Double)
protected abstract fun setProgressJS(valueJS: Float)

private fun calcMaxJSProgress(): Double {
val nativeProgress = slider.progress.toDouble()
Expand Down Expand Up @@ -60,16 +60,16 @@ abstract class ReactSliderHelper(protected val slider: AppCompatSeekBar) {
}

private class LegacySliderHelper(slider: AppCompatSeekBar): ReactSliderHelper(slider) {
override fun setProgressJS(valueJS: Double) {
override fun setProgressJS(valueJS: Float) {
val reactSliderManager = Class.forName(CLASS_REACT_SLIDER_LEGACY_MANAGER).newInstance()
Reflect.on(reactSliderManager).call("updateProperties", slider, buildStyles("value", valueJS))
Reflect.on(reactSliderManager).call("updateProperties", slider, buildStyles("value", valueJS.toDouble()))
}

private fun buildStyles(vararg keysAndValues: Any) = ReactStylesDiffMap(JavaOnlyMap.of(*keysAndValues))
}

private class CommunitySliderHelper(slider: AppCompatSeekBar): ReactSliderHelper(slider) {
override fun setProgressJS(valueJS: Double) {
override fun setProgressJS(valueJS: Float) {
val reactSliderManager = Class.forName(CLASS_REACT_SLIDER_COMMUNITY_MANAGER).newInstance()
Reflect.on(reactSliderManager).call("setValue", slider, valueJS)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wix.detox.adapters.server
import com.wix.detox.TestEngineFacade
import com.wix.detox.inquiry.DetoxBusyResource
import com.wix.detox.inquiry.DetoxBusyResourceDescription
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify
Expand Down Expand Up @@ -42,16 +43,17 @@ object QueryStatusActionHandlerSpec : Spek({
}

describe("given a busy app") {
fun aBusyResourceDescription(description: Map<String, Any>): DetoxBusyResourceDescription =
mock {
on { json() }.thenReturn(description)
}


fun aBusyResource(identifier: String): DetoxBusyResource {
val mockedDescription = aBusyResourceDescription(mapOf("mock" to identifier))
return mock {
on { getDescription() }.thenReturn(mockedDescription)

return mock<DetoxBusyResource.BusyIdlingResource> {
on { getDescription() } doReturn DetoxBusyResourceDescription.Builder()
.name("mock")
.addDescription("mock", identifier)
.build()
}

}

it("should send a descriptive busy-status indication") {
Expand All @@ -60,8 +62,8 @@ object QueryStatusActionHandlerSpec : Spek({
val expectedData = mapOf<String, Any>("status" to mapOf(
"app_status" to "busy",
"busy_resources" to listOf(
mapOf("mock" to "some-resource"),
mapOf("mock" to "yet-another-resource"),
mapOf("name" to "mock", "description" to mapOf("mock" to "some-resource")),
mapOf("name" to "mock", "description" to mapOf("mock" to "yet-another-resource"))
)
))
whenever(testEngineFacade.getAllBusyResources()).thenReturn(listOf(busyResource, busyResource2))
Expand All @@ -71,4 +73,4 @@ object QueryStatusActionHandlerSpec : Spek({
}
}
}
})
})
Binary file modified detox/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions detox/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Sun Sep 15 22:36:02 IDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip

33 changes: 24 additions & 9 deletions detox/android/gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
Expand Down Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +198,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand All @@ -205,6 +214,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down

0 comments on commit 125f7b5

Please sign in to comment.