diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0ceef41d8..495962d0a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,6 +39,9 @@ jobs: run: | python -m pip install --upgrade pip setuptools python -m pip install -r requirements/tests.txt + - name: Install playwright browsers + run: | + python -m playwright install --with-deps - name: Set up databases run: | PGPASSWORD="postgres" createuser -U postgres -d djangoproject --superuser -h localhost diff --git a/Dockerfile b/Dockerfile index 2018de0a6..21a3c6a07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,10 @@ COPY ./requirements ./requirements RUN apt-get update \ && apt-get install --assume-yes --no-install-recommends ${BUILD_DEPENDENCIES} \ && python3 -m pip install --no-cache-dir -r ${REQ_FILE} \ + && if [ "${REQ_FILE}" = "requirements/tests.txt" ]; then \ + echo "Installing Playwright browsers..."; \ + playwright install --with-deps; \ + fi \ && apt-get purge --assume-yes --auto-remove ${BUILD_DEPENDENCIES} \ && apt-get distclean diff --git a/Makefile b/Makefile index 910ce300e..264d28e86 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ APP_LIST ?= accounts aggregator blog contact dashboard djangoproject docs founda SCSS = djangoproject/scss STATIC = djangoproject/static -ci: compilemessages test +ci: compilemessages collectstatics test @python -m coverage report compilemessages: diff --git a/djangoproject/tests.py b/djangoproject/tests.py index 2c6743211..a61cf86e3 100644 --- a/djangoproject/tests.py +++ b/djangoproject/tests.py @@ -1,12 +1,15 @@ +import os from http import HTTPStatus from io import StringIO from django.conf import settings +from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.core.management import call_command from django.test import TestCase from django.urls import NoReverseMatch, get_resolver from django.utils.translation import activate, gettext as _ from django_hosts.resolvers import reverse +from playwright.sync_api import expect, sync_playwright from docs.models import DocumentRelease, Release @@ -211,3 +214,52 @@ def test_single_h1_per_page(self): response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertContains(response, "=3.0.0