DetoxRecorder icon indicating copy to clipboard operation
DetoxRecorder copied to clipboard

Key “device” either not found or in unsupported format as found in package.json for the “debug:ios” configuration.

Open hkar19 opened this issue 4 years ago • 14 comments

Describe the Bug I cannot run detox recorder --configuration debug:ios --outputTestFile "~/Desktop/RecordedTest.js" --testName "My Recorded Test" --record

as it shows error: Key “device” either not found or in unsupported format as found in package.json for the “debug:ios” configuration.

my .detoxrc.json

{
  "testRunner": "jest",
  "runnerConfig": "e2e/config.json",
  "apps": {
    "debug:ios": {
      "build": "react-native run-ios --simulator='iPhone 8'",
      "type": "ios.app",
      "binaryPath": "path/to/app"
    },
    "android": {
      "type": "android.apk",
      "binaryPath": "SPECIFY_PATH_TO_YOUR_APP_BINARY"
    }
  },
  "devices": {
    "simulator": {
      "type": "ios.simulator",
      "device": {
        "type": "iPhone 8"
      }
    },
    "emulator": {
      "type": "android.emulator",
      "device": {
        "avdName": "Pixel_3a_API_30_x86"
      }
    }
  },
  "configurations": {
    "debug:ios": {
      "device": "simulator",
      "app": "debug:ios"
    },
    "android": {
      "device": "emulator",
      "app": "android"
    }
  }
}

where did i do wrong?

To Reproduce i run detox recorder --configuration debug:ios --outputTestFile "~/Desktop/RecordedTest.js" --testName "My Recorded Test" --record

Expected Behavior it run

Actual Behavior it shows error

hkar19 avatar Mar 17 '21 05:03 hkar19

I am facing the same issue. Right now I am using the below way until I get a sample config. detox recorder --bundleId "com.example.myApp" --simulatorId booted --outputTestFile "~/Desktop/RecordedTest.js" --testName "My Recorded Test" --record

rakuju87 avatar Mar 17 '21 22:03 rakuju87

Also have this issue using .detoxrc.json and not package.json

I've also verified the json is valid as mentioned in docs.

avac-porch avatar Mar 31 '21 22:03 avac-porch

facing the same issues, any recommended fixes....?

noumantahir avatar Sep 01 '21 06:09 noumantahir

Same here, cant run the recorder while using detoxrc.json

joseguya avatar Sep 07 '21 21:09 joseguya

Same here. I think it a bug for DetoxRecorder. According to the document of Detox, we add the configuration in ".detoxrc.json", Please have a look @LeoNatan

hipages-ligang avatar Nov 14 '21 05:11 hipages-ligang

I am no longer involved with this project or Wix. Thanks

LeoNatan avatar Nov 14 '21 14:11 LeoNatan

is this project no longer maintained/updated?

youngjunaquinas avatar Jan 12 '22 04:01 youngjunaquinas

any update ?

aviatam avatar Mar 13 '22 14:03 aviatam

I am also facing the same issue. Any update?

JordanBrion avatar Apr 04 '22 17:04 JordanBrion

Apparently this repo has been forsaken. last commit by any contributor to master was on 10 Feb 2021. Maybe we should play with another things?

hkar19 avatar Apr 04 '22 22:04 hkar19

I managed to make the recorder work on the iOS simulator.

package.json: "detox": "^19.5.7", "detox-recorder": "^1.0.151",

.detoxrc.json: { "testRunner": "jest", "runnerConfig": "e2e/config.json", "skipLegacyWorkersInjection": true, "apps": { "ios.release": { "name": "yourproject", "type": "ios.app", "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/yourproject.app", "build": "xcodebuild -workspace ios/yourproject.xcworkspace -scheme yourproject -configuration Release -sdk iphonesimulator -derivedDataPath ios/build" }, "ios.debug": { "name": "yourproject", "type": "ios.app", "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/yourproject.app", "build": "xcodebuild -workspace ios/yourproject.xcworkspace -scheme yourproject -sdk iphonesimulator -derivedDataPath ios/build" }, "android.debug": { "type": "android.apk", "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd .." }, "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_2_API_30" } } }, "configurations": { "ios.sim.release": { "device": "simulator", "app": "ios.release" }, "ios.sim.debug": { "device": "simulator", "app": "ios.debug" }, "android.emu.debug": { "device": "emulator", "app": "android.debug" }, "android.emu.release": { "device": "emulator", "app": "android.release" } } }

Build and run your project in Xcode with simulator iOS 13.7. (I experienced crashes with iOS 15 and 12)

Then type in your React Native project: detox recorder -b org.reactjs.native.example.yourproject -s booted -o "./yourtestcase.js" --record

JordanBrion avatar Apr 06 '22 17:04 JordanBrion

Same issue + 1

ansonliao avatar Jul 09 '22 05:07 ansonliao

This does seem to not work, regardless of .detoxrc.json or package.json. Trying to run on an already active simulator does seem to start the app but then immediately crashes. The js file gets created but obviously contains no tests.

Do we have any pointers as to what might be causing this?

RWOverdijk avatar Aug 05 '22 09:08 RWOverdijk

I managed to make the recorder work on the iOS simulator.

package.json: "detox": "^19.5.7", "detox-recorder": "^1.0.151",

.detoxrc.json: { "testRunner": "jest", "runnerConfig": "e2e/config.json", "skipLegacyWorkersInjection": true, "apps": { "ios.release": { "name": "yourproject", "type": "ios.app", "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/yourproject.app", "build": "xcodebuild -workspace ios/yourproject.xcworkspace -scheme yourproject -configuration Release -sdk iphonesimulator -derivedDataPath ios/build" }, "ios.debug": { "name": "yourproject", "type": "ios.app", "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/yourproject.app", "build": "xcodebuild -workspace ios/yourproject.xcworkspace -scheme yourproject -sdk iphonesimulator -derivedDataPath ios/build" }, "android.debug": { "type": "android.apk", "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk", "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd .." }, "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_2_API_30" } } }, "configurations": { "ios.sim.release": { "device": "simulator", "app": "ios.release" }, "ios.sim.debug": { "device": "simulator", "app": "ios.debug" }, "android.emu.debug": { "device": "emulator", "app": "android.debug" }, "android.emu.release": { "device": "emulator", "app": "android.release" } } }

Build and run your project in Xcode with simulator iOS 13.7. (I experienced crashes with iOS 15 and 12)

Then type in your React Native project: detox recorder -b org.reactjs.native.example.yourproject -s booted -o "./yourtestcase.js" --record

I was able to use Detrox Recorder. I've used simulator iOS 14.5 (iPhone 12) (I've experienced crashes with iOS 15 and 16)

mariushorvat avatar Mar 08 '23 20:03 mariushorvat