1
1
// @ts -nocheck
2
2
const path = require ( 'path' ) ;
3
3
4
- const exec = require ( 'child-process-promise' ) . exec ;
5
4
const _ = require ( 'lodash' ) ;
6
5
6
+
7
7
const temporaryPath = require ( '../../../../artifacts/utils/temporaryPath' ) ;
8
8
const DetoxRuntimeError = require ( '../../../../errors/DetoxRuntimeError' ) ;
9
9
const XCUITestRunner = require ( '../../../../ios/XCUITestRunner' ) ;
10
10
const { assertTraceDescription } = require ( '../../../../utils/assertArgument' ) ;
11
+ const { execAsync } = require ( '../../../../utils/childProcess' ) ;
11
12
const getAbsoluteBinaryPath = require ( '../../../../utils/getAbsoluteBinaryPath' ) ;
12
13
const { actionDescription } = require ( '../../../../utils/invocationTraceDescriptions' ) ;
13
14
const log = require ( '../../../../utils/logger' ) . child ( { cat : 'device' } ) ;
@@ -16,7 +17,6 @@ const traceInvocationCall = require('../../../../utils/traceInvocationCall').bin
16
17
17
18
const IosDriver = require ( './IosDriver' ) ;
18
19
19
-
20
20
/**
21
21
* @typedef SimulatorDriverDeps { DeviceDriverDeps }
22
22
* @property applesimutils { AppleSimUtils }
@@ -69,8 +69,7 @@ class SimulatorDriver extends IosDriver {
69
69
async getBundleIdFromBinary ( appPath ) {
70
70
appPath = getAbsoluteBinaryPath ( appPath ) ;
71
71
try {
72
- const result = await exec ( `/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" "${ path . join ( appPath , 'Info.plist' ) } "` ) ;
73
- const bundleId = _ . trim ( result . stdout ) ;
72
+ const bundleId = await execAsync ( `/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" "${ path . join ( appPath , 'Info.plist' ) } "` ) ;
74
73
if ( _ . isEmpty ( bundleId ) ) {
75
74
throw new Error ( ) ;
76
75
}
@@ -141,7 +140,7 @@ class SimulatorDriver extends IosDriver {
141
140
const xcuitestRunner = new XCUITestRunner ( { runtimeDevice : { id : this . getExternalId ( ) , _bundleId } } ) ;
142
141
let x = point ?. x ?? 100 ;
143
142
let y = point ?. y ?? 100 ;
144
- let _pressDuration = pressDuration ? ( pressDuration / 1000 ) : 1 ;
143
+ let _pressDuration = pressDuration ? pressDuration / 1000 : 1 ;
145
144
const traceDescription = actionDescription . longPress ( { x, y } , _pressDuration ) ;
146
145
return this . withAction ( xcuitestRunner , 'coordinateLongPress' , traceDescription , x . toString ( ) , y . toString ( ) , _pressDuration . toString ( ) ) ;
147
146
}
@@ -210,7 +209,7 @@ class SimulatorDriver extends IosDriver {
210
209
await this . emitter . emit ( 'createExternalArtifact' , {
211
210
pluginId : 'screenshot' ,
212
211
artifactName : screenshotName || path . basename ( tempPath , '.png' ) ,
213
- artifactPath : tempPath ,
212
+ artifactPath : tempPath
214
213
} ) ;
215
214
216
215
return tempPath ;
@@ -223,7 +222,7 @@ class SimulatorDriver extends IosDriver {
223
222
await this . emitter . emit ( 'createExternalArtifact' , {
224
223
pluginId : 'uiHierarchy' ,
225
224
artifactName : artifactName ,
226
- artifactPath : viewHierarchyURL ,
225
+ artifactPath : viewHierarchyURL
227
226
} ) ;
228
227
229
228
return viewHierarchyURL ;
0 commit comments