laravel / sail

Docker files for running a basic Laravel application.
https://laravel.com/docs/sail
MIT License
1.69k stars 477 forks source link

Using Laravel Sail to Package Development #615

Closed joaopalopes24 closed 1 year ago

joaopalopes24 commented 1 year ago

Sail Version

v1.24.0

Laravel Version

v10.21.0

PHP Version

8.2.10

Operating System

Linux

OS Version

Ubuntu 22.04

Description

I'm trying to use Laravel Sail in the development of a laravel package along with testbench. It works great, but I'm having problems with browser tests.

Is there any possibility to make it work, using the selenium image?

Steps To Reproduce

My docker-compose.yml:

# For more information: https://laravel.com/docs/sail
version: '3'
services:
    laravel.test:
        build:
            context: ./vendor/laravel/sail/runtimes/8.2
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.2/app
        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:-develop,debug,coverage}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
            IGNITION_LOCAL_SITES_PATH: '${PWD}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
        depends_on:
            - selenium
    selenium:
        image: selenium/standalone-chrome
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        volumes:
            - '/dev/shm:/dev/shm'
        networks:
            - sail
        ports:
            - 4444:4444
networks:
    sail:
        driver: bridge

Add in phpunit.xml:

<env name="DUSK_DRIVER_URL" value="http://selenium:4444/wd/hub" />

Error:

image

joaopalopes24 commented 1 year ago

I know that this is not a bug, as Sail is aimed at Laravel applications, but if you have an idea of ​​the problem and can help, I will be grateful.

crynobone commented 1 year ago

As the maintainer of Testbench Dusk, I cannot verify that Testbench Dusk can even support being used in Sail and GitHub issues should only be used for confirmed bugs.

Either someone come out with a solution within Testbench Dusk or it just not possible at the moment.

joaopalopes24 commented 1 year ago

@crynobone Any idea how to resolve this?

crynobone commented 1 year ago

See my previous response.