Add browser and unit test suite with Pest + Playwright
Add comprehensive test coverage for core site features (content, navigation, language, FAQ, news, petition, newsletter) using Pest browser tests and unit tests for custom plugins. Includes test infrastructure (Containerfile.test, compose.test.yaml), test documentation, and test files covering petition form logic, CSV handling, translation, date formatting, rate limiting, and map data building.
This commit is contained in:
parent
0b61643ec5
commit
b8e6d2537d
20 changed files with 1331 additions and 33 deletions
32
Containerfile.test
Normal file
32
Containerfile.test
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
FROM php:8.4-cli-bookworm
|
||||
|
||||
# System dependencies + PHP sockets extension (required by pest-plugin-browser)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git unzip curl \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& docker-php-ext-install sockets pcntl
|
||||
|
||||
# Node.js 22 LTS (required by pest-plugin-browser / Playwright)
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# WORKDIR matches where composer.json lives — Pest finds vendor/autoload.php here
|
||||
# Tests are mounted at /app/tests via compose.test.yaml
|
||||
WORKDIR /app
|
||||
|
||||
# Install PHP test dependencies
|
||||
COPY tests/composer.json composer.json
|
||||
RUN composer install --no-interaction --no-progress
|
||||
|
||||
# Install Playwright npm package (skip post-install browser download — we do it explicitly below)
|
||||
RUN PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install playwright
|
||||
|
||||
# Install Playwright browsers (Chromium) with OS-level dependencies
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright
|
||||
RUN ./node_modules/.bin/playwright install --with-deps chromium
|
||||
|
||||
ENTRYPOINT ["/app/vendor/bin/pest"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue