diff --git a/.ahoy.l3d.yml b/.ahoy.l3d.yml index 796649b618c4590a7a72e603b813ff178747dde2..de2b7690741c1b2762b16084ac2b9fd5f6ab50e6 100644 --- a/.ahoy.l3d.yml +++ b/.ahoy.l3d.yml @@ -20,3 +20,7 @@ commands: imports: - ahoy.traefik.yml usage: Traefik commands + cypress: + imports: + - ahoy.cypress.yml + usage: Cypress diff --git a/ahoy.cypress.yml b/ahoy.cypress.yml new file mode 100644 index 0000000000000000000000000000000000000000..ab370dd2cdff22adc7f870fdb4243d16c3e5fcd8 --- /dev/null +++ b/ahoy.cypress.yml @@ -0,0 +1,19 @@ +ahoyapi: v2 +commands: + on: + cmd: | + CYPRESS=1 + echo "CYPRESS=1" >>.env + env -i $(cat .env | xargs) >.env + composer lakedrops:docker4drupal --no-interaction + ahoy d4d up cypress + usage: Turn on Cypress + off: + cmd: | + CYPRESS=0 + echo "CYPRESS=0" >>.env + env -i $(cat .env | xargs) >.env + composer lakedrops:docker4drupal --no-interaction + echo "You may have to close the Cypress window manually" + ahoy d4d stop cypress + usage: Turn off Cypress diff --git a/src/Handler.php b/src/Handler.php index 67c18eb2239c321643fa1fe6316b934ff3e4e440..20befa605c9915404171cca4b87febaad35b03df 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -184,6 +184,10 @@ class Handler extends BaseHandler { 'yearly' => 30, ], ], + 'cypress' => [ + 'enable' => $this->env->receiveGlobal('CYPRESS', 'Cypress', '0'), + 'version' => '10.8.0', + ], ]; } diff --git a/templates/docker-compose.yml.twig b/templates/docker-compose.yml.twig index b28c44aaa4e0451ab92e8ba7231ac0462ea86f13..c496527f02eceb85f49143b325be6d11a9487c17 100644 --- a/templates/docker-compose.yml.twig +++ b/templates/docker-compose.yml.twig @@ -520,3 +520,22 @@ services: env_file: ../backup/.env {% endif %} {% endif %} +{% if cypress.enable|default(0) %} + + cypress: + image: 'cypress/included:{{ cypress.version }}' + environment: + - CYPRESS_baseUrl={{ projectprotocol }}://{{ projectdomain }}{{ projectport }} +{% if not drupal.live|default(0) %} + - DISPLAY=:0 + network_mode: host +{% endif %} + working_dir: '/e2e' + volumes: + - {{ projectroot }}/tests/:/e2e +{% if not drupal.live|default(0) %} + - ~/.Xauthority:/root/.Xauthority:ro + entrypoint: cypress open --project /e2e + user: '1000' +{% endif %} +{% endif %}