-
Notifications
You must be signed in to change notification settings - Fork 511
feat: Allow Laravel Sail to run Pest 4 Browser tests #812
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
Conversation
|
I have updated sail composer package, installed pest and playwright, but can't run pest browser test using sail (sail pest command): Playwright is outdated. Please run [npm install playwright@latest && npx playwright install] in the root directory of your project. When running ./vendor/bin/pest using locally installed php everything is fine. Any advice? |
|
@maximyugov yes or you can follow this discussion |
|
@rogerio-pereira Hi. I've tried to do what is described in the discussion, but still it doesnt work for me. |
|
Sorry @maximyugov
laravel.test:
build:
context: './docker/8.4'
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: 'sail-8.4/app' #Check here
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
IGNITION_LOCAL_SITES_PATH: '${PWD}'
volumes:
- '.:/var/www/html'
networks:
- sail
{
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.13",
"laravel/sail": "^1.45.0", //Check here
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"pestphp/pest": "^4.0", //Check here
"pestphp/pest-plugin-browser": "^4.0",
"pestphp/pest-plugin-type-coverage": "^4.0"
},
{
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite",
"postinstall": "npx playwright install" // Add this line
},
"dependencies": {
"@tailwindcss/vite": "^4.1.11",
"autoprefixer": "^10.4.20",
"axios": "^1.7.4",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0",
"tailwindcss": "^4.0.7",
"vite": "^7.0.4"
},
"devDependencies": {
"playwright": "^1.55.0" // Add this line (note, is dev dependencies)
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "4.9.5",
"@tailwindcss/oxide-linux-x64-gnu": "^4.0.1",
"lightningcss-linux-x64-gnu": "^1.29.1"
}
}
sail down -v
# I deleted the cached docker image, just to be sure
# docker system prune --all --force
sail up -d --build
# Update composer and npm dependencies
sail composer update
sail npm update
# Install pest browser tests
sail composer require pestphp/pest-plugin-browser --dev
sail npm install |
|
@rogerio-pereira Finally, it works! |
This Merge request prepare Laravel Sail image to run Pest 4 Browser tests.
I don't know how to write automated tests for docker images, but this is working on my projects
Aditional info (not required)
Besides this i had to include on package.json (but this change is related to PEST 4 package, i'll open a PR related to it on Pest 4 repo)
Also i'm able to run the browser tests on my Github CI workflow