Playwright E2E suite (not working yet)

This commit is contained in:
seavor 2026-05-07 09:56:05 -05:00
parent f534cd79b7
commit 68050b56bc
13 changed files with 425 additions and 16 deletions

View file

@ -0,0 +1,41 @@
# Standalone compose used by the webclient e2e harness.
# Paths are relative to THIS file's directory (webclient/e2e/docker/), so the
# file must be invoked with `-f webclient/e2e/docker/docker-compose.e2e.yml`
# from anywhere — Docker Compose resolves relative mounts / build contexts
# against the compose file's own directory.
services:
mysql:
image: mysql:8
command: --sql_mode=
environment:
MYSQL_ROOT_PASSWORD: root-password
MYSQL_DATABASE: servatrice
MYSQL_USER: servatrice
MYSQL_PASSWORD: password
volumes:
- ../../../servatrice/servatrice.sql:/docker-entrypoint-initdb.d/servatrice.sql:ro
- cockatrice_e2e_mysql:/var/lib/mysql
servatrice:
build:
# Build context is the repo root so the Dockerfile can see the full
# C++ source tree (three levels up from this file).
context: ../../..
dockerfile: Dockerfile
image: cockatrice/servatrice:e2e
depends_on:
- mysql
ports:
- "4748:4748"
# Wait for MySQL's TCP port to accept connections before launching
# servatrice. The first-time `up --build` has to load servatrice.sql, which
# takes longer than any fixed sleep — without this wait, servatrice exits
# silently with code 0 when it can't reach the DB. The trailing `sleep 2`
# gives mysqld a moment after the port opens to finish accepting auth.
# global-setup.ts additionally polls the WebSocket port to avoid races.
entrypoint: "/bin/bash -c 'until (echo > /dev/tcp/mysql/3306) 2>/dev/null; do sleep 1; done; sleep 2; servatrice --config /tmp/servatrice.ini --log-to-console'"
volumes:
- ./servatrice-e2e.ini:/tmp/servatrice.ini:ro
volumes:
cockatrice_e2e_mysql:

View file

@ -0,0 +1,54 @@
; Servatrice config used only by the webclient e2e harness.
; Mounted into the servatrice container at /tmp/servatrice.ini by
; docker-compose.e2e.yml. Differs from servatrice-docker.ini by enabling
; registration, skipping email activation, and relaxing per-host rate limits
; so parallel Playwright workers from one machine don't trip them.
[server]
name="Cockatrice E2E"
logfile=server.log
writelog=0
[authentication]
; sql → registration + login hits the real accounts table, so the full
; register-then-login flow is exercised end-to-end.
method=sql
regonly=false
[users]
; Our test usernames are "e2e_" + 6 hex chars = 10 chars. Lower the min so
; that fits with room to spare if we ever shorten the prefix.
minnamelength=4
maxnamelength=12
allowlowercase=true
allowuppercase=true
allownumerics=true
allowedpunctuation=_.-
allowpunctuationprefix=false
disallowedwords="admin"
minpasswordlength=6
[registration]
enabled=true
requireemail=false
requireemailactivation=false
maxaccountsperemail=0
[database]
type=mysql
prefix=cockatrice
hostname=mysql
database=servatrice
user=servatrice
password=password
[security]
trusted_sources="127.0.0.1,::1"
enable_max_user_limit=false
max_users_per_address=0
max_tcp_users_per_address=0
max_websocket_users_per_address=0
[game]
store_replays=false
max_game_inactivity_time=120