forked from enviPath/enviPy
I added playwright for frontend testing and got a couple simple test cases working. I have updated pyproject.toml but it can also be installed with `pip install pytest-playwright` followed by `playwright install` With the django server running you can do `playwright codegen http://localhost:8000/` which will generate test code based on the actions you take on the webpage it opens. Be sure to change the target to pytest in the code pop up. I will add more test cases but @jebus and @t03i feel free to add more. Especially once we are done with the full front-end redesign. I have put the tests under `tests/frontend/` but I am not sure how to add them to the CI. They give steps for CI integration but maybe we want to somehow include them in our exisiting CI yaml? https://playwright.dev/python/docs/ci-intro Reviewed-on: enviPath/enviPy#218 Reviewed-by: Tobias O <tobias.olenyi@envipath.com> Co-authored-by: Liam Brydon <lbry121@aucklanduni.ac.nz> Co-committed-by: Liam Brydon <lbry121@aucklanduni.ac.nz>
This commit is contained in:
@ -45,6 +45,8 @@ dev = [
|
||||
"poethepoet>=0.37.0",
|
||||
"pre-commit>=4.3.0",
|
||||
"ruff>=0.13.3",
|
||||
"pytest-playwright>=0.7.1",
|
||||
"pytest-django>=4.11.1"
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
@ -96,7 +98,7 @@ DJ_PID=$!
|
||||
# Wait for Django to finish
|
||||
wait $DJ_PID
|
||||
""", help = "Start the development server with CSS watcher", deps = ["db-up", "js-deps"] }
|
||||
build = { sequence = ["build-frontend", "collectstatic"], help = "Build frontend assets and collect static files" }
|
||||
build = { sequence = ["build-frontend", "collectstatic", "frontend-test-setup"], help = "Build frontend assets and collect static files" }
|
||||
|
||||
# Database tasks
|
||||
db-up = { cmd = "docker compose -f docker-compose.dev.yml up -d", help = "Start PostgreSQL database using Docker Compose" }
|
||||
@ -127,3 +129,4 @@ shell = { cmd = "uv run python manage.py shell", help = "Open Django shell" }
|
||||
# Build tasks
|
||||
build-frontend = { cmd = "pnpm run build", help = "Build frontend assets using pnpm", deps = ["js-deps"] }
|
||||
collectstatic = { cmd = "uv run python manage.py collectstatic --noinput", help = "Collect static files for production", deps = ["build-frontend"] }
|
||||
frontend-test-setup = {cmd = "playwright install", help = "Install the browsers required for frontend testing"}
|
||||
|
||||
Reference in New Issue
Block a user