(params: {
session: SessionState;
outputPlacement: ScreenshotOutputPlacement;
dispatchContext: DaemonCommandContext;
})
| 46 | } |
| 47 | |
| 48 | function createDispatchScreenshotBackend(params: { |
| 49 | session: SessionState; |
| 50 | outputPlacement: ScreenshotOutputPlacement; |
| 51 | dispatchContext: DaemonCommandContext; |
| 52 | }): AgentDeviceBackend { |
| 53 | const { session, outputPlacement, dispatchContext } = params; |
| 54 | return { |
| 55 | platform: publicPlatformString(session.device), |
| 56 | captureScreenshot: async (_context, outPath, options) => { |
| 57 | const context = { |
| 58 | ...dispatchContext, |
| 59 | ...screenshotFlagsFromOptions(options), |
| 60 | surface: options?.surface, |
| 61 | skipIosSimulatorBootCheck: |
| 62 | dispatchContext.skipIosSimulatorBootCheck ?? |
| 63 | (isIosFamily(session.device) && session.device.kind === 'simulator'), |
| 64 | }; |
| 65 | if (outputPlacement === 'out') { |
| 66 | return readScreenshotResultData( |
| 67 | await dispatchCommand(session.device, 'screenshot', [], outPath, context), |
| 68 | ); |
| 69 | } |
| 70 | return readScreenshotResultData( |
| 71 | await dispatchCommand(session.device, 'screenshot', [outPath], undefined, context), |
| 72 | ); |
| 73 | }, |
| 74 | }; |
| 75 | } |
| 76 | |
| 77 | function createDaemonScreenshotArtifactAdapter(): ArtifactAdapter { |
| 78 | return { |
no test coverage detected