append options in post data for extra WDA configurations #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
背景
在体验评测中,我们需要精确度量出某些操作的耗时,例如点击启动抖音到开始播放视频的耗时(首帧)。
在 iOS 系统中,不存在类似 Android debug 模式,因此要识别操作的起始点就十分困难。为了解决该问题,可以在 WDA 中加入打点日志,针对关键的 UI 操作记录其时间戳和步骤标识(identifier),然后就可以记录得到关键步骤的起始点时间。
对应地,在 gwda 中调用 WDA 时,需要传入额外的控制参数,例如 开启日志、指定步骤标识(identifier)等。
核心修改
1、新增
DataOption
,用于对请求 WDA 的 post data 进行修改:duration
字段,适用于 Drag、DragFloatfrequency
字段,适用于 SendKeys2、WebDriver 的方法签名调整:
pressForDuration ...float64
替换为options ...DataOption
frequency ...int
替换为options ...DataOption
替换可选参数的原因是可选参数可能需要传入多个。
3、调用
debugLog
时,避免打印screenshot
的响应内容