From edee2cd3e6a7ddc2c619b133168db9a66ebf0ab9 Mon Sep 17 00:00:00 2001 From: Rocco Salvetti <38426041+PimySoft@users.noreply.github.com> Date: Wed, 7 Jan 2026 18:30:19 +0000 Subject: [PATCH 1/3] Simplify: Use simple android-actions/setup-android@v2 - Remove complex manual SDK setup that keeps failing - Use proven action with default settings - Let Gradle handle everything during build - Much simpler and more reliable --- .github/workflows/ci-browserstack.yml | 38 +-------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/.github/workflows/ci-browserstack.yml b/.github/workflows/ci-browserstack.yml index e5b34af..e8ac165 100644 --- a/.github/workflows/ci-browserstack.yml +++ b/.github/workflows/ci-browserstack.yml @@ -34,43 +34,7 @@ jobs: java-version: ${{ env.JAVA_VERSION }} - name: ๐Ÿ“ฑ Setup Android SDK - run: | - export ANDROID_HOME=$HOME/android-sdk - export ANDROID_SDK_ROOT=$HOME/android-sdk - - mkdir -p $ANDROID_HOME - cd $ANDROID_HOME - - # Download and install command line tools - wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip - unzip -q commandlinetools-linux-11076708_latest.zip - mkdir -p cmdline-tools/latest - mv cmdline-tools/* latest/ 2>/dev/null || true - mv latest cmdline-tools/ 2>/dev/null || true - - # Set PATH for sdkmanager - export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin - - # Verify sdkmanager is accessible - if ! command -v sdkmanager &> /dev/null; then - echo "sdkmanager not found, trying direct path..." - $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --version || { - echo "ERROR: sdkmanager still not found" - ls -la $ANDROID_HOME/cmdline-tools/latest/bin/ || echo "Directory doesn't exist" - exit 1 - } - fi - - # Accept licenses - yes | sdkmanager --licenses > /dev/null 2>&1 || true - - # Install required packages - sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0" "ndk;27.1.12297006" - - echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV - echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV - echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH - echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH + uses: android-actions/setup-android@v2 - name: ๐Ÿ“ฅ Install dependencies run: npm ci From f24e3b8607c11b9bdc37d7688b02f3ef9ec99bb1 Mon Sep 17 00:00:00 2001 From: Rocco Salvetti <38426041+PimySoft@users.noreply.github.com> Date: Wed, 7 Jan 2026 18:31:27 +0000 Subject: [PATCH 2/3] Simplify workflow: Remove APK build, use pre-uploaded app - Remove complex Android SDK setup and APK build - Use pre-uploaded APK from BrowserStack (BROWSERSTACK_APP_ID) - Simple workflow: checkout, install, test, report - Perfect for demo purposes - shows CI/CD understanding --- .github/workflows/ci-browserstack.yml | 84 ++------------------------- 1 file changed, 5 insertions(+), 79 deletions(-) diff --git a/.github/workflows/ci-browserstack.yml b/.github/workflows/ci-browserstack.yml index e8ac165..3c54a8e 100644 --- a/.github/workflows/ci-browserstack.yml +++ b/.github/workflows/ci-browserstack.yml @@ -7,15 +7,11 @@ on: branches: [ main, develop ] workflow_dispatch: -env: - NODE_VERSION: '20' - JAVA_VERSION: '17' - jobs: test: - name: Build & Test on BrowserStack - runs-on: ubuntu-22.04 - timeout-minutes: 60 + name: Run E2E Tests on BrowserStack + runs-on: ubuntu-latest + timeout-minutes: 30 steps: - name: ๐Ÿ“ฅ Checkout code @@ -24,80 +20,12 @@ jobs: - name: ๐Ÿ“ฆ Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ env.NODE_VERSION }} + node-version: '20' cache: 'npm' - - name: โ˜• Setup Java - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ env.JAVA_VERSION }} - - - name: ๐Ÿ“ฑ Setup Android SDK - uses: android-actions/setup-android@v2 - - name: ๐Ÿ“ฅ Install dependencies run: npm ci - - name: ๐Ÿ’พ Cache Gradle dependencies - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - android/.gradle - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: ๐Ÿ”จ Build Android APK - timeout-minutes: 40 - run: | - cd android - chmod +x gradlew - - echo "=== Build Configuration ===" - echo "ANDROID_HOME: $ANDROID_HOME" - echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT" - echo "Building for x86_64 architecture only" - - echo "=== Pre-build: Check NDK ===" - if [ -d "$ANDROID_HOME/ndk/27.1.12297006" ]; then - echo "NDK already installed" - else - echo "NDK will be installed during build (this may take 10-15 minutes)" - fi - - echo "=== Starting Gradle build ===" - echo "This may take 30-40 minutes on first build due to NDK installation" - echo "Progress will be shown below..." - - # Run with info logging to see progress - ./gradlew assembleDebug \ - --no-daemon \ - --info \ - -PreactNativeArchitectures=x86_64 \ - --console=plain 2>&1 | tee build.log || { - echo "=== Build failed ===" - echo "Last 50 lines of build log:" - tail -50 build.log - exit 1 - } - - echo "=== Build completed ===" - if [ ! -f "app/build/outputs/apk/debug/app-debug.apk" ]; then - echo "ERROR: APK not found after build!" - ls -la app/build/outputs/apk/debug/ || echo "Output directory doesn't exist" - exit 1 - fi - echo "APK found:" - ls -lh app/build/outputs/apk/debug/ - cd .. - env: - ANDROID_HOME: ${{ env.ANDROID_HOME }} - ANDROID_SDK_ROOT: ${{ env.ANDROID_SDK_ROOT }} - GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.console=plain" - - name: ๐Ÿงช Run E2E Tests on BrowserStack run: npm run test:e2e:browserstack:all env: @@ -107,8 +35,7 @@ jobs: - name: ๐Ÿ“Š Generate Allure Report if: always() - run: | - npx allure-commandline generate allure-results --clean -o allure-report || echo "Allure report generation skipped (no results)" + run: npx allure-commandline generate allure-results --clean -o allure-report || echo "No results" - name: ๐Ÿ“ค Upload Test Results if: always() @@ -121,4 +48,3 @@ jobs: screenshots/ retention-days: 7 if-no-files-found: ignore - From 9a6deba6c8bd20dc66903881c98cb42d17831aef Mon Sep 17 00:00:00 2001 From: Rocco Salvetti <38426041+PimySoft@users.noreply.github.com> Date: Wed, 7 Jan 2026 18:43:52 +0000 Subject: [PATCH 3/3] Fix BrowserStack connection: use correct hostname and port - Fix: Set hostname to hub.browserstack.com (not localhost) - Fix: Set port to 443 (HTTPS) instead of 4723 - Fix: Set protocol to https - This fixes 'Unable to connect to localhost:4723' error --- wdio.browserstack.conf.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wdio.browserstack.conf.ts b/wdio.browserstack.conf.ts index b41ad5a..81a23fc 100644 --- a/wdio.browserstack.conf.ts +++ b/wdio.browserstack.conf.ts @@ -26,8 +26,10 @@ const deviceConfig = { export const config: Options.Testrunner = { runner: 'local', - port: 4723, + hostname: 'hub.browserstack.com', + port: 443, path: '/wd/hub', + protocol: 'https', specs: [ './e2e/specs/**/*.ts' @@ -72,8 +74,6 @@ export const config: Options.Testrunner = { bail: 0, - baseUrl: 'https://hub.browserstack.com/wd/hub', - waitforTimeout: 10000, connectionRetryTimeout: 120000,