My dusk tests are failing for the same reason in my Github actions workflow.
Dec 30, 2023
1
Level 4
Dusk Tests not working in GitHub Actions (timeout: Timed out receiving message from renderer: 10.000)
Hi everyone,
I have the following GitHub Action:
name: "๐ฎ Frontend Tests"
on:
workflow_call:
jobs:
frontend_tests:
name: "๐ฎ Frontend Tests"
runs-on: "ubuntu-latest"
env:
APP_URL: "http://127.0.0.1:8000"
SESSION_DOMAIN: "127.0.0.1"
DB_CONNECTION: "pgsql"
DB_DATABASE: "tst"
DB_PORT: 5432
DB_USER: "root"
MAIL_MAILER: "log"
OCTANE_SERVER: "roadrunner"
OCTANE_HTTPS: false
services:
postgres:
image: "postgres:latest"
env:
POSTGRES_USER: "root"
POSTGRES_HOST_AUTH_METHOD: "trust"
POSTGRES_DB: "tst"
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -d tst -U root"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: "โฌ๏ธ Checkout Code"
uses: "actions/checkout@v4"
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: "๐ Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.2"
tools: "composer:v2"
extensions: "bcmath, ctype, dom, fileinfo, imagick, json, mbstring, openssl, pdo, redis, tokenizer, xml"
coverage: "pcov"
- name: "๐ฆ Cache Local Composer Dependencies"
uses: "actions/cache@v3"
id: "cache-composer"
with:
path: "vendor"
key: ${{ runner.OS }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.OS }}-composer-${{ hashFiles('**/composer.lock') }}
${{ runner.OS }}-composer-
- name: "๐ฆ Install Composer Dependencies"
run: "composer install --no-interaction --prefer-dist --optimize-autoloader"
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
- name: "๐๏ธ Setup .env"
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: "๐๏ธ Generate Application Key"
run: "php artisan key:generate"
- name: "๐๏ธ Set Directory Permissions"
run: "chmod -R 777 storage bootstrap/cache"
- name: "๐ฆ Install Node.js"
uses: "actions/setup-node@v4"
with:
node-version: 20
- name: "๐ฆ Cache Node Dependencies"
uses: "actions/cache@v3"
id: "cache-node"
with:
path: "node_modules"
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
${{ runner.OS }}-node-
- name: "๐ฆ Install Node Dependencies"
run: "npm ci"
- name: "๐ฆ Build Assets"
run: "npm run build"
- name: "๐๏ธ Upgrade Chrome Driver"
run: php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`
- name: "๐๏ธ Start Chrome Driver"
run: "./vendor/laravel/dusk/bin/chromedriver-linux &"
- name: "๐๏ธ Migrate Database"
run: "php artisan migrate:fresh"
- name: "๐๏ธ Start Laravel Octane"
run: "php artisan octane:start --no-interaction --host 0.0.0.0 --port 8000 &"
- name: "๏ธ๐ฎ Check if Server works"
uses: "jtalk/url-health-check-action@v3"
with:
url: "http://127.0.0.1:8000/app/login"
follow-redirect: true
max-attempts: 10
retry-delay: 5s
retry-all: true
- name: "๐ฎ๏ธ Laravel Dusk Tests"
run: "php artisan pest:dusk"
- name: Upload App Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: logs
path: storage/logs
- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: tests/Browser/screenshots
- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: console
path: tests/Browser/console
When I run the tests locally, everything is running smoothly. But the action runner is always failing with the following error:
php artisan pest:dusk
shell: /usr/bin/bash -e ***0***
env:
APP_URL: http://127.0.0.1:8000
SESSION_DOMAIN: 127.0.0.1
DB_CONNECTION: pgsql
DB_DATABASE: tst
DB_PORT: 5432
DB_USER: root
MAIL_MAILER: log
OCTANE_SERVER: roadrunner
OCTANE_HTTPS: false
COMPOSER_PROCESS_TIMEOUT: 0
COMPOSER_NO_INTERACTION: 1
COMPOSER_NO_AUDIT: 1
Warning: TTY mode requires /dev/tty to be read/writable.
FAIL Tests\Browser\tests\app\Domain\User\Misc\ImpersonateTest
โจฏ leaving the impersonation redirects the user back to the same tenaโฆ 64.47s
โจฏ leaving the impersonation redirects the user back to the same tenaโฆ 61.49s
โจฏ leaving the impersonation redirects the user back to the same tenaโฆ 61.44s
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
FAILED Tests\Browser\tests\app\Domain\User\Misc\Impersโฆ TimeoutException
timeout: Timed out receiving message from renderer: 10.000
(Session info: chrome=120.0.6099.109)
at vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:136
132โ throw new StaleElementReferenceException($message, $results);
133โ case 'detached shadow root':
134โ throw new DetachedShadowRootException($message, $results);
135โ case 'timeout':
โ 136โ throw new TimeoutException($message, $results);
137โ case 'unable to set cookie':
138โ throw new UnableToSetCookieException($message, $results);
139โ case 'unable to capture screen':
140โ throw new UnableToCaptureScreenException($message, $results);
+8 vendor frames
9 tests/Browser/tests/app/Domain/User/_Misc/ImpersonateTest.php:17
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
FAILED Tests\Browser\tests\app\Domain\User\Misc\Impersโฆ TimeoutException
timeout: Timed out receiving message from renderer: 10.000
(Session info: chrome=120.0.6099.109)
at vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:136
132โ throw new StaleElementReferenceException($message, $results);
133โ case 'detached shadow root':
134โ throw new DetachedShadowRootException($message, $results);
135โ case 'timeout':
โ 136โ throw new TimeoutException($message, $results);
137โ case 'unable to set cookie':
138โ throw new UnableToSetCookieException($message, $results);
139โ case 'unable to capture screen':
140โ throw new UnableToCaptureScreenException($message, $results);
+8 vendor frames
9 tests/Browser/tests/app/Domain/User/_Misc/ImpersonateTest.php:130
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
FAILED Tests\Browser\tests\app\Domain\User\Misc\Impersโฆ TimeoutException
timeout: Timed out receiving message from renderer: 10.000
(Session info: chrome=120.0.6099.109)
at vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:136
132โ throw new StaleElementReferenceException($message, $results);
133โ case 'detached shadow root':
134โ throw new DetachedShadowRootException($message, $results);
135โ case 'timeout':
โ 136โ throw new TimeoutException($message, $results);
137โ case 'unable to set cookie':
138โ throw new UnableToSetCookieException($message, $results);
139โ case 'unable to capture screen':
140โ throw new UnableToCaptureScreenException($message, $results);
+8 vendor frames
9 tests/Browser/tests/app/Domain/User/_Misc/ImpersonateTest.php:246
Tests: 3 failed (0 assertions)
Duration: 187.52s
I think that i followed all instructions from the Laravel Dusk docs for the CI setup. Does someone has an idea on how to solve this issue?
Many thanks, Fabian
Please or to participate in this conversation.