elstc/codeception-mobileemulation

Codeception的WebDriver移动仿真开关

v1.0.0 2018-01-19 10:56 UTC

This package is auto-updated.

Last update: 2024-08-29 04:20:06 UTC


README

Software License Build Status Latest Stable Version

此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'