jeudi 8 avril 2021

Detox does not run test (Android)

When trying to run the Detox tests detox build is successful, but when trying to run the detox test facing the following error test does not start to run.

The emulator starts the application, but nothing happens. Test failed by next error: thrown: "Exceeded timeout of 20000 ms for a hook. Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

"detox": "^18.10.0", "jest": "^26.6.3", "jest-circus": "^26.6.3", "jest-enzyme": "7.1.2", "jest-react-native": "18.0.0",

File init.js:

import detox from 'detox';
import adapter from 'detox/runners/mocha/adapter';

beforeAll(async () => {
await detox.init();
});

beforeEach(async function () {
await adapter.beforeEach(this);
});

// afterEach(async function () {
// await adapter.afterEach(this);
// });

afterAll(async () => {
await detox.cleanup();
});

File config.json:

{
    "testEnvironment": "./environment",
    "testRunner": "jest-circus/runner",
    "testTimeout": 20000,
    "testRegex": "\\.e2e\\.js$",
    "setupFilesAfterEnv": ["./init.js"],
    "reporters": ["detox/runners/jest/streamlineReporter"],
    "verbose": true
}

Configurations:

{
  "testRunner": "jest",
  "runnerConfig": "e2e/config.json",
  "apps": {
    "ios": {
      "type": "ios.app",
      "binaryPath": "SPECIFY_PATH_TO_YOUR_APP_BINARY"
    },
    "android.release": {
      "type": "android.apk",
      "binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
      "build": "cd android ;gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -"
    }
  },
  "devices": {
    "simulator": {
      "type": "ios.simulator",
      "device": {
        "type": "iPhone 11"
      }
    },
    "emulator": {
      "type": "android.emulator",
      "device": {
        "avdName": "Pixel_4_API_30"
      }
    }
  },
  "configurations": {
    "ios": {
      "device": "simulator",
      "app": "ios"
    },
    "android": {
      "device": "emulator",
      "app": "android.release"
    }
  }
}

Aucun commentaire:

Enregistrer un commentaire