You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(yaml): Support all device options in YAML configuration (#1367)
* feat(yaml): support all device options in YAML configuration
This PR enables YAML scripts to use all Android and iOS device options
by centralizing device option types and ensuring runtime configuration
propagation.
Changes:
- Created packages/core/src/device/device-options.ts to centralize all
device option type definitions (AndroidDeviceOpt, IOSDeviceOpt)
- Updated MidsceneYamlScriptAndroidEnv and MidsceneYamlScriptIOSEnv to
extend device options using Omit<> to exclude programmatic fields
- Fixed runtime configuration passing in create-yaml-player.ts to
forward all YAML config options to device constructors
- Simplified agent creation functions to pass entire options object
instead of manually listing each parameter
YAML scripts can now configure:
Android:
- androidAdbPath, remoteAdbHost, remoteAdbPort
- imeStrategy, displayId, usePhysicalDisplayIdForScreenshot
- screenshotResizeScale, alwaysFetchScreenInfo
- autoDismissKeyboard, keyboardDismissStrategy
iOS:
- deviceId, useWDA, wdaPort, wdaHost
- autoDismissKeyboard
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* test(yaml): add unit tests for device options propagation
Add comprehensive unit tests to verify that all device options are
correctly passed from YAML configuration to device constructors.
Tests include:
- Android device options propagation from YAML to agentFromAdbDevice
- iOS device options propagation from YAML to agentFromWebDriverAgent
- Type definitions for AndroidDeviceOpt and IOSDeviceOpt
- YAML environment types (MidsceneYamlScriptAndroidEnv, MidsceneYamlScriptIOSEnv)
- Validation that customActions is excluded from YAML types
- IME strategy and keyboard dismiss strategy type validations
- Minimal and full configuration scenarios
All 31 tests passing (17 in CLI, 14 in Core).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* fix(android): ensure empty object is passed when opts is undefined
Fix failing unit tests by ensuring an empty object is passed to
AndroidDevice and IOSDevice constructors when opts is undefined,
maintaining backward compatibility with existing tests.
Changes:
- Updated agentFromAdbDevice to pass opts || {} to AndroidDevice
- Updated agentFromWebDriverAgent to pass opts || {} to IOSDevice
This ensures the constructors always receive an object instead of
undefined, which is what the existing tests expect.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* fix(device-options): rename alwaysFetchScreenInfo to alwaysRefreshScreenInfo for clarity
* docs(site): update Android and iOS sections to include all configuration options from their respective constructors
---------
Co-authored-by: Claude <[email protected]>
YAML scripts now support all configuration options from the `AndroidDevice` constructor. For the complete list of options, please refer to [AndroidDevice Constructor in Android Integration Documentation](./integrate-with-android#androiddevice-constructor).
244
+
245
+
:::
246
+
235
247
### The `ios` part
236
248
237
249
```yaml
@@ -253,8 +265,15 @@ ios:
253
265
254
266
# Whether to save log content to a JSON file, optional, defaults to `false`. If true, saves to `unstableLogContent.json`. If a string, saves to the specified path. The log content structure may change in the future.
# All other options supported by the IOSDevice constructor
270
+
# See the IOSDevice constructor documentation for the complete list
256
271
```
257
272
273
+
:::tip View Complete iOS Configuration Options
274
+
YAML scripts now support all configuration options from the `IOSDevice` constructor. For the complete list of options, please refer to [IOSDevice Constructor in iOS Integration Documentation](./integrate-with-ios#iosdevice-constructor).
275
+
:::
276
+
258
277
### The `tasks` part
259
278
260
279
The `tasks` part is an array that defines the steps of the script. Remember to add a `-` before each step to indicate it's an array item.
alwaysRefreshScreenInfo?: boolean;// If true, always fetch screen size and orientation from device on each call; if false (default), cache the first result
0 commit comments