pararius / panther-actions
An extension for the browser testing and web scraping library for PHP and Symfony. This adds extra assertions, actions for Symfony Panther.
Installs: 3 026
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- ext-dom: *
- ext-libxml: *
- ext-zip: *
- phpunit/phpunit: ^9.5
- symfony/panther: ^2.0
Requires (Dev)
- behat/behat: ^3.8
- pararius/cs: ^0.1.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- symfony/dotenv: ^5.3 || ^6.0
- symfony/framework-bundle: ^5.3 || ^6.0
- symfony/security-core: ^5.3 || ^6.0
Suggests
- behat/behat: To integrate Symfony Panther with behat.
- symfony/framework-bundle: To integrate logging in via Symfony.
- symfony/security-core: To integrate logging in via Symfony.
README
This project can be used for two reasons:
- Use Symfony Panther inside Behat.
- Extend Symfony Panther with a number of additional actions.
At first, we developed this package to replace Behat Mink. Mink has a history of slow updates and this is troublesome when you want to upgrade your project to the newest PHP version. We created a Behat Context with the same signature as a lot of often used Behat Mink steps. This can help you to replace Behat Mink with Symfony Panther, while still using the expressive syntax of Behat.
On a newer project we didn't want to use Behat and went with PHPUnit. There we started to use Symfony Panther, but quickly found out that we were missing a lot of actions that we got used to, while using Behat Mink. Therefore, we modified this package to be used inside a project without Behat as well.
What is Symfony Panther?
Panther is a convenient standalone library to scrape websites and to run end-to-end tests using real browsers.
Test coverage
A number of unit tests have been added to ensure the functionality. Not all functions are unit-tested. We will add more test coverage later on. For easy development and CI the docker and docker compose configurations have been added as well.
Using this without Symfony Framework
Symfony Panther can be used without the Symfony framework. This package can be used without the Symfony framework as well.
Installation
More instructions on how to install and configure Symfony Panther can be found here
You'll need these environment variables for all components to work together:
PANTHER_APP_ENV=panther PANTHER_NO_SANDBOX=1 PANTHER_CHROME_ARGUMENTS="--disable-dev-shm-usage" PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots PANTHER_EXTERNAL_BASE_URI=http://test-webserver:9080 # Change this to an address that serves your web-app
Further instructions can be found in the "How to" guides below.
How to use
Troubleshooting
If you followed the instructions on the Symfony Panther documentation then all should work. If not then you might have forgotten:
- Make sure the test webserver is running. For a docker example you can check the docker-compose.yaml file in this project.
- Make sure that you have either chrome or firefox installed. For a docker example you can check the Dockerfile in this project.