( device: DeviceInfo, interactor: Interactor, positionals: string[], context: DispatchContext | undefined, )
| 147 | } |
| 148 | |
| 149 | export async function handlePressCommand( |
| 150 | device: DeviceInfo, |
| 151 | interactor: Interactor, |
| 152 | positionals: string[], |
| 153 | context: DispatchContext | undefined, |
| 154 | ): Promise<Record<string, unknown>> { |
| 155 | if (context?.directElementSelector && isIosFamily(device)) { |
| 156 | return await handleDirectElementSelectorPress(interactor, context.directElementSelector); |
| 157 | } |
| 158 | |
| 159 | const { x, y } = readPoint(positionals, 'press requires x y'); |
| 160 | |
| 161 | if (isMacOs(device) && context?.surface && context.surface !== 'app') { |
| 162 | return await handleMacOsSurfacePress(x, y, context); |
| 163 | } |
| 164 | |
| 165 | const clickButton = resolveClickButton(context); |
| 166 | if (clickButton !== 'primary') { |
| 167 | return await handleAlternateClick(device, x, y, clickButton, context); |
| 168 | } |
| 169 | |
| 170 | const series = readPressSeriesOptions(context); |
| 171 | validatePressSeriesOptions(series); |
| 172 | |
| 173 | if (shouldUseIosPressSequence(device, series.count)) { |
| 174 | return await runIosPressSequence(device, x, y, series, context); |
| 175 | } |
| 176 | |
| 177 | return await runDirectPressSeries(interactor, x, y, series); |
| 178 | } |
| 179 | |
| 180 | async function handleDirectElementSelectorPress( |
| 181 | interactor: Interactor, |
no test coverage detected