dev: Add tasks for e2e tests (#6797)

Co-authored-by: Michael Genson <genson.michael@gmail.com>
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
Patrick Lehner (he/him)
2026-01-31 05:51:40 +09:00
committed by GitHub
parent 79bbc20cd6
commit e9fe71c1b7
3 changed files with 63 additions and 4 deletions

View File

@@ -1,9 +1,10 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.224.2/containers/python-3/.devcontainer/base.Dockerfile
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster # [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
ARG VARIANT="3.12-bullseye" ARG VARIANT="3.12-bullseye"
FROM mcr.microsoft.com/devcontainers/python:${VARIANT} FROM mcr.microsoft.com/devcontainers/python:${VARIANT}
# Remove outdated yarn GPG key, if it exists
RUN rm -f /etc/apt/sources.list.d/yarn.list /usr/share/keyrings/yarn-archive-keyring.gpg || true
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none" ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

View File

@@ -61,6 +61,18 @@ tasks:
- pyproject.toml - pyproject.toml
- .pre-commit-config.yaml - .pre-commit-config.yaml
setup:e2e:
desc: setup e2e test dependencies
dir: tests/e2e
run: once
cmds:
- yarn install
- yarn playwright install --with-deps
sources:
- package.json
- playwright.config.ts
- yarn.lock
setup: setup:
desc: setup all dependencies desc: setup all dependencies
deps: deps:
@@ -263,3 +275,48 @@ tasks:
dir: docker dir: docker
cmds: cmds:
- docker compose -f docker-compose.yml -p mealie up -d --build - docker compose -f docker-compose.yml -p mealie up -d --build
e2e:build-image:
desc: builds the e2e test docker image
deps:
- py:package
cmds:
- docker build --tag mealie:e2e --file docker/Dockerfile --build-context packages=dist .
sources:
- docker/Dockerfile
- dist/**
e2e:start-server:
desc: Builds the image and starts the containers for e2e testing
dir: tests/e2e/docker
deps:
- e2e:build-image
vars:
WAIT_UNTIL_HEALTHY: '{{if .WAIT_UNTIL_HEALTHY}}--wait{{else}}{{end}}'
cmds:
- docker compose up -d {{.WAIT_UNTIL_HEALTHY}}
e2e:stop-server:
desc: Shuts down the e2e testing containers
dir: tests/e2e/docker
cmds:
- docker compose down --volumes
e2e:test:
desc: runs the e2e tests
dir: tests/e2e
deps:
- setup:e2e
vars:
PREVENT_REPORT_OPEN: '{{if .PREVENT_REPORT_OPEN}}PLAYWRIGHT_HTML_OPEN=never{{else}}{{end}}'
cmds:
- '{{.PREVENT_REPORT_OPEN}} yarn playwright test'
e2e:
desc: runs the full e2e test suite
cmds:
- task: e2e:start-server
vars: { WAIT_UNTIL_HEALTHY: true }
- defer: { task: e2e:stop-server }
- task: e2e:test
vars: { PREVENT_REPORT_OPEN: true }

View File

@@ -1,4 +1,3 @@
version: "3.4"
services: services:
oidc-mock-server: oidc-mock-server:
container_name: oidc-mock-server container_name: oidc-mock-server
@@ -14,12 +13,14 @@ services:
- 10389:10389 - 10389:10389
mealie: mealie:
container_name: mealie container_name: mealie-e2e
image: mealie:e2e image: mealie:e2e
build: build:
context: ../../../ context: ../../../
target: production target: production
dockerfile: ./docker/Dockerfile dockerfile: ./docker/Dockerfile
additional_contexts:
packages: ../../../dist
restart: always restart: always
volumes: volumes:
- mealie-data:/app/data/ - mealie-data:/app/data/