diff --git a/Makefile b/Makefile index b1e1a61a63..b82c273724 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ database-force-schema-update: docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) sh -c "/var/www/social/bin/console doctrine:schema:update --dump-sql --force" tooling-docker: .PHONY - @cd docker/tooling && docker-compose up -d > /dev/null 2>&1 + @cd docker/tooling && docker-compose up -d --build > /dev/null 2>&1 stop-tooling: .PHONY cd docker/tooling && docker-compose down @@ -46,7 +46,7 @@ tooling-php-shell: tooling-docker docker exec -it $(call translate-container-name,tooling_php_1) sh test-accesibility: tooling-docker - cd docker/tooling && docker-compose run pa11y /usr/local/bin/pa11y-ci -c /pa11y/config.json + cd docker/tooling && docker-compose run pa11y /accessibility.sh test: tooling-docker docker exec $(call translate-container-name,tooling_php_1) /var/tooling/coverage.sh $(call args,'') diff --git a/docker/tooling/acceptance_and_accessibility.sh b/docker/tooling/acceptance.sh similarity index 100% rename from docker/tooling/acceptance_and_accessibility.sh rename to docker/tooling/acceptance.sh diff --git a/docker/tooling/accessibility.sh b/docker/tooling/accessibility.sh new file mode 100755 index 0000000000..aecbf97d38 --- /dev/null +++ b/docker/tooling/accessibility.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +rm -rf /screenshots/diff +mv -fn /screenshots/new /screenshots/old +mkdir -p /screenshots/diff +mkdir -p /screenshots/new +chmod 777 -R /screenshots + +/generate_pa11y-ci-config.php + +su puppet -c '/usr/local/bin/pa11y-ci -c /pa11y/config.json' + +cd /screenshots/new || exit 1 + +for f in *; do + XC=$(compare -metric NCC "/screenshots/old/${f}" "${f}" "/screenshots/diff/${f}" 2>&1) + if [ 1 -eq "$(echo "${XC} < 0.999" | bc)" ]; then + printf '\e[33mCheck file for differences: \e]8;;%s\e\\%s\e]8;;\e\\\e[0m\n' "file:tests/screenshots/diff/${f}" "tests/screenshots/diff/${f}" + fi +done diff --git a/docker/tooling/docker-compose.yaml b/docker/tooling/docker-compose.yaml index 2369aff9c0..8234cbfc95 100644 --- a/docker/tooling/docker-compose.yaml +++ b/docker/tooling/docker-compose.yaml @@ -13,7 +13,7 @@ services: - ../social/install.sh:/var/entrypoint.d/0_social_install.sh - ./coverage.sh:/var/tooling/coverage.sh - ./phpstan.sh:/var/tooling/phpstan.sh - - ./acceptance_and_accessibility.sh:/var/tooling/acceptance_and_accessibility.sh + - ./acceptance.sh:/var/tooling/acceptance.sh # Main files - ../../:/var/www/social - /var/www/social/docker # exclude docker folder @@ -47,7 +47,10 @@ services: depends_on: - nginx volumes: - - ../../tests/pa11y-ci-config.json:/pa11y/config.json + - ../../tests/screenshots:/screenshots + - ./accessibility.sh:/accessibility.sh + - ./generate_pa11y-ci-config.php:/generate_pa11y-ci-config.php + - /pa11y cap_add: - SYS_ADMIN diff --git a/docker/tooling/generate_pa11y-ci-config.php b/docker/tooling/generate_pa11y-ci-config.php new file mode 100755 index 0000000000..860cbcda46 --- /dev/null +++ b/docker/tooling/generate_pa11y-ci-config.php @@ -0,0 +1,70 @@ +#!/usr/bin/env php +