Skip to content

Instantly share code, notes, and snippets.

@rohit-sagar256
Created June 18, 2022 20:59
Show Gist options
  • Save rohit-sagar256/099646217ba936655c7503284beba709 to your computer and use it in GitHub Desktop.
Save rohit-sagar256/099646217ba936655c7503284beba709 to your computer and use it in GitHub Desktop.
Laravel Dusk Test Setup
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:2vqUYOIZZQ17nowCLkMT5EbgS/RzDRrNYbVoZ+IRurQ=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=dbname
DB_USERNAME=root
DB_PASSWORD=rohit
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=public
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
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}"
name: Sukan - Food
on:
push:
branches:
- dev
jobs:
laravel-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: mirromutth/mysql-action@v1.1
with:
mysql root password: rohit
# MYSQL_DATABASE - name for the default database that is created
mysql database: dbname
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install NPM packages
run: npm ci
- name: Build frontend
run: npm run development
- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.dusk', '.env');"
- name: Install Laravel Dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Run Migrations
run: |
php artisan migrate
php artisan db:seed
- name: Show dir
run: pwd
- name: PHP Version
run: php --version
# Code quality
- name: Browser Test - upgrade and start Chrome Driver
run: |
php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`
./vendor/laravel/dusk/bin/chromedriver-linux &
- name: Run Dusk Tests
env:
APP_URL: "http://127.0.0.1:8000"
run: |
php artisan serve --no-reload &
chmod -R 0755 vendor/laravel/dusk/bin/
php artisan dusk
- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v2
with:
name: screenshots
path: tests/Browser/screenshots
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v2
with:
name: console
path: tests/Browser/console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment