diff --git a/Makefile b/Makefile index 312803a8..8401f1bb 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ install: ## Install the dependencies .PHONY: develop develop: ## Install the test and dev dependencies python3 -m pip install -e .[test,dev] + playwright install .PHONY: pretty-templates pretty-templates: ## Prettify template files @@ -45,9 +46,12 @@ publish: ## Publish the Python package to Pypi @hatch publish make clean - test: py.test -xv umap/tests/ + +test-integration: + DJANGO_ALLOW_ASYNC_UNSAFE=1 py.test -xv umap/tests/integration/ + clean: rm -f dist/* rm -rf build/* diff --git a/pyproject.toml b/pyproject.toml index 69e9f7cb..e0191f43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,8 +52,11 @@ dev = [ ] test = [ "factory-boy==3.2.1", + "playwright==1.32.1", "pytest==6.2.5", "pytest-django==4.5.2", + "pytest-playwright==0.3.3", + ] docker = [ "uwsgi==2.0.21", diff --git a/umap/tests/integration/__init__.py b/umap/tests/integration/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/umap/tests/integration/test_basics.py b/umap/tests/integration/test_basics.py new file mode 100644 index 00000000..4bb545ee --- /dev/null +++ b/umap/tests/integration/test_basics.py @@ -0,0 +1,18 @@ +import pytest +from playwright.sync_api import expect + + +def test_page_title(page, live_server): + page.goto(live_server.url) + expect(page).to_have_title("uMap") + + +@pytest.mark.parametrize( + "lang,link_name,link_url", + [("fr", "Créer une carte", "/fr/map/new/"), ("en", "Create a map", "/en/map/new/")], +) +def test_create_map_link(page, live_server, lang, link_name, link_url): + page.goto(f"{live_server.url}/{lang}/") + create_map_button = page.locator("header nav a.button") + expect(create_map_button).to_have_text(link_name) + expect(create_map_button).to_have_attribute("href", link_url)