0

最近我开始使用Chimp,我的测试套件正在增长。我想实现一个我需要在移动视口上运行的功能(例如测试汉堡菜单)。我用@mobile 标签标记了这样一个场景。

默认情况下,Chimp 在 Chrome 网络驱动程序中以我桌面屏幕一半的分辨率运行(在我的情况下为 931x1013px),但我希望它以例如 640x960 手机分辨率运行)。

我知道我可以使用配置文件配置我的 Chimp 会话,但我找不到控制 Chrome 实例的浏览器分辨率的设置。我找到了一个 phantom_w / phantom_h 设置,但似乎与 Chrome 网络驱动程序无关。

如何强制我的 Chrome 网络驱动程序以特定分辨率运行?我可以通过desiredCapabilities配置Chimp来做到这一点 - 但是如何?

注意:我使用的是 Node 6.4、NPM 3.10.5 和 Chimp 0.34,到目前为止,这适用于所有功能。

4

1 回答 1

0

There are two ways.

  1. Using setViewPortSize as @grasshopper has mentioned
  2. Using chrome's mobile emulation.

For 2, you need to set the desiredCapabilities You can do that in the chimp config like this: https://github.com/xolvio/chimp/blob/master/src/bin/default.js#L48

Then you need to set the mobile emulation in a similar fashion to how they do it here: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation

于 2016-09-12T16:00:07.773 回答