MinkExtension
Mink browser-automation integration and configuration layer for the Behat BDD framework.
Repository Health
Technical Analysis
MinkExtension wires the Mink browser-abstraction library into Behat, so PHP teams can drive real browsers and headless HTTP clients directly from their Gherkin scenarios. It ships ready-to-use context classes, session management, and a rich configuration layer for pointing tests at Selenium, WebDriver, BrowserKit, Sauce Labs, BrowserStack, and Appium drivers.
This FriendsOfBehat fork keeps the extension maintained for modern PHP and Symfony versions, preserving the familiar MinkContext step definitions and service-container factories that thousands of acceptance-test suites already depend on.
What You Get
- A ready-made
MinkContextwith common web-testing step definitions - Base
RawMinkContextandMinkAwareContextclasses to build custom contexts on - Driver factories for Selenium, WebDriver, BrowserKit, Sauce Labs, BrowserStack, and Appium
- A Behat configuration schema for base URLs, sessions, and per-driver capabilities
- Automatic session lifecycle handling and failure screenshots between scenarios
Common Use Cases
- Writing end-to-end acceptance tests for a web application in Gherkin
- Running the same scenarios against a headless BrowserKit client and a real browser
- Integrating cloud browser grids like Sauce Labs or BrowserStack into a CI pipeline
- Extending the provided contexts with project-specific navigation and assertions
Under The Hood
Architecture - The extension implements Behat’s ExtensionInterface in src/Behat/MinkExtension/ServiceContainer/MinkExtension.php, registering Mink services into Behat’s Symfony-based service container and exposing a configuration tree for sessions and drivers. Driver selection is delegated to a set of DriverFactory implementations (Selenium2, Selenium4, WebdriverClassic, BrowserKit, SauceLabs, BrowserStack, Appium) under ServiceContainer/Driver, while a SessionsListener manages session lifecycle and a FailureShowListener reacts to failed steps.
Tech Stack - Pure PHP targeting PHP ^8.3, built on behat/behat, behat/mink, and symfony/config for the configuration schema. Development uses phpspec for specs, PHPStan for static analysis, and php-cs-fixer for style, all declared in composer.json.
Code Quality - The codebase is small, focused, and organized by responsibility (Context, Listener, ServiceContainer/Driver). It ships a spec/ directory of phpspec specifications and a phpstan.neon config, indicating maintained static analysis and test coverage of the factory logic; naming follows Symfony/Behat conventions consistently.
API Design - Users interact almost entirely through YAML/PHP Behat configuration and by extending RawMinkContext or using the bundled MinkContext, which keeps the getting-started boilerplate minimal. The driver-factory abstraction makes switching browsers a config change rather than a code change, though the underlying Mink API knowledge is still required to write custom steps.
Used by 2 apps in this directory
BillaBear
Ecommerce · Invoicing Finance
Self-hostable subscription management and billing platform with Stripe integration, tax automation, configurable workflows, and Twig-based document generation.
opencloud
File Storage
Open source file management and collaboration platform that keeps your data under your control, no database required.