diff --git a/.github/workflows/docker_android_workflow.yml b/.github/workflows/docker_android_workflow.yml index 3bf74fd1..d10d4528 100644 --- a/.github/workflows/docker_android_workflow.yml +++ b/.github/workflows/docker_android_workflow.yml @@ -133,12 +133,105 @@ jobs: sleep 10 appium -v -# - name: Android Emulator Runner Without SDK Setup -# uses: RandyLutcavich/android-emulator-runner-without-sdk-setup@v1.0.3 + # - name: Android Emulator Runner Without SDK Setup + # uses: RandyLutcavich/android-emulator-runner-without-sdk-setup@v1.0.3 + + # - name: AVD cache + # uses: actions/cache@v4 + # id: avd-cache + # with: + # path: | + # ~/.android/avd/* + # ~/.android/adb* + # key: avd-test + # + # - name: Run Android Emulator + # id: run_emulator + # if: steps.setup_dependencies.outcome == 'success' + # uses: ReactiveCircus/android-emulator-runner@v2 + # with: + # api-level: 30 + # force-avd-creation: false + # emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + # disable-animations: true + # target: default + # arch: x86_64 + # script: echo "Generated AVD Started" + # + # - name: Run Android Emulator Again + # id: run_emulator_again + # if: steps.run_emulator.outcome == 'success' + # run: | + # echo "Running Emulator Again" + # cd ~/Library/Android/sdk/emulator + # ./emulator -list-avds + # ./emulator -avd test -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + + # - name: set up JDK 17 + # uses: actions/setup-java@v3 + # with: + # java-version: '17' + # distribution: 'temurin' + # + # - name: Setup Android SDK + # uses: android-actions/setup-android@v3 + # + # - name: Create Android emulator + # run: | + # sdkmanager --install "system-images;android-31;google_apis;x86_64" + # echo "no" | avdmanager --verbose create avd --force --name testAVD --abi google_apis/x86_64 --package 'system-images;android-31;google_apis;x86_64' + # + # - name: Launch Emulator + # run: | + # $ANDROID_SDK_ROOT/emulator/emulator -avd testAVD + + - name: Create Android emulator + run: | + brew install intel-haxm + # Install AVD files + echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-27;default;x86_64' + echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --licenses + + # Create emulator + + $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_API_29_AOSP -d pixel --package 'system-images;android-27;default;x86_64' + $ANDROID_HOME/emulator/emulator -list-avds + if false; then + emulator_config=~/.android/avd/Pixel_API_29_AOSP.avd/config.ini + + sed -i .bak 's/hw.lcd.density=.*/hw.lcd.density=480/' "$emulator_config" + sed -i .bak 's/hw.lcd.height=.*/hw.lcd.height=2220/' "$emulator_config" + sed -i .bak 's/hw.lcd.width=.*/hw.lcd.width=1080/' "$emulator_config" + # Or, add new config + if ! grep -q "hw.lcd.density" "$emulator_config"; then + echo "hw.lcd.density=480" >> "$emulator_config" + fi + if ! grep -q "hw.lcd.height" "$emulator_config"; then + echo "hw.lcd.height=2220" >> "$emulator_config" + fi + if ! grep -q "hw.lcd.width" "$emulator_config"; then + echo "hw.lcd.width=1080" >> "$emulator_config" + fi + echo "Emulator settings ($emulator_config)" + cat "$emulator_config" + fi + + - name: Start Android emulator + id: start_emulator + run: | + echo "Starting emulator and waiting for boot to complete...." + ls -la $ANDROID_HOME/emulator + nohup $ANDROID_HOME/tools/emulator -avd Pixel_API_29_AOSP -gpu host -no-audio -no-boot-anim -camera-back none -camera-front none -qemu -m 2048 2>&1 & + $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "wait..."; sleep 1; done; input keyevent 82' + echo "Emulator has finished booting" + $ANDROID_HOME/platform-tools/adb devices + sleep 30 + screencapture screenshot.jpg + $ANDROID_HOME/platform-tools/adb exec-out screencap -p > emulator.png - name: Check out code id: co_code - if: steps.install_driver.outcome == 'success' + if: steps.start_emulator.outcome == 'success' uses: actions/checkout@v4 - name: Setup dependencies @@ -147,33 +240,9 @@ jobs: run: | sh setup_install.sh - - name: Run Android Emulator - id: run_emulator - if: steps.setup_dependencies.outcome == 'success' - uses: ReactiveCircus/android-emulator-runner@v2 - with: - api-level: 30 - force-avd-creation: false - emulator-options: -no-snapshot-save -no-window -grpc-use-jwt -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: true - target: default - arch: x86_64 - script: echo "Generated AVD Started" - - - name: Run Android Emulator Again - id: run_emulator_again - if: steps.run_emulator.outcome == 'success' - run: | - echo "Running Emulator Again" - cd ~/Library/Android/sdk/emulator - sleep 5 - ./emulator -list-avds - sleep 5 - ./emulator -avd test -no-snapshot-save -no-window -grpc-use-jwt -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - - name: Run Tests id: run_manual_job - if: steps.run_emulator_again.outcome == 'success' + if: steps.setup_dependencies.outcome == 'success' run: | TAGS="${{ github.event.inputs.tags }}" env diff --git a/frontend/test_project/features/mobile/android_login.feature b/frontend/test_project/features/mobile/android_login.feature index 2c538493..2879a870 100644 --- a/frontend/test_project/features/mobile/android_login.feature +++ b/frontend/test_project/features/mobile/android_login.feature @@ -31,6 +31,7 @@ Feature: Basic App functionality When The element 'Android > _mob > MyDemoApp > item_sl_backpack' is displayed And I swipe down '50' % each time for '4' times And I click on element 'Android > _mob > an-items > Sauce_Labs_Onesie' + And I swipe down '50' % each time for '1' times And The element 'Android > _mob > MyDemoApp > add_to_cart' is displayed And I click on element 'Android > _mob > MyDemoApp > add_to_cart' When I click on element 'Android > _mob > MyDemoApp > add_to_cart' @@ -56,6 +57,7 @@ Feature: Basic App functionality When The element 'Android > _mob > MyDemoApp > item_sl_backpack' is displayed And I swipe down '50' % each time for '4' times And I click on element 'Android > _mob > an-items > Sauce_Labs_Onesie' + And I swipe down '50' % each time for '1' times Then The element 'Android > _mob > MyDemoApp > add_to_cart' is displayed When I click on element 'Android > _mob > MyDemoApp > add_to_cart' And I click on element 'Android > _mob > MyDemoApp > add_to_cart' @@ -68,10 +70,12 @@ Feature: Basic App functionality Then The element 'Android > _mob > an-Shipping_Info > Full_name' is displayed When I set text 'Tauqir Sarwar' to field 'Android > _mob > an-Shipping_Info > Full_name' And I set text 'Main Cantt' to field 'Android > _mob > an-Shipping_Info > Address_line_1' + And I swipe down '50' % each time for '1' times And I set text 'Lahore' to field 'Android > _mob > an-Shipping_Info > City' And I swipe down '50' % each time for '2' times And I set text '102040' to field 'Android > _mob > an-Shipping_Info > Zip_code' And I set text 'Pakistan' to field 'Android > _mob > an-Shipping_Info > Country' + And I swipe down '50' % each time for '1' times And I click on element 'Android > _mob > an-Payment_Detail > Payment' Then The element 'Android > _mob > an-Payment_Detail > Full_name' is displayed When I set text 'Tauqir Sarwar' to field 'Android > _mob > an-Payment_Detail > Full_name' @@ -80,6 +84,7 @@ Feature: Basic App functionality And I swipe down '50' % each time for '1' times And I set text '0325' to field 'Android > _mob > an-Payment_Detail > expired_card' And I set text '123' to field 'Android > _mob > an-Payment_Detail > CVV' + And I swipe down '50' % each time for '1' times Then The element 'Android > _mob > an-Review_Order > Review' is displayed When I click on element 'Android > _mob > an-Review_Order > Review' And I swipe down '50' % each time for '2' times