/playwright-django-tests

E2E testing with Playwright and Django

Primary LanguagePython

Playwright + Django tests

Sample repository for testing the usage of Playwright in a Django project.

Setup

poetry env use 3.11
poetry install

Loading fixtures

poetry run \
    python manage.py loaddata ingredients pizzas

Exporting fixtures

poetry run \
    python manage.py dumpdata pizza.Ingredient \
        -o pizza/fixtures/ingredients.json.gz
poetry run \
    python manage.py dumpdata pizza.Pizza \
        -o pizza/fixtures/pizzas.json.gz

Running Django instance

poetry run \
    python manage.py runserver

Running tests

poetry run \
    python manage.py test

Generating test code with Playwright

Launch a local Django instance, then from another shell run

playwright codegen http://localhost:8000/admin