2bepublished/behat-responsive-features-extension

一个 Behat 扩展,允许根据不同的屏幕尺寸启用/禁用功能。

dev-master 2015-03-11 14:30 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:26:36 UTC


README

Build Status

关于

一个 Behat 扩展,允许根据不同的屏幕尺寸启用/禁用功能。

安装

BehatResponsiveFeaturesExtension 可以通过 composer 安装

composer require "2bepublished/behat-responsive-features-extension"

使用方法

步骤 1: 在您的 behat.yml 中激活扩展

default:
  suites:
    ...
  extensions:
    Pub\BehatResponsiveFeaturesExtension\Extension: ~

步骤 2: 定义一个使用响应式功能的测试套件。在此步骤中,您还需要定义此套件将使用的屏幕宽度。

default:
  suites:
    ios_7_iphone5:
      paths:  [ %paths.base%/features/ ]
      contexts: [ Feature ]
      type: pub_responsive_suite    # required: this instructs Behat to use the responsive suite. 
      screen-width: 320             # required: this sets the width for that suite
      mink_session: ios_7_iphone5   # optional: the mink session is optional if you don't use mink. 

步骤 3: 在您的功能定义中使用宽度标签

  • @min-width:xxx - 指定像素的最小宽度
  • @all-widths - 如果想使一个功能在所有响应式套件上运行,请使用此标签。
@all-widths
Feature: A very important feature
  In order to see this very important feature
  As a User
  I don't need a big screen
@min-width:500
Feature: A very big feature
  In order to see this very big feature
  As a User
  I need a screen with at least 500px

有关使用 browser-stack 的更大示例配置,请参阅 示例配置。

功能

  • 使用最小所需宽度标记功能,以确保它们不在屏幕较小的测试套件上执行。

限制

  • 目前仅允许宽度过滤
  • 需要执行所有配置的功能需要 @all-widths 标签

许可协议

请参阅 LICENSE 文件。