devshop/behat-drupal-extension

为 DevShop 上 Drupal 提供动力的 Behat 扩展

dev-master 2023-04-27 21:55 UTC

This package is auto-updated.

Last update: 2024-08-28 00:40:06 UTC


README

这个 Behat 扩展只是扩展了 Drupal Behat 扩展,使其更具实用性。

它不要求使用 DevShop,但某些功能在使用 DevShop 时会更加出色。

新步骤

然后我截取屏幕截图

当使用 Selenium 服务器且测试带有 "@javascript" 标签时,此步骤会将屏幕截图保存到活动网站的文件文件夹中,并打印一个链接。

当我运行 "命令" 时

此步骤简单地执行 exec() 命令,并在抛出非零退出代码时抛出异常。

我选择标签包含字符串 :label 的单选按钮

这对于具有长标签或动态标签的单选按钮非常有用。它搜索字符串而不是进行精确匹配。

其他功能

简化设置。

现在,此插件包含在 DevShop Composer 模板 中,这是在 DevShop 中运行 Drupal 代码库的最简单方法。

如果您已经有了一个项目,可以将 测试文件夹 的全部内容复制到您的项目中。

要启动新项目,使用以下命令

composer create-project devshop/composer-template:8.x-dev --stability dev --no-interaction mynewproject

步骤失败信息

当任何步骤失败时,测试运行器将输出它所在的 URL,保存 HTML 和屏幕截图到可读的文件夹中,并提供一个链接,如下所示

Feature: DevShop.Support Registration
  In order to use DevShop.Support
  As a customer
  I need to register a new account.

  @api @javascript
  Scenario: Pre-beta registration                                     # features/demos.feature:7
    Given I am an anonymous user                                      # Drupal\DrupalExtension\Context\DrupalContext::assertAnonymousUser()
    When I am on "home"                                               # Drupal\DrupalExtension\Context\MinkContext::visit()
    And I take a screenshot                                           # FeatureContext::iTakeAScreenshot()
      │ Screenshot: http://pr35.devshop.support/sites/pr35.devshop.support/files//screenshot0U4Ddt.png 
      │ 
    Then I should see "Host Your Own Drupal"                          # Drupal\DrupalExtension\Context\MinkContext::assertPageContainsText()
      Element not found with xpath, //html
       (WebDriver\Exception\NoSuchElement)
    │
    │  Step Failed. 
    │  Site: pr35.devshop.support 
    │  Current URL: http://pr35.devshop.support/home
    │  Screenshot: http://pr35.devshop.support/sites/pr35.devshop.support/files/test_failures//IshouldseeHostYourOwnDrupalNLpp17.png 
    │  Last Page Output: http://pr35.devshop.support/sites/pr35.devshop.support/files/test_failures/failure-1539455962.html 
    │  
    │  Watchdog Errors:
    │   ID     Date          Type      Severity  Message                               
    │   42785  13/Oct 14:39  page not  warning   favicon.ico                           
    │                        found                                                     
    │   42784  13/Oct 14:39  page not  warning   favicon.ico                           
    │                        found                                                     
    │   42783  13/Oct 14:39  actions   info      5 orphaned actions                    
    │                                            (comment_publish_action,              
    │                                            comment_save_action,        

许多更多功能正在开发中!