mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Command for single-setup of behat tests
This commit is contained in:
parent
42efff5eac
commit
3cf7db107b
16
README.md
16
README.md
@ -102,6 +102,22 @@ This will start a Firefox browser by default. Other browsers and profiles can be
|
||||
|
||||
For example, if you want to start a Chrome Browser you can following the instructions provided [here](docs/chrome-behat.md).
|
||||
|
||||
### Running with stand-alone command
|
||||
|
||||
If running with `silverstripe/serve` and `chromedriver`, you can also use the following command
|
||||
which will automatically start and stop these services for individual tests.
|
||||
|
||||
vendor/bin/behat-ss @framework
|
||||
|
||||
This automates:
|
||||
- starting server
|
||||
- starting chromedriver
|
||||
- running behat
|
||||
- shutting down chromedriver
|
||||
- shutting down server
|
||||
|
||||
Make sure you set `SS_BASE_URL` to `http://localhost:8080` in `.env`
|
||||
|
||||
## Tutorials
|
||||
|
||||
* [Tutorial: Testing Form Submissions](docs/tutorial.md)
|
||||
|
20
bin/behat-ss
Executable file
20
bin/behat-ss
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
echo "setting up /artifacts"
|
||||
mkdir -p artifacts
|
||||
|
||||
echo "starting chromedriver"
|
||||
chromedriver &> artifacts/chromedriver.log 2> artifacts/chromedriver-error.log &
|
||||
cd_pid=$!
|
||||
|
||||
echo "starting webserver"
|
||||
vendor/bin/serve &> artifacts/serve.log 2> artifacts/serve-error.log &
|
||||
ws_pid=$!
|
||||
|
||||
echo "starting behat"
|
||||
vendor/bin/behat "$@"
|
||||
|
||||
echo "killing webserver (PID: $ws_pid)"
|
||||
pkill -TERM -P $ws_pid &> /dev/null
|
||||
|
||||
echo "killing chromedriver (PID: $cd_pid)"
|
||||
kill -9 $cd_pid &> /dev/null
|
@ -47,6 +47,9 @@
|
||||
"3.x-dev": "3.1.x-dev"
|
||||
}
|
||||
},
|
||||
"bin": [
|
||||
"bin/behat-ss"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "phpcs --standard=PSR2 -n src/ tests/php/"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user