elstc / codeception-mobileemulation
Codeception的WebDriver移动仿真开关
v1.0.0
2018-01-19 10:56 UTC
Requires
- php: >=5.6
Requires (Dev)
- codeception/codeception: ^2.3
This package is auto-updated.
Last update: 2024-08-29 04:20:06 UTC
README
此Codeception模块可以在浏览器上实现移动仿真。目前仅支持chrome
浏览器。
安装
您可以使用composer将此插件安装到您的应用程序中。
安装composer包的推荐方法是
composer require --dev elstc/codeception-mobileemulation
然后在您的测试套件配置文件中启用此模块(例如:acceptance.suite.yml
等)
modules:
enabled:
- MobileEmulation
- WebDriver
参阅:06-ModulesAndHelpers - Codeception - 文档
[重要] MobileEmulation
模块应在WebDriver
模块之前加载。
使用方法
在您的Cest
测试用例中,编写$mobileEmulation
属性
class AwesomeCest
{
public $mobileEmulation = true;
// ...
}
当$mobileEmulation = true
时,在此测试用例中,将启用移动仿真。
您可以使用emulationMobile()
方法
class AwesomeCest
{
public function tryYourSenario($I)
{
// enable mobile emulation manually, (with specific device name)
$I->emulationMobile('iPhone 8 Plus');
// ...
}
}
配置选项
defaultDeviceName
默认仿真设备名称。
默认: 'iPhone 6'