phase 5
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# Parity harness for the uce-starter example app.
|
||||
#
|
||||
# WASM-PROPOSAL Phase 3/5 exit criterion: `run_network_tests.py --match starter`
|
||||
# must pass against the wasm worker backend. These cases are written against
|
||||
# the native backend first so the bar exists — and is green — before the wasm
|
||||
# worker does. Keep assertions backend-agnostic (rendered content only), so
|
||||
# the same cases gate both backends unchanged.
|
||||
|
||||
ERROR_MARKERS = [
|
||||
"uce compile error",
|
||||
"fatal signal during request",
|
||||
"uncaught exception during request",
|
||||
]
|
||||
|
||||
BASE = "/examples/uce-starter/index.uce"
|
||||
|
||||
# (case name suffix, query-string route, expected <title>)
|
||||
VIEWS = [
|
||||
("landing", "", "Home | UCE Starter"),
|
||||
("dashboard", "?dashboard", "Dashboard | UCE Starter"),
|
||||
("gauges", "?gauges", "Gauges | UCE Starter"),
|
||||
("features", "?features", "Features | UCE Starter"),
|
||||
("components", "?page1", "Components | UCE Starter"),
|
||||
("workspace", "?workspace", "Workspace | UCE Starter"),
|
||||
]
|
||||
|
||||
|
||||
def _check_body(body, title):
|
||||
body_lower = body.lower()
|
||||
for marker in ERROR_MARKERS:
|
||||
if marker in body_lower:
|
||||
raise Exception("response body contained error marker %r" % marker)
|
||||
needle = "<title>%s</title>" % title
|
||||
if needle not in body:
|
||||
raise Exception("expected %r in response body" % needle)
|
||||
|
||||
|
||||
def _make_view_case(name, query, title):
|
||||
def run(context):
|
||||
response = context.expect_status(BASE + query, 200)
|
||||
_check_body(response.text, title)
|
||||
return "rendered %s with expected title and no error markers" % name
|
||||
|
||||
return run
|
||||
|
||||
|
||||
def _unknown_route_case(context):
|
||||
# the starter app must render its own 404 view through the app shell,
|
||||
# not fall through to a bare server error
|
||||
response = context.expect_status(BASE + "?does-not-exist", 404)
|
||||
_check_body(response.text, "404 Not Found | UCE Starter")
|
||||
return "starter app rendered its own 404 page"
|
||||
|
||||
|
||||
def register(registry):
|
||||
for name, query, title in VIEWS:
|
||||
registry.case(
|
||||
"starter view " + name,
|
||||
_make_view_case(name, query, title),
|
||||
tags=["http", "uce", "starter", "parity"],
|
||||
)
|
||||
registry.case(
|
||||
"starter unknown route 404",
|
||||
_unknown_route_case,
|
||||
tags=["http", "uce", "starter", "parity"],
|
||||
)
|
||||
Reference in New Issue
Block a user