lovers-of-behat/table-extension
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.
lovers-of-behat/table-extension 适用场景与选型建议
lovers-of-behat/table-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 100.3k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2018 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lovers-of-behat/table-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lovers-of-behat/table-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 100.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-04