@@ -471,6 +471,63 @@ else
471471 PHP_FPM_OPTIONS=" -d xdebug.mode=debug -d xdebug.start_with_request=yes -d xdebug.client_host=${CONTAINER_HOST} -d xdebug.client_port=${PHP_XDEBUG_PORT} -d memory_limit=256M"
472472fi
473473
474+ runPlaywright () {
475+ # rm -rf ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/AcceptanceReports
476+ # mkdir -p ${CORE_ROOT}/.Build/Web/typo3temp/var/tests/acceptance
477+ APACHE_OPTIONS=" -e APACHE_RUN_USER=#${HOST_UID} -e APACHE_RUN_SERVERNAME=web -e APACHE_RUN_GROUP=#${HOST_PID} -e APACHE_RUN_DOCROOT=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance -e PHPFPM_HOST=phpfpm -e PHPFPM_PORT=9000 -e TYPO3_PATH_ROOT=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance"
478+
479+ # APACHE_OPTIONS="-e APACHE_RUN_USER=#${HOST_UID} -e APACHE_RUN_SERVERNAME=web -e APACHE_RUN_GROUP=#${HOST_PID} -e APACHE_RUN_DOCROOT=${CORE_ROOT}/typo3temp/var/tests/playwright-composer/public -e PHPFPM_HOST=phpfpm -e PHPFPM_PORT=9000"
480+ # if [[ ${PLAYWRIGHT_PREPARE_ONLY} -eq 1 ]]; then
481+ APACHE_OPTIONS=" ${APACHE_OPTIONS} -p 127.0.0.1::80"
482+ # fi
483+
484+
485+ ${CONTAINER_BIN} run --rm ${CI_PARAMS} -d ${SELENIUM_GRID} --name ac-chrome-${SUFFIX} --network ${NETWORK} --network-alias chrome --tmpfs /dev/shm:rw,nosuid,nodev,noexec ${IMAGE_SELENIUM} > /dev/null
486+ if [ ${CONTAINER_BIN} = " docker" ]; then
487+ if [[ " ${USE_APACHE} " -eq 1 ]]; then
488+ ${CONTAINER_BIN} run --rm -d --name ac-phpfpm-${SUFFIX} --network ${NETWORK} --network-alias phpfpm --add-host " ${CONTAINER_HOST} :host-gateway" ${USERSET} -e PHPFPM_USER=${HOST_UID} -e PHPFPM_GROUP=${HOST_PID} -e TYPO3_PATH_ROOT=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance -v ${CORE_ROOT} :${CORE_ROOT} ${IMAGE_PHP} php-fpm ${PHP_FPM_OPTIONS} > /dev/null
489+ ${CONTAINER_BIN} run --rm -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web --add-host " ${CONTAINER_HOST} :host-gateway" -v ${CORE_ROOT} :${CORE_ROOT} ${APACHE_OPTIONS} ${IMAGE_APACHE} > /dev/null
490+ else
491+ # @todo Remove fallback when TF7 has been dropped (along with TYPO3 v11 support).
492+ ${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web --add-host " ${CONTAINER_HOST} :host-gateway" ${USERSET} -v ${CORE_ROOT} :${CORE_ROOT} ${XDEBUG_MODE} -e typo3TestingAcceptanceBaseUrl=http://web:8000/ -e XDEBUG_CONFIG=" ${XDEBUG_CONFIG} " -e TYPO3_PATH_ROOT=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance ${IMAGE_PHP} php -S web:8000 -t ${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance > /dev/null
493+ fi
494+ else
495+ if [[ " ${USE_APACHE} " -eq 1 ]]; then
496+ ${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-phpfpm-${SUFFIX} --network ${NETWORK} --network-alias phpfpm ${USERSET} -e PHPFPM_USER=0 -e PHPFPM_GROUP=0 -e TYPO3_PATH_ROOT=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance -v ${CORE_ROOT} :${CORE_ROOT} ${IMAGE_PHP} php-fpm -R ${PHP_FPM_OPTIONS} > /dev/null
497+ ${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web -v ${CORE_ROOT} :${CORE_ROOT} ${APACHE_OPTIONS} ${IMAGE_APACHE} > /dev/null
498+ else
499+ # @todo Remove fallback when TF7 has been dropped (along with TYPO3 v11 support).
500+ ${CONTAINER_BIN} run --rm ${CI_PARAMS} -d --name ac-web-${SUFFIX} --network ${NETWORK} --network-alias web -v ${CORE_ROOT} :${CORE_ROOT} ${XDEBUG_MODE} -e XDEBUG_CONFIG=" ${XDEBUG_CONFIG} " -e typo3TestingAcceptanceBaseUrl=http://web:8000/ -e TYPO3_PATH_ROOT=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance -e TYPO3_PATH_APP=${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance ${IMAGE_PHP} php -S web:8000 -t ${CORE_ROOT} /.Build/Web/typo3temp/var/tests/acceptance > /dev/null
501+ fi
502+ fi
503+ if [[ " ${USE_APACHE} " -eq 1 ]]; then
504+ waitFor web 80
505+ else
506+ waitFor web 8000
507+ fi
508+ PLAYWRIGHT_BASE_URL=" http://$( ${CONTAINER_BIN} port ac-web-${SUFFIX} 80/tcp) /"
509+ echo
510+ echo -en " \033[32m✓\033[0m "
511+ echo " Environment prepared. You can now press Enter to run all tests or run playwright locally with one of the following commands."
512+ echo
513+ echo " Run with local playwright (headless):"
514+ echo -n " "
515+ echo " PLAYWRIGHT_BASE_URL=${PLAYWRIGHT_BASE_URL} typo3 ${COMMAND} "
516+ echo
517+ echo " Open local playwright UI:"
518+ echo -n " "
519+ echo " PLAYWRIGHT_BASE_URL=${PLAYWRIGHT_BASE_URL} typo3 ${COMMAND_UI} "
520+ echo
521+ echo -e " (Press \033[31mControl-C\033[0m to quit, \033[32mEnter\033[0m to run tests in container)"
522+ # maybe use https://stackoverflow.com/a/58508884/4223467
523+ while read -r _; do
524+ ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name accessibility-${SUFFIX} -e CHROME_SANDBOX=false -e CI=1 ${IMAGE_PLAYWRIGHT} ${COMMAND}
525+ SUITE_EXIT_CODE=$?
526+ echo
527+ echo -e " (Press \033[31mControl-C\033[0m to quit, \033[32mEnter\033[0m to re-run tests in container)"
528+ done < /dev/tty
529+ }
530+
474531# Suite execution
475532case ${TEST_SUITE} in
476533 acceptance)
@@ -676,6 +733,19 @@ case ${TEST_SUITE} in
676733 echo " ${HELP} "
677734 exit 0
678735 ;;
736+ e2e)
737+ PLAYWRIGHT_PROJECT=" --project e2e"
738+ PLAYWRIGHT_PREPARE_ONLY=0
739+ # echo "${CONTAINER_BIN}";
740+ runPlaywright
741+ # echo "foo";
742+ # ls .Build/;
743+ ;;
744+ e2e-prepare)
745+ PLAYWRIGHT_PROJECT=" --project e2e"
746+ PLAYWRIGHT_PREPARE_ONLY=1
747+ runPlaywright
748+ ;;
679749 lint)
680750 COMMAND=' php -v | grep ' ^PHP' ; find . -name \\*.php ! -path "./.Build/\\*" -print0 | xargs -0 -n1 -P4 php -dxdebug.mode=off -l >/dev/null'
681751 ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-php-${SUFFIX} ${IMAGE_PHP} bash -c " ${COMMAND} "
0 commit comments