drevops / behat-steps
Behat 步骤集合
2.4.0
2024-07-04 09:38 UTC
Requires
- php: >=8.1
- behat/behat: ^3
- behat/mink: >=1.11
- behat/mink-selenium2-driver: >=1.7
- drupal/drupal-extension: ^5
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1
- drevops/behat-screenshot: ^1.5
- drupal/coder: ^8.3
- dvdoug/behat-code-coverage: ^5.3
- mglaman/phpstan-drupal: ^1.2
- palantirnet/drupal-rector: ^0.20
- php-parallel-lint/php-parallel-lint: ^1.3
- phpcompatibility/php-compatibility: ^9.3
- phpmd/phpmd: ^2.13
- phpspec/prophecy-phpunit: ^2.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9.5
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.1
- 2.0.0
- 1.x-dev
- dev-main / 1.x-dev
- 1.6.0
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
- 0.3.1
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-renovate/all-dependencies
- dev-feaure/update-selenium-standalone-chromium
- dev-revert-248-feature/increase-test-coverage-part-2
This package is auto-updated.
Last update: 2024-09-18 01:14:02 UTC
README
Drupal 的 Behat 步骤集合
安装
composer require --dev drevops/behat-steps:^2
用法
将所需的特性添加到您的 FeatureContext.php
中(示例)
<?php use Drupal\DrupalExtension\Context\DrupalContext; use DrevOps\BehatSteps\ContentTrait; /** * Defines application features from the specific context. */ class FeatureContext extends DrupalContext { use ContentTrait; }
不需要修改 behat.yml
配置。
异常
\Exception
在所有断言中抛出。\RuntimeException
在步骤中未满足的任何要求抛出。
可用步骤
跳过场景之前的钩子
某些特性提供了 beforeScenario
钩子实现。可以通过在测试中添加 behat-steps-skip:METHOD_NAME
标签来禁用它们。
例如,要跳过 beforeScenario
钩子从 JsTrait
,将 @behat-steps-skip:jsBeforeScenarioInit
标签添加到功能中。
开发
本地环境设置
- 安装 Docker,Pygmy,Ahoy 并关闭本地网络服务(Apache/Nginx,MAMP 等)
- 在支持的 Docker 目录之一中检出项目仓库(支持的 Docker 目录)。
pygmy up
ahoy build
- 在 http://behat-steps.docker.amazee.io/ 访问构建的站点
使用 ahoy --help
查看可用命令列表。
Apple Silicon 调整
cp docker-compose.override.default.yml docker-compose.override.yml
运行测试
通过在项目中以相同的方式运行 Behat 测试来测试特性的源代码:特性被包含在 FeatureContext.php 中,然后使用 预配置的 fixture Drupal 网站使用测试功能 运行。
运行 ahoy build
以在 build
目录中设置 fixture Drupal 网站。
ahoy test-bdd # Run all tests ahoy test-bdd path/to/file # Run all scenarios in specific feature file ahoy test-bdd -- --tags=wip # Run all scenarios tagged with `@wip` tag
调试测试
ahoy debug
- 设置断点
- 使用
ahoy test-bdd
运行测试 - 您的 IDE 将捕获传入的调试连接
更新 fixture 网站
- 构建 fixture 网站并进行必要的更改
ahoy drush cex -y
- 使用
ahoy update-fixtures
将配置更改从构建目录复制到 fixtures 目录
使用 https://getscaffold.dev/ 项目模板创建的仓库