Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser Tests (aka Feature Tests, aka Laravel Dusk Tests) #167

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
APP_NAME=local
APP_ENV=local
APP_KEY=base64:t/RoN0Vj+VpQ+K7Le+5WXnErFRa0B1uIToMNltCuvK8=
APP_DEBUG=true
APP_KEY=SomeRandomString
APP_URL=http://localhost
APP_URL=http://127.0.0.1:8000
APP_LOG=daily

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
Expand All @@ -10,9 +14,11 @@ DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
QUEUE_DRIVER=sync
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
Expand All @@ -25,5 +31,17 @@ MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

MYSQL_DUMP_PATH=/Applications/MAMP/Library/bin/
MYSQL_DUMP_PATH=/Applications/MAMP/Library/bin/
47 changes: 47 additions & 0 deletions .env.testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
APP_NAME=local
APP_ENV=testing
APP_KEY=base64:t/RoN0Vj+VpQ+K7Le+5WXnErFRa0B1uIToMNltCuvK8=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000
APP_LOG=daily

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

MYSQL_DUMP_PATH=/Applications/MAMP/Library/bin/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Homestead.json
.DS_Store
.packages
.quarantine
.tmb
.tmb
.phpunit.result.cache
21 changes: 19 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ matrix:
- php: 8.0
- php: nightly

addons:
chrome: stable

env:
global:
- APP_ENV=local
- APP_DEBUG=true
- APP_KEY=base64:jNI+qJRj1eqN3RWMeBWo6sxMwKzgDP7Py2AfRJ1luyA=
- APP_URL=http://localhost
- APP_URL=http://127.0.0.1:8000
- DB_CONNECTION=mysql
- DB_HOST=127.0.0.1
- DB_PORT=3306
Expand All @@ -45,10 +48,24 @@ services: mysql
before_install:
- mysql -e "create database IF NOT EXISTS test;" -uroot

install: travis_retry composer install --no-interaction --prefer-source

install:
- cp .env.testing .env
- travis_retry composer install --no-interaction --prefer-source
- php artisan key:generate
- php artisan dusk:update
- php artisan dusk:chrome-driver


before_script:
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- php artisan serve &


script: vendor/bin/phpunit --coverage-clover=coverage.clover


after_script:
- php artisan dusk
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"laracasts/generators": "^2.0",
"backpack/generators": "^3.0",
"itsgoingd/clockwork": "^4.0",
"barryvdh/laravel-debugbar": "^3.2"
"barryvdh/laravel-debugbar": "^3.2",
"laravel/dusk": "^6.1",
"staudenmeir/dusk-updater": "^1.1"
},
"autoload": {
"classmap": [
Expand All @@ -47,7 +49,10 @@
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
],
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
Expand Down
Loading