guikingone / panther-extension
Mink 的 Panther 扩展
0.4.1
2020-05-06 19:31 UTC
Requires
- php: >=7.1
- ext-zip: *
- behat/behat: ^3.0.5
- behat/mink: ^1.5
- behat/mink-extension: ^2.0
- symfony/config: ^3.0|^4.0|^5.0
- symfony/panther: ^0.7.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- infection/infection: ^0.13.6
- phpstan/phpstan: ^0.12.23
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2024-09-13 18:00:15 UTC
README
Mink 扩展,用于控制 Chrome | Firefox | Selenium
,归功于 Symfony Panther。
前言
此扩展是实验性的(尽管稳定度为95%),某些功能可能缺失。
安装
首先,您需要安装 Symfony Panther 及其依赖项,然后
composer require guikingone/panther-extension
使用方法
default: suites: default: contexts: - PantherExtension\Context\PantherContext: - PantherExtension\Context\WaitContext: # Your contexts extensions: PantherExtension\Extension\PantherExtension: ~ Behat\MinkExtension: browser_name: chrome base_url: https:// sessions: default: panther: driver: 'chrome' # Or 'firefox', 'selenium', 'chrome' is the default value
WaitContext
是在 0.4 版本中引入的
如果您需要使用 Selenium
,只需调整会话配置
# ... extensions: PantherExtension\Extension\PantherExtension: ~ Behat\MinkExtension: browser_name: chrome base_url: https:// sessions: default: panther: driver: 'selenium' selenium: hub_url: 'http://127.0.0.1:4444/wd/hub'
以下是一个使用 POC 项目并调用 API-Platform 网站 的简单示例
Feature: As a newbie in API-Platform, I want to document myself in many features Scenario: I should be able to see the main documentation Given I am on "/" And I should see "REST and GraphQL framework to build modern API-driven projects" Scenario: I should be able to see the main documentation Given I am on "/" And I go to "/docs/distribution/" Then I should see "API Platform is the most advanced API platform, in any framework or language." Scenario: I should be able to document myself about GraphQL support Given I am on "/" And I follow "Get started" When I follow "Adding GraphQL Support" Then I should be on "/docs/distribution/#adding-graphql-support" Then I should see "You now have a GraphQL API!" Scenario: I should be able to document myself about GraphQL support thanks to the search field Given I am on "/" When I fill in "SEARCH..." with "GraphQL" And I wait for "#algolia-autocomplete-listbox-0" Then I should see "Documentation" And I should see "Search by" And I should see "Enabling GraphQL" Scenario: I should be able to test the demo Given I am on "/" And I follow "Demo" Then I should be on "https://demo-client.api-platform.com/" When I follow "API" Then I should be on "https://demo.api-platform.com/" Scenario: I should be able to test the demo Given I am on "/" And I follow "Community" And I create a new client "test" using the "chrome" driver Then I switch to client "test" And I go to "/" Then I should see "REST and GraphQL framework to build modern API-driven projects" Then I remove the client "test" Then I should see "API Platform's community" 6 scenarios (6 passed) 29 steps (29 passed) 0m28.61s (20.63Mb)
文档
完整文档可以在 此处 找到
CI 使用
请参阅有关在 CI 环境中使用 Symfony Panther 的文档。
开发
可以使用以下方式启动项目:
make boot
每个测试都可以使用以下方式启动:
make tests
要获取更多命令或帮助,请使用
make
贡献
只需 Fork 此存储库并提交新的 PR!