Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

append options in post data for extra WDA configurations #15

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

debugtalk
Copy link
Contributor

背景

在体验评测中,我们需要精确度量出某些操作的耗时,例如点击启动抖音到开始播放视频的耗时(首帧)。

在 iOS 系统中,不存在类似 Android debug 模式,因此要识别操作的起始点就十分困难。为了解决该问题,可以在 WDA 中加入打点日志,针对关键的 UI 操作记录其时间戳和步骤标识(identifier),然后就可以记录得到关键步骤的起始点时间。

对应地,在 gwda 中调用 WDA 时,需要传入额外的控制参数,例如 开启日志、指定步骤标识(identifier)等。

核心修改

1、新增 DataOption,用于对请求 WDA 的 post data 进行修改:

  • WithPressDuration:设置 duration 字段,适用于 Drag、DragFloat
  • WithFrequency:设置 frequency 字段,适用于 SendKeys
  • WithCustomOption:支持添加自定义的字段,保障灵活性

2、WebDriver 的方法签名调整:

  • Tap、TapFloat、Swipe、SwipeFloat:新增可选的 DataOption 参数
  • Drag、DragFloat:将可选参数 pressForDuration ...float64 替换为 options ...DataOption
  • SendKeys:将可选参数 frequency ...int 替换为 options ...DataOption

替换可选参数的原因是可选参数可能需要传入多个。

3、调用 debugLog 时,避免打印 screenshot 的响应内容

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant