Skip to content

[MOB-9674] fix-integration-tests #586

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

Open
wants to merge 89 commits into
base: 2.0.0-alpha/MOB-9673-fix-unit-tests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
61662a8
Add Detox configuration and tests; update package dependencies and Gr…
lposen Oct 16, 2024
9747ed5
Add network security configuration; update Gradle wrapper and source …
lposen Oct 16, 2024
c9421f7
Enhance login functionality and update test cases; add Detox types an…
lposen Oct 16, 2024
5e8d16d
Update integration test workflow to install dependencies for example …
lposen Oct 16, 2024
f7670a1
Add Detox CI workflow for iOS and Android; update package scripts for…
lposen Oct 16, 2024
3a8cde0
Fix path for Pod install in Detox CI workflow
lposen Oct 16, 2024
a4bd21d
Update Node.js setup in Detox CI workflow to use version from .nvmrc
lposen Oct 16, 2024
cb86083
Update GitHub Actions workflow and package scripts for testing and co…
lposen Oct 16, 2024
deb4a70
Refactor CI workflows to trigger only on pull requests and add setup …
lposen Oct 16, 2024
46993b3
Remove global Yarn installation and dependency installation steps fro…
lposen Oct 16, 2024
1e03b87
Add coverage locations to test-and-publish workflow and set global co…
lposen Oct 16, 2024
0b60067
Update CI workflows to enable triggers for push and pull requests on …
lposen Oct 16, 2024
57e4b60
Lower global coverage thresholds in package.json to 10% for branches …
lposen Oct 16, 2024
d945808
Update Code Climate action version and adjust coverage location format
lposen Oct 16, 2024
5e722bd
Refactor test-and-publish workflow to run tests and generate coverage…
lposen Oct 16, 2024
98c75d4
Add Code Climate test job to CI workflow for coverage reporting
lposen Oct 16, 2024
5678009
Update Code Climate configuration and improve README with badges
lposen Oct 16, 2024
562863d
Add ESLint and other plugins to Code Climate configuration
lposen Oct 16, 2024
110d5bc
Add commitlint configuration and update lefthook settings for linting
lposen Oct 16, 2024
c36d101
Update Detox workflow to improve artifact paths and add verbose build…
lposen Oct 16, 2024
faba310
Update Node.js version in .nvmrc to v20.10.0
lposen Oct 16, 2024
ceebc47
Add new Detox workflow for iOS end-to-end testing and update existing…
lposen Oct 16, 2024
c5d08b6
Refactor Detox workflow to use example directory for Yarn and CocoaPo…
lposen Oct 16, 2024
0042b1c
Update Ruby version in Detox workflow to 2.6.10
lposen Oct 16, 2024
9c7385e
Add environment variable for Detox configuration in iOS workflow
lposen Oct 16, 2024
6acba1e
Update integration test workflow to use Xcode 14.3.1 and streamline d…
lposen Oct 16, 2024
87bfa0d
Add installation step for Applesimutils in integration test workflow
lposen Oct 16, 2024
4a68d90
Add detox and react-native CLI installation steps to integration test…
lposen Oct 16, 2024
ca39dbe
Replace yarn with npm for global installation of detox and react-nati…
lposen Oct 16, 2024
4bd77e1
Update iOS simulator device type to iPhone SE (3rd generation) in Det…
lposen Oct 16, 2024
a92375b
Add step to start Metro Server in integration test workflow
lposen Oct 16, 2024
d5acb3b
Update integration test workflow to trigger only on pull requests
lposen Oct 16, 2024
2fd5ac3
Add step to build Detox in integration test workflow
lposen Oct 16, 2024
66ae58a
Fix build command for Detox in integration test workflow
lposen Oct 16, 2024
bad25ca
Add step to upload Detox artifacts in integration test workflow
lposen Oct 16, 2024
479f548
Add step to build the app before Detox in integration test workflow
lposen Oct 16, 2024
93ae7c8
Add doctor step to integration test workflow and update Detox command…
lposen Oct 16, 2024
2365352
Update integration test workflow to run doctor command in example dir…
lposen Oct 16, 2024
29f2a5e
Update integration test workflows to reference example directory for …
lposen Oct 16, 2024
dfbb361
Update test and component to improve login flow and visibility checks
lposen Oct 16, 2024
61247f6
Refactor Detox workflow to improve directory navigation and add docto…
lposen Oct 16, 2024
0b8b035
Add ios-deploy installation step to Detox workflow
lposen Oct 16, 2024
73888b6
Update package.json to configure Detox plugin and add Jest environmen…
lposen Oct 16, 2024
a364685
Update yarn install command to use --frozen-lockfile option for bette…
lposen Oct 16, 2024
9baee4c
Checking if ios build works for default files
lposen Oct 16, 2024
a3e9afd
Refactor CodeBlock component to accept height as a prop and update us…
lposen Oct 16, 2024
48db651
Replace hardcoded API key and user ID in e2e test with environment va…
lposen Oct 16, 2024
4b554a6
commenting lint and tsc for now
lposen Oct 16, 2024
4489eb1
Refactor CodeBlock component to rename height prop to blockHeight and…
lposen Oct 16, 2024
a8d58d3
Remove integration testing files and configurations
lposen Oct 16, 2024
531763f
Update CI workflows to enable push events on main branch and upgrade …
lposen Oct 16, 2024
5ef7f22
Add killall command for XCBBuildService before xcodebuild in Detox CI…
lposen Oct 16, 2024
6e00bc5
Update .gitignore to exclude local environment files and remove unuse…
lposen Oct 16, 2024
91b3ed0
Remove redundant killall command for XCBBuildService in Detox CI work…
lposen Oct 16, 2024
9b32b26
Add CircleCI configuration for Detox testing on iOS and Android
lposen Oct 16, 2024
838ae6b
Update CircleCI configuration: upgrade Node, Android, React Native, a…
lposen Oct 16, 2024
fd5139f
Fix xcodebuild command to use -verbose flag for improved logging
lposen Oct 16, 2024
4aacc86
Refactor Detox CI workflow: remove unused main.jsbundle generation st…
lposen Oct 16, 2024
5b06aed
Update Detox CI workflows: use --frozen-lockfile for Yarn installs an…
lposen Oct 16, 2024
9b2f0ba
Update Detox CI workflow: install detox-cli and react-native-cli, add…
lposen Oct 16, 2024
d95a9c7
Refactor CI workflows: consolidate lint and test jobs, remove depreca…
lposen Oct 16, 2024
e1d223f
Refactor CI workflows: streamline installation steps, consolidate job…
lposen Oct 16, 2024
6d4ce1e
Update CI workflow: add Yarn installation and caching steps for impro…
lposen Oct 16, 2024
a5d1670
Update Detox CI workflow: add Metro server start and run Detox tests …
lposen Oct 16, 2024
d5f69ed
Update CI workflow: enhance iOS setup by installing ios-deploy, detox…
lposen Oct 16, 2024
061aa28
Update CI workflow: persist only node_modules and example/node_module…
lposen Oct 16, 2024
08a897b
Refactor CI workflow: comment out redundant caching and installation …
lposen Oct 16, 2024
9887a1a
Refactor CI workflow: remove commented-out steps for improved clarity
lposen Oct 16, 2024
f596d5f
Remove CircleCI configuration file as part of CI workflow cleanup
lposen Oct 16, 2024
96a05d2
Add CircleCI configuration file for CI workflow setup
lposen Oct 16, 2024
9475bbc
Refactor CI workflow: remove commented-out steps for future test inte…
lposen Oct 16, 2024
ad3701f
Fix CI workflow command: update detox test command for consistency
lposen Oct 16, 2024
966344c
Add integration test workflow and update configuration files
lposen Oct 17, 2024
c9ad35b
Remove redundant Detox test steps from CI workflow and add missing de…
lposen Oct 17, 2024
6815c79
Add Detox rebuild step to CI workflow and format package.json
lposen Oct 17, 2024
0d62930
Update Detox rebuild step to use yarn commands in example directory
lposen Oct 17, 2024
d211cb3
Add device listing and doctor check to integration test workflow
lposen Oct 17, 2024
f1cbb3f
Refactor CI workflows by commenting out unused steps for unit tests a…
lposen Oct 17, 2024
511060f
Comment out unused steps in Android Detox test workflow for clarity
lposen Oct 17, 2024
3e8c311
Add e2e-iOS workflow for Detox testing on macOS
lposen Oct 17, 2024
3b544f9
Set Ruby version to 2.6.10 in e2e workflow
lposen Oct 17, 2024
e5562e9
Add Detox iOS test workflow and install necessary dependencies
lposen Oct 17, 2024
7164c6f
Update Detox build process and modify app launch configuration for sy…
lposen Oct 17, 2024
8dcc21a
Enhance CI configuration for Detox testing on iOS and update workflows
lposen Oct 17, 2024
43a1ee2
Refactor CI workflows: remove deprecated test workflows and add unit …
lposen Oct 17, 2024
1521875
Add Textlint configuration and dependencies for markdown linting
lposen Oct 17, 2024
34cc21d
Update reviewdog workflow: enhance configuration, upgrade actions, an…
lposen Oct 17, 2024
9128cfb
Remove deprecated reviewdog workflow configuration
lposen Oct 17, 2024
d2e0ddd
Clean up CircleCI configuration: remove commented-out sections and un…
lposen Oct 17, 2024
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
83 changes: 83 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
version: 2.1

orbs:
node: circleci/[email protected]

references:
machine_config: &machine_config
machine:
image: default

defaults: &defaults
resource_class: large
working_directory: ~/react-native-sdk
docker:
- image: cimg/node:20.10

executors:
detox-executor:
macos:
xcode: "14.3.1" # Use the appropriate Xcode version for your project

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
xcode: "14.3.1" # Use the appropriate Xcode version for your project
xcode: '14.3.1' # Use the appropriate Xcode version for your project

working_directory: ~/react-native-sdk

jobs:
detox:
<<: *defaults
executor: detox-executor
steps:
- checkout

- run:
name: Install Node.js
command: |
node -v
npm -v

- run:
name: Install Yarn
command: |
npm install -g yarn
yarn -v

- run:
name: Install Detox CLI
command: |
npm install -g detox-cli

- run:
name: Install Project Dependencies
command: |
yarn install

- run:
name: Install Example Dependencies
command: |
cd example
yarn install
cd ..

- run:
name: Install iOS Dependencies
command: |
cd example/ios
pod install
cd ../..

- run:
name: Build the App for Detox
command: |
cd example
detox build --configuration ios.sim.release
cd ..

- run:
name: Run Detox Tests
command: |
cd example
detox test --configuration ios.sim.release
cd ..

workflows:
detox-tests:
jobs:
- detox

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
- detox
- detox

21 changes: 18 additions & 3 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
version: "2"
exclude_patterns:
- ".*/"
# - ".*/"
- "docs/"
- "integration-testing/"
- "**/node_modules/"
- "SampleApp/"
- "scripts/"
- "**/__mocks__/"
- "**/__tests__/"
Expand All @@ -21,3 +19,20 @@ exclude_patterns:
- "**/*.yml"
- "**/build.gradle"
- "**/AndroidManifest.xml"
plugins:
eslint:
enabled: true
editorconfig:
enabled: true
fixme:
enabled: true
git-legal:
enabled: true
shellcheck:
enabled: true
swiftlint:
enabled: true
tailor:
enabled: true
tslint:
enabled: true
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ runs:

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
run: yarn install --immutable --frozen-lockfile
shell: bash
248 changes: 248 additions & 0 deletions .github/workflows/detox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
name: Run Detox Tests
on: [pull_request]

jobs:
find-test-files:
name: Find Detox test files
runs-on: macos-latest
outputs:
test-files: ${{ steps.set-test-files.outputs.test-files }}
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Find test files
id: set-test-files
run: |

Choose a reason for hiding this comment

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

[actionlint] reported by reviewdog 🐶
shellcheck reported issue in this script: SC2086:info:2:34: Double quote to prevent globbing and word splitting [shellcheck]

TEST_FILES=$(find example/e2e -name '*.test.js' | sed 's|example/e2e/||g' | jq -R -s -c 'split("\n")[:-1]')
echo "test-files=$TEST_FILES" >> $GITHUB_OUTPUT
build-ios:
name: iOS - Build app for Detox tests
runs-on: macos-14

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup
uses: ./.github/actions/setup

- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.10
bundler-cache: true

- name: Install ios-deploy, detox, react-native-cli
run: npm install -g ios-deploy detox-cli react-native-cli

- name: Install Applesimutils
run: |
brew tap wix/brew
brew install applesimutils
Comment on lines +43 to +44

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
brew tap wix/brew
brew install applesimutils
brew tap wix/brew
brew install applesimutils


- name: Example App Yarn install
run: |
cd example
yarn install --frozen-lockfile
cd ..

- uses: actions/cache@v4
id: cache
with:
path: |
example/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

- name: Pod install
run: |
cd example/ios
pod install
cd ../..

- name: Build Detox
run: yarn example detox:ios:build

- name: Upload iOS app
uses: actions/upload-artifact@v4
with:
name: ios-app-artifact
path: example/ios/build/Build/Products/Debug-iphonesimulator/ReactNativeSdkExample.app
retention-days: 1

build-android:
name: Android - Build app for Detox tests
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: false

- name: Setup
uses: ./.github/actions/setup

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
cache-read-only: false

- name: Example App Yarn install
run: |
cd example
yarn install
cd ..

- name: Build Detox
run: yarn example detox:android:build

- name: Upload Android app
uses: actions/upload-artifact@v4
with:
name: android-app-artifact
path: example/android/app/build/outputs/apk
retention-days: 1

run-ios-detox-tests:
needs: [build-ios, find-test-files]
name: iOS - Run Detox tests
runs-on: macos-14

strategy:
fail-fast: false
matrix:
test-file: ${{ fromJson(needs.find-test-files.outputs.test-files) }}

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Download iOS app
uses: actions/download-artifact@v4
with:
name: ios-app-artifact
path: example/ios/build/Build/Products/Debug-iphonesimulator/ReactNativeSdkExample.app

- name: Setup
uses: ./.github/actions/setup

- name: Install ios-deploy, detox, react-native-cli
run: npm install -g ios-deploy detox-cli react-native-cli

- name: Install Applesimutils
run: |
brew tap wix/brew
brew install applesimutils
Comment on lines +156 to +157

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
brew tap wix/brew
brew install applesimutils
brew tap wix/brew
brew install applesimutils


- name: Rebuild Detox
run: |
cd example
yarn detox rebuild-framework-cache
cd ..

- name: Start Metro Server
env:
ITBL_API_KEY: ${{secrets.ITERABLE_API_KEY}}
ITBL_ID: ${{secrets.ITBL_ID}}
run: cd example && yarn detox:start &

- name: Run Detox tests
env:
ITBL_API_KEY: ${{secrets.ITERABLE_API_KEY}}
ITBL_ID: ${{secrets.ITBL_ID}}
run: yarn detox:ios:test:ci -- ${{ matrix.test-file }}

- name: Upload Test Artifact - GitHub Action
if: failure()
uses: actions/upload-artifact@v4
with:
name: detox-ios-artifacts-${{ matrix.test-file }}
path: example/artifacts
retention-days: 1

run-android-detox-tests:
needs: [build-android, find-test-files]
name: Android - Run Detox tests
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
test-file: ${{ fromJson(needs.find-test-files.outputs.test-files) }}

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
test-file: ${{ fromJson(needs.find-test-files.outputs.test-files) }}
test-file: ${{ fromJson(needs.find-test-files.outputs.test-files) }}


steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: false

- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Download Android app
uses: actions/download-artifact@v4
with:
name: android-app-artifact
path: example/android/app/build/outputs/apk

- name: Setup
uses: ./.github/actions/setup

- name: Start Metro Server
env:
ITBL_API_KEY: ${{secrets.ITERABLE_API_KEY}}
ITBL_ID: ${{secrets.ITBL_ID}}
run: yarn detox:start &

- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Run Detox tests
uses: reactivecircus/android-emulator-runner@v2
env:
ITBL_API_KEY: ${{secrets.ITERABLE_API_KEY}}
ITBL_ID: ${{secrets.ITBL_ID}}
with:
api-level: 31
arch: x86_64
avd-name: Pixel_3a_API_34
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-metrics
disable-animations: false
script: yarn detox:android:test:ci -- ${{ matrix.test-file }}

- name: Upload Test Artifact - GitHub Action
if: failure()
uses: actions/upload-artifact@v4
with:
name: detox-android-artifacts-${{ matrix.test-file }}
path: example/artifacts
retention-days: 1

Choose a reason for hiding this comment

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

[prettier] reported by reviewdog 🐶

Suggested change
retention-days: 1
retention-days: 1

Loading
Loading