wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.12k stars 1.91k forks source link

Detox E2E Tests Failing to Launch in GitHub Actions CI #4202

Open tushar-WS opened 11 months ago

tushar-WS commented 11 months ago

Description

Problem I am encountering an issue when trying to run Detox End-to-End (E2E) tests in GitHub Actions (CI pipeline). The build process completes successfully, but the application is not launching in the simulator. This problem does not occur when I run the tests locally; they work perfectly.

Symptoms The issue came to my attention because I am capturing screenshots before and after the tests, and I noticed that the screenshots taken during the CI pipeline show a blank home screen in the simulator (iPhone 12).

I have attempted to debug this issue by trying the following:

The .yml file used for CI

jobs:
  test:
    runs-on: macos-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Install dependencies
        run: |
          brew tap wix/brew
          brew install applesimutils
          yarn install --frozen-lockfile
          cd ios && pod install && cd ..
      - name: Build and Test
        run: |
          npx detox build --configuration ios.sim.debug
          npx detox test --configuration ios.sim.debug

The config file for E2E

/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
  rootDir: '..',
  testMatch: ['<rootDir>/e2e/**/*.test.js'],
  testTimeout: 120000,
  maxWorkers: 1,
  globalSetup: 'detox/runners/jest/globalSetup',
  globalTeardown: 'detox/runners/jest/globalTeardown',
  reporters: ['detox/runners/jest/reporter'],
  testEnvironment: 'detox/runners/jest/testEnvironment',
  verbose: true
};

The detoxrc.js file

/** @type {Detox.DetoxConfig} */
module.exports = {
  testRunner: {
    args: {
      $0: 'jest',
      config: 'e2e/jest.config.js'
    },
    jest: {
      setupTimeout: 120000
    }
  },
  apps: {
    'ios.debug': {
      type: 'ios.app',
      binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/BETU.app',
      build:
        'xcodebuild -workspace ios/BETU.xcworkspace -scheme BETU -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build'
    },
    'ios.release': {
      type: 'ios.app',
      binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/BETU.app',
      build:
        'xcodebuild -workspace ios/BETU.xcworkspace -scheme BETU -configuration Release -sdk iphonesimulator -derivedDataPath ios/build'
    }
  },
  devices: {
    simulator: {
      type: 'ios.simulator',
      device: {
        type: 'iPhone 12'
      }
    }
  },
  configurations: {
    'ios.sim.debug': {
      device: 'simulator',
      app: 'ios.debug'
    },
    'ios.sim.release': {
      device: 'simulator',
      app: 'ios.release'
    }
  }
};

Please note that the issue is specific to GitHub Actions, as the tests run successfully on my local machine. Any assistance with debugging this issue and getting Detox E2E tests to work in the CI pipeline would be greatly appreciated PFA the screenshots from CI testFnFailure .

Your environment

Detox version: 20.11.0 React Native version: 0.70.8 Node version: 16.20.1 Device model: Macbook Pro M1 2021 OS: MacOS Ventura (13.6) Test-runner (select one): jest

mfazekas commented 10 months ago

@tushar-WS pls note that GitHub Actions has no metal support. So if you're using react-native-skia or @rnmapbox/maps or some other library that requires metal then it will not run on GitHub Actions.

https://github.com/actions/runner-images/discussions/6138

stale[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this repository, read this discussion.