Level 14
I forgot I had these env vars set in the env example file, which was being copied:
DUSK_HEADLESS_DISABLED=false
DUSK_START_MAXIMIZED=false
which even if set causes it to be true. So I removed these and it's working well now.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey I'm trying to get laravel dusk to work via github actions, but it keeps failing:
name: CI
on:
push:
branches:
- "**"
- "!production"
- "!development"
jobs:
dusk-php:
services:
mailhog:
image: mailhog/mailhog:v1.0.1
ports:
- 1025:1025
- 8025:8025
meilisearch:
image: getmeili/meilisearch:v1.0.2
ports:
- 7700:7700
runs-on: ubuntu-latest
# env
env:
# set APP_URL
APP_URL: "http://127.0.0.1:8000"
# set FRONTEND_URL
FRONTEND_URL: "http://127.0.0.1:4000"
SANCTUM_STATEFUL_DOMAINS: "localhost:4000"
COOKIE_DOMAIN: "localhost"
# set MAIL_HOST
MAILHOG_URL: "http://127.0.0.1:8025"
MAIL_MAILER: "smtp"
MAIL_HOST: "localhost"
MAIL_PORT: "1025"
MAIL_USERNAME: null
MAIL_PASSWORD: null
MAIL_ENCRYPTION: null
# set DB
DB_USERNAME: root
DB_PASSWORD: root
# set meilisearch
SCOUT_DRIVER: meilisearch
MEILISEARCH_HOST: http://127.0.0.1:7700
MEILISEARCH_KEY: masterKey
steps:
# start uses
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Checkout api
uses: actions/checkout@v3
with:
path: app
- name: Cache Frontend Node Modules
id: cache-frontend-node-modules
uses: actions/cache@v2
with:
path: app/ui/node_modules
key: frontend-node-modules-${{ hashFiles('package-lock.json') }}
# Setup Quasar CLI
- name: Setup Quasar CLI
run: npm install -g @quasar/cli
- name: Prepare The Environment
working-directory: app/api
run: cp .env.example .env
- name: Create Database
run: |
sudo systemctl start mysql
mysql --user="root" --password="root" -e "CREATE DATABASE \`my-database\` character set UTF8mb4 collate utf8mb4_bin;"
- name: Install Composer Dependencies
working-directory: app/api
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Generate Application Key
working-directory: app/api
run: php artisan key:generate
- name: Install Frontend Dependencies
if: steps.cache-frontend-node-modules.outputs.cache-hit != 'true'
working-directory: app/ui
run: npm install
- name: Build Frontend
working-directory: app/ui
run: quasar build
- name: Run Frontend Server & continue
working-directory: app/ui
run: quasar serve dist/spa -s &
- name: Upgrade Chrome Driver
working-directory: app/api
run: php artisan dusk:chrome-driver --detect
- name: Start Chrome Driver
working-directory: app/api
run: /vendor/laravel/dusk/bin/chromedriver-linux &
- name: Run Laravel Server
working-directory: app/api
run: php artisan serve --no-reload &
# Run laravel migrations
- name: Run Laravel Migrations
working-directory: app/api
run: php artisan migrate:fresh --seed --no-interaction -vvv
- name: Run Dusk Tests
working-directory: app/api
run: php artisan dusk
- name: Run Tests
working-directory: app/api
run: php artisan test
"Run Dusk Tests" error:
Run php artisan dusk
Warning: TTY mode requires /dev/tty to be read/writable.
PHPUnit 10.0.19 by Sebastian Bergmann and contributors.
Runtime: PHP 8.1.2-1ubuntu2.11
Configuration: /home/runner/work/asc/asc/app/api/phpunit.dusk.xml
E 1 / 1 (100%)
Time: 00:05.392, Memory: 24.00 MB
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\UnknownErrorException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
/home/runner/work/asc/asc/app/api/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:146
/home/runner/work/asc/asc/app/api/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:359
/home/runner/work/asc/asc/app/api/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:129
/home/runner/work/asc/asc/app/api/tests/DuskTestCase.php:44
/home/runner/work/asc/asc/app/api/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:220
/home/runner/work/asc/asc/app/api/vendor/laravel/framework/src/Illuminate/Support/helpers.php:247
/home/runner/work/asc/asc/app/api/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:221
/home/runner/work/asc/asc/app/api/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:99
/home/runner/work/asc/asc/app/api/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:67
/home/runner/work/asc/asc/app/api/tests/Browser/ExampleTest.php:24
/home/runner/work/asc/asc/app/api/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:173
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Error: Process completed with exit code 2.
any tips?
I forgot I had these env vars set in the env example file, which was being copied:
DUSK_HEADLESS_DISABLED=false
DUSK_START_MAXIMIZED=false
which even if set causes it to be true. So I removed these and it's working well now.
Please or to participate in this conversation.