Read a Phenom role's description from the page state when the page has no JobPosting, and fail a page with neither

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet 5.5 committed 2026-09-29 20:10:52 +02:00
1 parent 8f0db38393
commit cf182ad921
3 files changed
+77 -17

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html lang="en"><head>
<title>Principal Economy Designer | New Games in Barcelona, Spain | Games Design & Production at King</title>
<script type="application/ld+json">{"@context": "https://schema.org","@type": "WebPage","inLanguage": "en_us","name": "job","url": "https://careers.king.com/us/en/job/R028168/Principal-Economy-Designer-New-Games","datePublished": "2024-08-14","dateModified": "2024-08-14"}</script>
<script>phApp.ddo = {"jobDetail": {"status": "success", "data": {"job": {"title": "Principal Economy Designer | New Games", "jobSeqNo": "ACMKDSUSR028168EXTERNALENUS", "jobId": "R028168", "postedDate": "2026-09-29T00:00:00.000+0000", "dateCreated": "2026-09-29T09:59:51.253+0000", "location": "Barcelona, Spain", "category": "Games Design & Production", "checkRemote": "On-site", "timeType": "Full time", "description": "<p style=\"text-align:left\"><b>Craft:</b></p>Games Design &amp; Production<p style=\"text-align:inherit\"></p><p style=\"text-align:left\"><b>Job Description:</b></p><div><p><b><span>Principal Economy and System Designer</span></b><span> </span></p></div><div><p><b><span>Unannounced Merge 2 Game</span></b><span> </span></p><p></p></div><div><p><span><span>Join our team and help shape an unannounced Merge 2 game from the ground up. We are looking for a Principal Economy and System Designer who can turn a compelling merge fantasy into a clear, generous, and sustainable player journey. You will own the economic and systemic foundations that connect core merging, progression, events, </span><span>monetisation</span><span>, and long-term engagement.</span></span><span> </span></p><p></p></div><div><p><span><span>This is a senior, hands-on design role for someone with proven </span><span>economy</span><span> design experience in successful merge games. You will partner with creative leadership and a multidisciplinary team to build an economy that feels intuitive to players, performs against product goals, and can evolve confidently through development and live operation.</span></span><span> </span></p><p></p></div><div><h2><b><span>Your role within the Kingdom</span></b></h2></div><div><p><span><span>You will be the principal owner and champion of economy design for the game, </span><span>setting</span><span> a high bar for systemic clarity, player value, and commercial sustainability. Specifically, you will:</span></span><span> </span></p></div><div><ul><li><p><span><span>Own the design, modelling, balancing, and ongoing health of the game economy across the full player lifecycle, from first-session experience through long-term progression and live events.</span></span><span> </span></p></li></ul></div><div><ul><li><p><span><span>Define the Merge 2 economy: merge chains, generators, energy and action loops, currencies, rewards, inventories, orders, unlocks, progression gates, and the relationships between them.</span></span><span> </span></p></li></ul></div><div><ul><li><p><span><span>Design progression systems and content pacing that create clear short-, mid-, and long-term goals while preserving meaningful player choice and satisfying merge moments.</span></span><span> </span></p></li></ul></div><div><ul><li><p><span><span>Build and </span><span>maintain</span><span> economy models, simulations, and tools that forecast progression, currency flows, resource ..."}}}}; phApp.sessionParams = {"pxSegmentState":"stranger"};</script>
</head><body></body></html>
+25 -3
View File
@@ -198,11 +198,33 @@ def test_detail_finds_the_job_posting_among_other_blocks_and_takes_its_date() ->
assert got["posted"].isoformat() == "2026-09-08T00:00:00+00:00"
def test_detail_of_a_page_without_a_posting_has_nothing_to_read() -> None:
def test_detail_falls_back_to_the_page_state_where_there_is_no_job_posting() -> None:
"""King's pages of roles posted that day had no `JobPosting` block, only a
`WebPage` one, and the role in the state the page assigns to `phApp.ddo`."""
row = _rows()[0]
got = phenom.detail(_get_of("phenom-detail-3.html", []), SLUG, row)
assert got["description"].startswith("Craft: Games Design & Production Job Description:")
assert "<" not in got["description"] and "&amp;" not in got["description"]
assert got["remote"] == "onsite"
assert "posted" not in got and set(got) <= set(ats.DETAIL_FIELDS)
def test_detail_of_a_page_with_no_description_fails_so_that_it_is_asked_again() -> None:
def get(url: str, **kwargs: Any) -> bytes:
return (b'<html><script type="application/ld+json">{"@type": "BreadcrumbList"}</script>'
b'<script type="application/ld+json">{broken</script></html>')
assert phenom.detail(get, SLUG, {"url": "https://careers.king.com/us/en/job/1"}) == {}
b'<script type="application/ld+json">{broken</script>'
b'<script>phApp.ddo = {"jobDetail": {"data": {"job": {"title": "x"}}}};</script></html>')
with pytest.raises(ValueError, match="no description"):
phenom.detail(get, SLUG, {"url": "https://careers.king.com/us/en/job/1"})
@pytest.mark.parametrize("state", ["", "phApp.ddo = {broken", 'phApp.ddo = {"jobDetail": []};',
'phApp.ddo = {"siteConfig": {}};'])
def test_a_page_state_that_is_not_a_role_is_no_description(state: str) -> None:
def get(url: str, **kwargs: Any) -> bytes:
return f"<html><script>{state}</script></html>".encode()
with pytest.raises(ValueError, match="no description"):
phenom.detail(get, SLUG, {"url": "https://careers.king.com/us/en/job/1"})
# ----------------------------------------------------------- slug and URLs