承接 lovers-of-behat/table-extension 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lovers-of-behat/table-extension

最新稳定版本:1.5.2

Composer 安装命令:

composer require lovers-of-behat/table-extension

包简介

Behat extension to inspect HTML tables

README 文档

README

This library provides step definitions for checking HTML5 tables in Behat scenarios.

Installation

$ composer require lovers-of-behat/table-extension

Configuration

Add the extension and context to your test suite in behat.yml:

suites:
  default:
    contexts:
      - LoversOfBehat\TableExtension\Context\TableContext:
  extensions:
    LoversOfBehat\TableExtension:
      table_map:
        'Users': 'page.users .main-content table'
        'Country codes': 'table#country-codes'

Options

  • tableMap: Maps human readable table names to the CSS selectors that identify the tables in the web page. This allows you to use the human readable names in your Behat scenarios.

Usage

Given this example table:

Name Department Contact information
Office Position E-mail address Phone number
Lelisa Ericsson Healthcare Nurse lelisa@example.com 555-1234567
Genista Sumner Science Anthropologist genista@example.com 555-987654

And we have added the table to the table_map in behat.yml:

suites:
  extensions:
    LoversOfBehat\TableExtension:
      table_map:
        'Employees': '#employees'

Then we can use steps such as these to check the table:

# Check that the table is present on the page.
Then I should see the Employees table

# Check basic properties.
And the Employees table should have 5 columns

# Check the contents of the table. Cells that contain colspans and
# rowspans can be left empty.
And the Employees table should contain:
  | Name            | Department |                | Contact information |              |
  |                 | Office     | Position       | E-mail address      | Phone number |
  | Lelisa Ericsson | Healthcare | Nurse          | lelisa@example.com  | 555-1234567  |
  | Genista Sumner  | Science    | Anthropologist | genista@example.com | 555-987654   |

# The same step definition can be used to check partial data, as long as
# it is in a consecutive block of cells:
And the Employees table should contain:
  | Lelisa Ericsson | Healthcare | Nurse          |
  | Genista Sumner  | Science    | Anthropologist |

# Check non-consecutive columns by identifying them with the header
# text. This works even though the headers are in different rows in the
# original table.
And the Employees table should contain the following columns:
  | Name            | Office     | Phone number |
  | Lelisa Ericsson | Healthcare | 555-1234567  |
  | Genista Sumner  | Science    | 555-987654   |

For a more complete example, see tables.feature. Or check TableContext.php itself for the full list of available steps.

Development

Running tests locally:

$ git clone git@github.com:LoversOfBehat/TableExtension.git table-extension
$ cd table-extension
$ composer install
$ php -S localhost:8000 -t fixtures &
$ ./vendor/bin/behat

Credits

Development of this extension has been sponsored by the Directorate-General for Informatics (DIGIT) of the European Commission, as part of the OpenEuropa initiative.

统计信息

  • 总下载量: 94.9k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 7
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-04