punktde / codeception-mailhog
提供模块和gherkin步骤,用于访问mailhog API进行codeception测试
4.0.0
2024-03-13 13:00 UTC
Requires
- codeception/codeception: ^5.0
- codeception/module-webdriver: ^3.0 | ^4.0
- neos/utility-arrays: *
This package is auto-updated.
Last update: 2024-09-13 14:04:17 UTC
README
使用Mailhog进行测试的Gherkin步骤和模块功能
如何使用
先决条件
您必须安装Mailhog,并确保您的应用程序已配置为向mailhog发送邮件。请参阅 https://github.com/mailhog/MailHog
模块
您需要将 Webdriver
模块添加到您的配置中才能使用 Mailhog
模块。在您的 codeception.yaml
中使用模块 PunktDe\Codeception\Mailhog\Module\Mailhog
。您可以根据需要配置mailhog客户端可访问的uri(默认为 http://127.0.0.1:8025)
modules: enabled: - WebDriver: url: 'http://acceptance.dev.punkt.de/' browser: chrome restart: true window_size: 1920x2080 capabilities: chromeOptions: args: - '--headless' - '--disable-gpu' - '--disable-dev-shm-usage' - '--no-sandbox' - PunktDe\Codeception\Mailhog\Module\Mailhog: base_uri: http://mailhog.project
Gherkin步骤
只需将特性 PunktDe\Codeception\Mailhog\ActorTraits\Mailhog
添加到您的测试actor中。然后您可以使用 *.feature
文件来编写带有新步骤的Gherkin测试。
示例actor
<?php /* * (c) 2018 punkt.de GmbH - Karlsruhe, Germany - http://punkt.de * All rights reserved. */ /** * Inherited Methods * @method void wantToTest($text) * @method void wantTo($text) * @method void execute($callable) * @method void expectTo($prediction) * @method void expect($prediction) * @method void amGoingTo($argumentation) * @method void am($role) * @method void lookForwardTo($achieveValue) * @method void comment($description) * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) * * @SuppressWarnings(PHPMD) */ class AcceptanceTester extends \Codeception\Actor { use _generated\AcceptanceTesterActions; use \PunktDe\Codeception\Mailhog\ActorTraits\Mailhog; // use the mailhog steps trait }
有哪些步骤可用?
要获取所有可用步骤,您可以运行以下命令
vendor/bin/codecept -c path/to/codeception.yaml gherkin:steps suiteName
这将给出所有可用步骤的表格。