Detox: iOS Detox tests fail in Github actions CI with multiple workers - Exceeded timeout of 300000ms while handling jest-circus "setup" event

What happened?

First reported with a comment on a separate issue: https://github.com/wix/Detox/issues/3342#issuecomment-1228850607

Running tests for iOS with 3 workers using the detox cli --workers leads to intermittent test failures. It seems to have something to do with the instantiation of new simulators to support the concurrent workers. When running only 1 worker, I am unable to reproduce this issue.

CI: Github Actions

As a workaround, I have created a simple test suite consisting of only 3 tests. These tests run with 3 workers so that Detox will create new simulator instances for them. This 3 tests usually fail with the timeout issue, however, when the actual test suite runs immediately after, it does not encounter the timeout issue. This leads me to believe that if the simulators have already been created, Detox bypasses this step, and bypasses the bug altogether.

Attached are the logs with trace logging enabled from when the errors occurred.

The command to run this step is as follows

 - name: Initialize Detox Tests
        id: detox-init
        continue-on-error: true
        run: yarn detox test --use-custom-logger false --loglevel warn --configuration ios.sim.gha --cleanup --workers 3 --runner-config e2e/InitCITests/config.json --keepLockFile true

What was the expected behaviour?

The jest-circus setup step would not timeout.

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 19.10.0 React Native version: 0.67.2 Node version: 14.18.1 Device model: iPhone 13 iOS version: 14.5 macOS version: 12 Xcode version: 13.4.1 Test-runner (select one): jest-circus

Detox logs

Detox logs

18_Initialize Detox Tests-1.txt

Device logs

Device logs
paste logs here!

More data, please!

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 22 (4 by maintainers)

Most upvoted comments

Can we reopen this @d4vidi ?

@sergtimosh

Sorry, I mean I was never able to solve this problem without the workaround.

@sergtimosh

It is just a pretty standard config file

{
  "testEnvironment": "../environment",
  "testRunner": "jest-circus/runner",
  "testTimeout": 100000,
  "testRegex": "\\.initci\\.ts$",
  "reporters": ["detox/runners/jest/streamlineReporter"],
  "verbose": true
}

The test regex was targeting 3 test files called worker1.initci.ts, worker2.initci.ts, and worker3.initci.ts. Each of these have a bare bones test in them

import { device } from 'detox';

test('It should start worker 1', () => device.launchApp());

I am no longer working on the codebase where I had this problem, but I was never able to solve it.

This is still a problem

I’m having this issue on GH Actions after updating the runner from macos-11 to macos-12.

It seems the simulator doesn’t boot fast enough since its the first use of it. I have maxWorkers at 1. bootstatus is run but doesn’t seem to report anything and eventually the timeout is fired and the tests don’t get assigned to a simulator:

Oct 28 15:53:59 detox[45848] DEBUG: [EXEC_CMD, #2] /usr/bin/xcrun simctl boot 0336474D-27B1-4220-8EC9-DD82EDEBC404 
Oct 28 15:53:59 detox[45848] DEBUG: [EXEC_TRY, #2] Booting device 0336474D-27B1-4220-8EC9-DD82EDEBC404...
Oct 28 15:54:02 detox[45848] TRACE: [EXEC_SUCCESS, #2] 
Oct 28 15:54:02 detox[45848] DEBUG: [EXEC_CMD, #3] /usr/bin/xcrun simctl bootstatus 0336474D-27B1-4220-8EC9-DD82EDEBC404
Oct 28 15:55:58 detox[45848] ERROR: Exceeded timeout of 120000ms while handling jest-circus "setup" event
Oct 28 15:56:09 detox[45848] INFO:  Signup (Phone) is assigned to undefined