wix-incubator / DetoxRecorder

Detox Recorder is a utility for recordings steps for a Detox test as you use your app in Simulator. After recording the test, add expectations that check if interface elements are in the expected state.
MIT License
300 stars 17 forks source link

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

Open hkar19 opened 3 years ago

hkar19 commented 3 years ago

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

rakuju87 commented 3 years ago

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

avac-porch commented 3 years ago

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

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

noumantahir commented 3 years ago

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

joseguya commented 3 years ago

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

hipages-ligang commented 2 years ago

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

LeoNatan commented 2 years ago

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

youngjunaquinas commented 2 years ago

is this project no longer maintained/updated?

aviatam commented 2 years ago

any update ?

JordanBrion commented 2 years ago

I am also facing the same issue. Any update?

hkar19 commented 2 years ago

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?

JordanBrion commented 2 years ago

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

ansonliao commented 2 years ago

Same issue + 1

RWOverdijk commented 2 years ago

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?

mariushorvat commented 1 year ago

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)