Created
September 7, 2019 21:03
-
-
Save dinarcon/6916cd293b4bb4b74f971d8d87066013 to your computer and use it in GitHub Desktop.
WordPress BDD testing with Behat and WordHat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Visibility of the homepage | |
In order to have confidence that my site is accessible | |
As a site administrator | |
I want to verify I can visit the homepage | |
Scenario: Verify the homepage | |
Given I am on the homepage | |
Then the response status code should be 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: | |
suites: | |
default: | |
contexts: | |
- PaulGibbs\WordpressBehatExtension\Context\WordpressContext | |
- FeatureContext | |
- Behat\MinkExtension\Context\MinkContext | |
- PaulGibbs\WordpressBehatExtension\Context\ContentContext | |
- PaulGibbs\WordpressBehatExtension\Context\DashboardContext | |
- PaulGibbs\WordpressBehatExtension\Context\SiteContext | |
- PaulGibbs\WordpressBehatExtension\Context\UserContext | |
- PaulGibbs\WordpressBehatExtension\Context\EditPostContext | |
- PaulGibbs\WordpressBehatExtension\Context\WidgetContext | |
- PaulGibbs\WordpressBehatExtension\Context\ToolbarContext | |
extensions: | |
DMore\ChromeExtension\Behat\ServiceContainer\ChromeExtension: ~ | |
Behat\MinkExtension: | |
base_url: http://one.wordpress.test/ | |
browser_name: chrome | |
default_session: headless | |
javascript_session: javascript | |
sessions: | |
headless: | |
goutte: | |
guzzle_parameters: | |
verify: false | |
javascript: | |
chrome: | |
api_url: http://localhost:9222 | |
validate_certificate: false | |
PaulGibbs\WordpressBehatExtension: | |
default_driver: wpcli | |
path: /srv/www/wordpress-one/public_html | |
users: | |
- | |
roles: | |
- administrator | |
username: admin | |
password: password | |
database: | |
restore_after_test: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: | |
suites: | |
default: | |
contexts: | |
- FeatureContext | |
- Behat\MinkExtension\Context\MinkContext | |
extensions: | |
Behat\MinkExtension: | |
base_url: http://one.wordpress.test/ | |
goutte: ~ | |
selenium2: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instalar dependencias | |
composer require --dev behat/behat behat/mink-extension paulgibbs/behat-wordpress-extension behat/mink-goutte-driver dmore/behat-chrome-extension behat/mink-selenium2-driver behatch/contexts | |
# Ver pasos disponibles en contextos | |
./vendor/bin/behat -dl | |
# Ejecutar pruebas | |
./vendor/bin/behat | |
# Copiar archivo de configuración de ejemplo | |
# Ver https://wordhat.info/getting-started/installation.html | |
cp vendor/paulgibbs/behat-wordpress-extension/behat.yml.dist behat.yml | |
# Ejecutar pruebas con JavaScript en el host | |
google-chrome --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Login as an administrator | |
As a maintainer of the site | |
I want basic login behavior to work | |
So that I can administer the site | |
Background: | |
Given I am logged in as an administrator | |
When I go to the dashboard | |
Scenario: Confirm access to create users | |
When I go to the "Users > Add New" menu | |
Then I should see "Add New User" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment