Skip to content

Commit

Permalink
Merge branch 'wixMaster' into eh-custom-detox
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnguyenduc committed Feb 19, 2024
2 parents 5beb113 + 8cbce5d commit 235bd59
Show file tree
Hide file tree
Showing 312 changed files with 7,716 additions and 4,532 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"
13 changes: 13 additions & 0 deletions .buildkite/jobs/pipeline.android_demo_app_rn_73.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- label: ":android::react: RN .73 + Android: Demo app"
command:
- "nvm install"
- "./scripts/demo-projects.android.sh"
env:
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"
1 change: 1 addition & 0 deletions .buildkite/jobs/pipeline.android_rn_71.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
REACT_NATIVE_VERSION: 0.71.10
DETOX_DISABLE_POD_INSTALL: true
DETOX_DISABLE_POSTINSTALL: true
SKIP_UNIT_TESTS: true
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,12 +1,12 @@
- label: ":android::detox: RN .70 + Android: Tests app"
- label: ":android::detox: RN .73 + Android: Tests app"
command:
- "nvm install"
- "./scripts/ci.android.sh"
env:
REACT_NATIVE_VERSION: 0.70.7
REACT_NATIVE_VERSION: 0.73.2
DETOX_DISABLE_POD_INSTALL: true
DETOX_DISABLE_POSTINSTALL: true
SKIP_UNIT_TESTS: 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. 70 + iOS: Demo app"
- label: ":ios::react: RN .73 + iOS: Demo app"
command:
- "nvm install"
- "./scripts/demo-projects.ios.sh"
env:
REACT_NATIVE_VERSION: 0.70.7
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 .70 + iOS: Tests app"
- label: ":ios::detox: RN .73 + iOS: Tests app"
command:
- "nvm install"
- "./scripts/ci.ios.sh"
env:
REACT_NATIVE_VERSION: 0.70.7
REACT_NATIVE_VERSION: 0.73.2
artifact_paths:
- "/Users/builder/work/coverage/**/*.lcov"
- "/Users/builder/work/**/allure-report-*.html"
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipeline.release.fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
env:
DETOX_DISABLE_POSTINSTALL: true
DETOX_DISABLE_POD_INSTALL: true
JAVA_HOME: /opt/openjdk/jdk-17.0.9.jdk/Contents/Home/
artifact_paths: "/Users/builder/work/detox/Detox-android/**/*"

- label: ":shipit: Publish"
Expand Down
9 changes: 5 additions & 4 deletions .buildkite/pipeline_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

echo "steps:"

cat .buildkite/jobs/pipeline.ios_rn_73.yml
cat .buildkite/jobs/pipeline.ios_rn_71.yml
cat .buildkite/jobs/pipeline.ios_rn_70.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_73.yml
cat .buildkite/jobs/pipeline.android_rn_71.yml
cat .buildkite/jobs/pipeline.android_rn_70.yml
cat .buildkite/jobs/pipeline.android_demo_app_rn_73.yml
cat .buildkite/jobs/pipeline.android_demo_app_rn_71.yml
cat .buildkite/jobs/pipeline.ios_demo_app_rn_71.yml
cat .buildkite/jobs/pipeline.ios_demo_app_rn_70.yml
cat .buildkite/pipeline.post_processing.yml
20 changes: 18 additions & 2 deletions .github/workflows/rapid-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
node-version-file: '.nvmrc'
- name: Bootstrap Lerna
run: npx lerna@3 bootstrap --no-ci
run: npx lerna@6 bootstrap --no-ci
env:
DETOX_DISABLE_POD_INSTALL: true
DETOX_DISABLE_POSTINSTALL: true
Expand All @@ -47,6 +47,13 @@ jobs:
- name: Generation tests
run: npm test
working-directory: generation
- name: Pack Allure results
run: zip -r allure-results.zip detox/allure-results detox/test/allure-results generation/allure-results
- name: Upload Allure results
uses: actions/upload-artifact@v3
with:
name: allure-results-linux
path: allure-results.zip

windows:
name: Windows
Expand All @@ -57,7 +64,7 @@ jobs:
with:
node-version-file: '.nvmrc'
- name: Bootstrap Lerna (Light)
run: npx lerna@3 bootstrap --no-ci --include-dependents --include-dependencies --scope=detox-test
run: npx lerna@6 bootstrap --no-ci --include-dependents --include-dependencies --scope=detox-test
env:
DETOX_DISABLE_POD_INSTALL: true
DETOX_DISABLE_POSTINSTALL: true
Expand All @@ -67,3 +74,12 @@ jobs:
- name: Integration tests
run: npm run integration
working-directory: detox/test
- name: Pack Allure results
run: |
Compress-Archive -Path detox/allure-results -DestinationPath allure-results.zip
shell: pwsh
- name: Upload Allure results
uses: actions/upload-artifact@v3
with:
name: allure-results-windows
path: allure-results.zip
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
lts/iron
1 change: 1 addition & 0 deletions .xcoderc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
15.1
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Detox
</h1>
<p align="center">
<b>Gray box end-to-end testing and automation library for mobile apps.</b>
<b>Gray box end-to-end testing and automation framework for mobile apps.</b>
</p>
<p align="center">
<img alt="Demo" src="docs/img/Detox.gif"/>
Expand All @@ -24,15 +24,19 @@ This is a test for a login screen, it runs on a device/simulator like an actual

```js
describe('Login flow', () => {
it('should login successfully', async () => {
beforeEach(async () => {
await device.reloadReactNative();
});

it('should login successfully', async () => {
await element(by.id('email')).typeText('[email protected]');
await element(by.id('password')).typeText('123456');
await element(by.text('Login')).tap();

await expect(element(by.text('Welcome'))).toBeVisible();
await expect(element(by.id('email'))).toNotExist();
const loginButton = element(by.text('Login'));
await loginButton.tap();

await expect(loginButton).not.toExist();
await expect(element(by.label('Welcome'))).toBeVisible();
});
});
```
Expand Down
1 change: 1 addition & 0 deletions detox/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.d.ts
/src/android/espressoapi/**/*.js
/coverage
/ios
Expand Down
6 changes: 1 addition & 5 deletions detox/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
'eslint:recommended',
'plugin:import/recommended',
'plugin:node/recommended',
'plugin:ecmascript-compat/recommended'
'plugin:ecmascript-compat/recommended',
],
parser: '@typescript-eslint/parser',
plugins: [
Expand All @@ -16,10 +16,6 @@ module.exports = {
env: {
node: true
},
globals: {
// TODO: remove use of fail() across the project because Jest Circus doesn't support it
'fail': true
},
rules: {
'@typescript-eslint/no-unused-vars': [
'warn',
Expand Down
20 changes: 6 additions & 14 deletions detox/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@ buildscript {

ext {
isOfficialDetoxLib = true
kotlinVersion = '1.6.21'
dokkaVersion = '1.6.0'
buildToolsVersion = '33.0.0'
compileSdkVersion = 33
targetSdkVersion = 33
kotlinVersion = '1.8.0'
dokkaVersion = '1.9.10'
buildToolsVersion = '34.0.0'
compileSdkVersion = 34
targetSdkVersion = 34
minSdkVersion = 21

if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
ext.detoxKotlinVersion = ext.kotlinVersion

Expand All @@ -28,7 +20,7 @@ buildscript {
if (!rnInfo.isRN71OrNewer) {
classpath "com.facebook.react:react-native-gradle-plugin"
}
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"

Expand Down
48 changes: 37 additions & 11 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 All @@ -20,9 +20,15 @@ def _rnNativeArtifact = rnInfo.isRN71OrHigher
? "com.facebook.react:react-android:${rnInfo.version}"
: 'com.facebook.react:react-native:+'

println "[$project] Resorted to RN native artifact $_rnNativeArtifact"

android {
compileSdkVersion _compileSdkVersion
buildToolsVersion _buildToolsVersion
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
if (agpVersion >= 7) {
namespace "com.wix.detox"
}
compileSdk _compileSdkVersion
buildToolsVersion = _buildToolsVersion

defaultConfig {
minSdkVersion _minSdkVersion
Expand All @@ -33,7 +39,7 @@ android {
consumerProguardFiles 'proguard-rules.pro'
}

flavorDimensions 'detox'
flavorDimensions = ['detox']
productFlavors {
full {
dimension 'detox'
Expand All @@ -48,7 +54,7 @@ android {
unitTests.returnDefaultValues = true
unitTests.all { t ->
reports {
html.enabled true
html.required = true
}
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
Expand All @@ -59,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 @@ -76,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 All @@ -97,13 +123,13 @@ dependencies {
// Versions are in-sync with the 'androidx-test-1.4.0' release/tag of the android-test github repo,
// used by the Detox generator. See https://github.com/android/android-test/releases/tag/androidx-test-1.4.0
// Important: Should remain so when generator tag is replaced!
api('androidx.test.espresso:espresso-core:3.4.0') {
api('androidx.test.espresso:espresso-core:3.5.1') {
because 'Needed all across Detox but also makes Espresso seamlessly provided to Detox users with hybrid apps/E2E-tests.'
}
api('androidx.test.espresso:espresso-web:3.4.0') {
api('androidx.test.espresso:espresso-web:3.5.1') {
because 'Web-View testing'
}
api('androidx.test.espresso:espresso-contrib:3.4.0') {
api('androidx.test.espresso:espresso-contrib:3.5.1') {
because 'Android datepicker support'
exclude group: "org.checkerframework", module: "checker"
}
Expand Down Expand Up @@ -145,8 +171,8 @@ 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.robolectric:robolectric:4.4'
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.2.1'
testImplementation 'org.robolectric:robolectric:4.11.1'

testImplementation("com.google.android.material:material:$_materialMinVersion") {
because 'Material components are mentioned explicitly (e.g. Slider in get-attributes handler)'
Expand Down
6 changes: 6 additions & 0 deletions detox/android/detox/proguard-rules-app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@
-keep class kotlin.text.** { *; }
-keep class kotlin.io.** { *; }
-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.**
8 changes: 4 additions & 4 deletions detox/android/detox/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ tasks.named("dokkaJavadoc") {
// suppression config var or something.
task dokkaDocJar(type: Jar, dependsOn: dokkaJavadoc) {
from "$buildDir/dokkaDoc"
classifier = 'javadoc'
archiveClassifier.set("javadoc")
}

/*
Expand All @@ -119,7 +119,7 @@ task dokkaDocJar(type: Jar, dependsOn: dokkaJavadoc) {

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
archiveClassifier.set("sources")
}

/*
Expand Down 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
Loading

0 comments on commit 235bd59

Please sign in to comment.