integratedexperts/behat-steps

此软件包已被 废弃 且不再维护。作者建议使用 drevops/behat-steps 软件包。

Behat 步骤集合

资助软件包维护!
drevops
Patreon


README

Behat steps logo

Drupal 的 Behat 步骤集合

GitHub Issues GitHub Pull Requests CircleCI codecov GitHub release (latest by date) LICENSE Renovate

Total Downloads

安装

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 标签来禁用它们。

例如,要跳过 JsTrait 中的 beforeScenario 钩子,请向功能添加 @behat-steps-skip:jsBeforeScenarioInit 标签。

开发

本地环境设置

使用 ahoy --help 查看可用命令列表。

Apple Silicon 调整

cp docker-compose.override.default.yml docker-compose.override.yml

运行测试

通过以与项目运行相同的方式运行 Behat 测试来测试特质的源代码:特质被包含到 FeatureContext.php 中,然后使用 fixture Drupal 站点测试功能 运行。

运行 ahoy buildbuild 目录中设置 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/ 项目模板创建的存储库