fortress / contexts
Behat contexts
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 202
pkg:composer/fortress/contexts
Requires
- php: >=8.0
- ext-dom: *
- ext-libxml: *
- ext-simplexml: *
- behat/behat: ^3.8
- friends-of-behat/mink-extension: ^2.5
- justinrainbow/json-schema: ^5.2
- symfony/dom-crawler: ^4.4|^5.4|^6.0
- symfony/http-foundation: ^5.4|^6.0
- symfony/property-access: ^5.4|^6.0
Replaces
- behatch/contexts: 0.1.2
- sanpi/behatch-contexts: 0.1.2
README
Behat contexts provide most common Behat tests.
Installation
This extension requires:
- Mink
- Mink extension
Project dependency
- Install Composer
- Require the package with Composer:
$ composer require --dev fortress/behat-contexts
- Activate extension by specifying its class in your behat.yml:
# behat.yml default: # ... extensions: Behatch\Extension: ~
Project bootstraping
- Download the Behatch skeleton with composer:
$ php composer.phar create-project behatch/skeleton
Browser, json, table and rest step need a mink configuration, see Mink extension for more information.
Usage
In behat.yml, enable desired contexts:
default: suites: default: contexts: - behatch:context:browser - behatch:context:debug - behatch:context:system - behatch:context:json - behatch:context:table - behatch:context:rest - behatch:context:xml
Examples
This project is self-tested, you can explore the features directory to find some examples.
Configuration
- browser- more browser related steps (like mink)- timeout- default timeout
 
- debug- helper steps for debugging- screenshotDir- the directory where store screenshots
 
- system- shell related steps- root- the root directory of the filesystem
 
- json- JSON related steps- evaluationMode- javascript "foo.bar" or php "foo->bar"
 
- table- play with HTML the tables
- rest- send GET, POST, ... requests and test the HTTP headers
- xml- XML related steps
Configuration Example
For example, if you want to change default directory to screenshots - you can do it this way:
default: suites: default: contexts: - behatch:context:debug: screenshotDir: "var"