E2E test Expo - Detox Failed to find a device by type iOS on CI

99 views Asked by At

I am working on a mobile application with expo SDK 50, [email protected] and I am using Detox (20.13.5) for my e2e tests. It used to work well on Github Actions, but it seems that my action these days has trouble to find a simulator to run the tests.

  DetoxRuntimeError: Failed to find a device by type = "iPhone 15 Pro Max"

    HINT: Run 'applesimutils --list' to list your supported devices. It is advised only to specify a device type, e.g., "iPhone Xʀ" and avoid explicit search by OS version.

I took a look to the react-native example on wix/detox repo to have an idea of the right configuration for my .detoxrc.js and ended to this chunk for iOS sim :

devices: {
  simulator: {
    type: 'ios.simulator',
    device: {
      type: 'iPhone 15 Pro Max',
      os: '17.2'
    },
  },
},

My yml file is as code below. I am not giving any configuration for the simulator, but I don't know if it's needed as long as I never saw something like that on Detox documentation or examples.

name: e2e-ios
on:
  push:
    branches:
      - main
      - 'SPA-**'
      - 'FEATURE-**'

jobs:
  e2e-ios:
    runs-on: macos-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Setup Node.js
        uses: actions/setup-node@v3

      - name: Install Yarn dependencies
        run: yarn --frozen-lockfile --prefer-offline

      - name: Install macOS dependencies
        run: |
          brew tap wix/brew
          brew install applesimutils
        env:
          HOMEBREW_NO_AUTO_UPDATE: 1
          HOMEBREW_NO_INSTALL_CLEANUP: 1

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.2
          bundler-cache: true

      - name: Expo pre-build
        run: npx expo prebuild -p ios

      - name: Install Detox
        run: |
          yarn global add detox-cli
          yarn add detox

      - name: Detox rebuild framework cache
        run: yarn detox rebuild-framework-cache

      # - name: Cache Detox build # needed ?
      #   id: cache-detox-build
      #   uses: actions/cache@v3
      #   with:
      #     path: ios/build # WARNING : right here ??
      #     key: ${{ runner.os }}-detox-build
      #     restore-keys: |
      #       ${{ runner.os }}-detox-build

      - name: Detox build
        run: MY_APP_MODE=mocked detox build -c ios.sim.release

      - name: Detox test
        run: MY_APP_MODE=mocked detox test -c ios.sim.release --cleanup

      - name: Upload artifacts # what are those ?
        if: failure()
        uses: actions/upload-artifact@v3
        with:
          name: detox-artifacts
          path: artifacts

Maybe I am missing something obvious here, but please tell me if you need more information or details about my code.

Thank your for your help, I'll be pleased to discuss further with you on this subject.

0

There are 0 answers