34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""PWA static endpoints: /app shell, /sw.js, /manifest.webmanifest, /icon.svg."""
|
|
from __future__ import annotations
|
|
|
|
|
|
def test_sw_js_served(client):
|
|
r = client.get("/sw.js")
|
|
assert r.status_code == 200
|
|
assert "text/javascript" in r.headers["content-type"]
|
|
assert r.headers["cache-control"] == "no-cache"
|
|
assert "dsh-shell-v1" in r.text and "dsh-api-v1" in r.text
|
|
|
|
|
|
def test_manifest_served(client):
|
|
r = client.get("/manifest.webmanifest")
|
|
assert r.status_code == 200
|
|
assert "manifest+json" in r.headers["content-type"]
|
|
assert r.json()["start_url"] == "/app"
|
|
assert r.json()["icons"][0]["src"] == "/icon.svg"
|
|
|
|
|
|
def test_icon_served(client):
|
|
r = client.get("/icon.svg")
|
|
assert r.status_code == 200
|
|
assert "image/svg+xml" in r.headers["content-type"]
|
|
|
|
|
|
def test_app_shell_references_pwa_assets(client):
|
|
r = client.get("/app")
|
|
assert r.status_code == 200
|
|
body = r.text
|
|
assert "/manifest.webmanifest" in body
|
|
assert "serviceWorker" in body
|
|
assert "connect-card" in body # scan-to-connect card present in settings tab
|