Skip to content

Commit

Permalink
use ASOP
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserfaraazkhan committed Sep 5, 2024
1 parent 456f05b commit c4aa79d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 258 deletions.
257 changes: 0 additions & 257 deletions .github/workflows/e2e-detox-android-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,38 +199,6 @@ jobs:
- name: Cleanup
run: rm android/app/build/outputs/apk/artifact.zip

- name: Launch Android Emulator
run: |
# echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install 'system-images;android-31;google_apis;x86_64'
# echo "no" | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n pixel_6 -k 'system-images;android-31;google_apis;x86_64' --force --device "pixel_6"
# echo "Emulator created successfully"
# nohup $ANDROID_HOME/emulator/emulator -avd pixel_6 -no-snapshot -netdelay none -netspeed full -no-audio -no-boot-anim -accel on -gpu swiftshader_indirect -no-window -qemu -m 8192 > /dev/null 2>&1 &
# $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\''\r'\'') ]]; do sleep 1; done'
echo "Devices list"
# $ANDROID_HOME/platform-tools/adb devices
# $ANDROID_HOME/platform-tools/adb shell input keyevent 82
# $ANDROID_HOME/platform-tools/adb shell settings put global window_animation_scale 0
# $ANDROID_HOME/platform-tools/adb shell settings put global transition_animation_scale 0
# $ANDROID_HOME/platform-tools/adb shell settings put global animator_duration_scale 0
# sleep 120
echo "Taking screenshot"
# screencapture emulator-macos-13.jpg
# $ANDROID_HOME/platform-tools/adb exec-out screencap -p > emulator-macos-13.png
echo "Done launching screenshot"
- uses: actions/upload-artifact@v3
with:
name: Android-Emulator-Screenshots
path: emulator-macos-13.jpg

- uses: actions/upload-artifact@v3
with:
name: Android-Emulator-Screenshots
path: emulator-macos-13.png

- name: Create AVD
run : |
cd detox
Expand All @@ -247,231 +215,6 @@ jobs:
name: android-results-${{ matrix.runId }}
path: detox/artifacts

# test-snapshot:
# runs-on: macos-13
# continue-on-error: true
# timeout-minutes: 40
# needs:
# - generate-specs
# steps:

# - name: Debug info
# run: |
# echo "ANDROID_HOME: $ANDROID_HOME"
# ls -R $ANDROID_HOME
# ls -R ~/.android

# - name: Set up Android SDK and create AVD
# run: |
# echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install 'system-images;android-30;google_apis;x86_64'
# echo "no" | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n pixel_6 -k 'system-images;android-30;google_apis;x86_64' --force --device "pixel_6"

# - name: Configure AVD
# run: |
# echo "hw.ramSize=4096" >> ~/.android/avd/pixel_6.avd/config.ini
# echo "hw.cpu.ncore=2" >> ~/.android/avd/pixel_6.avd/config.ini
# echo "hw.gpu.enabled=true" >> ~/.android/avd/pixel_6.avd/config.ini

# - name: Start Android Emulator
# run: |
# $ANDROID_HOME/emulator/emulator -avd pixel_6 -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim &
# # Wait for the emulator to boot with a timeout
# for i in {1..30}; do
# if $ANDROID_HOME/platform-tools/adb shell getprop sys.boot_completed | grep -m 1 '1'; then
# break
# fi
# echo "Waiting for emulator to boot..."
# sleep 5
# done

# - name: Disable animations
# run: |
# $ANDROID_HOME/platform-tools/adb shell settings put global window_animation_scale 0
# $ANDROID_HOME/platform-tools/adb shell settings put global transition_animation_scale 0
# $ANDROID_HOME/platform-tools/adb shell settings put global animator_duration_scale 0

# - name: Checkout
# uses: actions/checkout@v1
# with:
# fetch-depth: 1
# - name: ci/prepare-node-deps
# uses: ./.github/actions/prepare-node-deps

# - name: Install Sharp CLI for faster image generation during prebuild
# run: npm install --global sharp-cli

# - name: Start React Native Metro Server
# run: npm run start &

# - name: Install Detox Dependencies
# run: cd detox && npm i

# - name: Install Java
# uses: actions/setup-java@v4
# with:
# java-version: "17"
# distribution: "adopt"
# cache: "gradle"

# - name: Create destination path
# run: mkdir -p android/app/build/outputs/apk
# - name: Download artifact
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# curl -L -H "Authorization: token $GITHUB_TOKEN" \
# -H "Accept: application/vnd.github.v3+json" \
# https://api.github.com/repos/mattermost/mattermost-mobile/actions/artifacts/1578521977/zip \
# --output android/app/build/outputs/apk/artifact.zip
# - name: Unzip artifact
# run: unzip android/app/build/outputs/apk/artifact.zip -d android/app/build/outputs/apk
# - name: Cleanup
# run: rm android/app/build/outputs/apk/artifact.zip

# - name: Run Android Detox E2E Tests on macOS
# run: |
# cd detox && npm run e2e:android-test -- about.e2e.ts

# - name: Upload Android Test Report
# if: always()
# uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
# with:
# name: android-results-1
# path: detox/artifacts

# - name: capture
# run: |
# screencapture emulator-macos-13.jpg
# $ANDROID_HOME/platform-tools/adb exec-out screencap -p > emulator-capture-macos-13.png

# - uses: actions/upload-artifact@v3
# with:
# name: Android-Emulator-Screenshots
# path: emulator-macos-13.jpg
# - uses: actions/upload-artifact@v3
# with:
# name: Android-Emulator-Screenshots
# path: emulator-capture-macos-13.png

# detox-e2e-tests:
# runs-on: ubuntu-latest

# steps:
# - name: Checkout
# uses: actions/checkout@v1
# with:
# fetch-depth: 1

# - name: ci/prepare-node-deps
# uses: ./.github/actions/prepare-node-deps

# - name: Install Sharp CLI for faster image generation during prebuild
# run: npm install --global sharp-cli

# - name: Start React Native Metro Server
# run: npm run start &

# - name: Install Detox Dependencies
# run: cd detox && npm i

# - name: Set up JDK
# uses: actions/setup-java@v2
# with:
# distribution: 'zulu'
# java-version: '11'

# - name: Create destination path
# run: mkdir -p android/app/build/outputs/apk
# - name: Download artifact
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# curl -L -H "Authorization: token $GITHUB_TOKEN" \
# -H "Accept: application/vnd.github.v3+json" \
# https://api.github.com/repos/mattermost/mattermost-mobile/actions/artifacts/1578521977/zip \
# --output android/app/build/outputs/apk/artifact.zip
# - name: Unzip artifact
# run: unzip android/app/build/outputs/apk/artifact.zip -d android/app/build/outputs/apk

# - name: Cleanup
# run: rm android/app/build/outputs/apk/artifact.zip

# - name: Download and set up Android SDK
# uses: android-actions/setup-android@v2
# with:
# api-level: 30
# target: default
# arch: x86_64
# profile: default
# emulator-build: system-images;android-30;default;x86_64

# - name: Create AVD and generate snapshot for caching
# uses: reactivecircus/android-emulator-runner@v2
# with:
# # Use the slimmer aosp_atd images for working
# # around "System UI isn't responding" ANR
# # (Application Not Responding) error
# #
# # https://android-developers.googleblog.com/2021/10/whats-new-in-scalable-automated-testing.html#:~:text=Slimmer%20Emulator%20System%20Images
# # https://github.com/ReactiveCircus/android-emulator-runner/issues/129
# # https://github.com/upleveled/hotline-bling-codealong/pull/26#issuecomment-1094659722
# target: aosp_atd
# api-level: 30
# arch: x86
# ram-size: 4096M
# channel: canary
# profile: pixel
# avd-name: Pixel_3a_API_30_AOSP
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# emulator-boot-timeout: 12000
# disable-animations: false
# script: echo "Generated AVD snapshot for caching"

# - name: Start emulator and run Detox integration tests
# uses: reactivecircus/android-emulator-runner@v2
# with:
# target: aosp_atd
# api-level: 30
# arch: x86
# ram-size: 4096M
# channel: canary
# profile: pixel
# avd-name: Pixel_3a_API_30_AOSP
# force-avd-creation: false
# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# emulator-boot-timeout: 12000
# disable-animations: true
# script: cd detox && npm run e2e:android-test -- about.e2e.ts

# # - name: Run Android Detox E2E Tests on macOS
# # run: |
# # cd detox && npm run e2e:android-test -- about.e2e.ts

# - name: Upload Android Test Report
# if: always()
# uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
# with:
# name: android-results-1
# path: detox/artifacts

# - name: capture
# run: |
# screencapture emulator-macos-13.jpg
# $ANDROID_HOME/platform-tools/adb exec-out screencap -p > emulator-capture-macos-13.png

# - uses: actions/upload-artifact@v3
# with:
# name: Android-Emulator-Screenshots
# path: emulator-macos-13.jpg
# - uses: actions/upload-artifact@v3
# with:
# name: Android-Emulator-Screenshots
# path: emulator-capture-macos-13.png

# - name: Stop Android Emulator
# run: adb -s emulator-5554 emu kill

# download-e2e-results:
# runs-on: ubuntu-22.04
# needs:
Expand Down
2 changes: 1 addition & 1 deletion detox/e2e/support/ui/screen/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ServerScreen {
}
}
}
await waitFor(this.usernameInput).toExist().withTimeout(timeouts.ONE_SEC);
await waitFor(this.usernameInput).toExist().withTimeout(timeouts.TEN_SEC);
};

close = async () => {
Expand Down

0 comments on commit c4aa79d

Please sign in to comment.