t1196-t1198 playwright: separate live screenshots
@@ -5,7 +5,7 @@ from playwright.sync_api import sync_playwright
5
5
6
6
URL = sys.argv[1].rstrip("/") + "/"
7
7
LOCAL = len(sys.argv) > 2 and sys.argv[2] == "local"
8
SHOTS = "/workspace/meteors-shots/t1196-"
8
SHOTS = "/workspace/meteors-shots/t1196-" + ("" if LOCAL else "live-")
9
9
fails = []
10
10
def check(ok, msg):
11
11
print(("OK " if ok else "FAIL ") + msg)
@@ -57,9 +57,9 @@ with sync_playwright() as p:
57
57
check(res["out"] == [0, 5, 10], f"combo bonus per match {res['out']} (combo {res['combo']})")
58
58
check(txt == "+10%", f"indicator text {txt!r}")
59
59
check("255, 230, 0" in style[0] and "255, 122, 0" in style[1], f"yellow fill, orange stroke {style}")
60
page.screenshot(path=SHOTS.replace("t1196", "t1197") + "plus-pct.png")
60
page.screenshot(path=SHOTS.replace("t1196-", "t1197-") + "plus-pct.png")
61
61
el = page.locator("#chain-indicator")
62
if el.is_visible(): el.screenshot(path=SHOTS.replace("t1196", "t1197") + "plus-pct-crop.png")
62
if el.is_visible(): el.screenshot(path=SHOTS.replace("t1196-", "t1197-") + "plus-pct-crop.png")
63
63
page.evaluate("() => { for (let i = 0; i < 120; i++) app.core.tick(0.05); }")
64
64
check(page.evaluate("() => app.core.combo") == 0, "combo reset after 6 s without a match")
65
65
page.evaluate("() => teardownPlay && teardownPlay()") if False else None
@@ -78,13 +78,13 @@ with sync_playwright() as p:
78
78
page.wait_for_selector("#offline-result:not([hidden])", timeout=15000)
79
79
reached = page.inner_text("#offline-reached-line"); detail = page.inner_text("#offline-result-detail")
80
80
check(detail.strip() == "2 opponents defeated", f"en result: {reached!r} / {detail!r}")
81
page.screenshot(path=SHOTS.replace("t1196", "t1198") + "result-en.png")
81
page.screenshot(path=SHOTS.replace("t1196-", "t1198-") + "result-en.png")
82
82
page.evaluate("() => I18n.setLocale('nl'); ") if True else None
83
83
page.evaluate("() => { if (typeof showOfflineResult === 'function') { app.offlineResultShown = false; showOfflineResult(); } }")
84
84
page.wait_for_timeout(200)
85
85
detail_nl = page.inner_text("#offline-result-detail"); reached_nl = page.inner_text("#offline-reached-line")
86
86
check(detail_nl.strip() == "2 tegenstanders verslagen" and "bereikt" in reached_nl, f"nl result: {reached_nl!r} / {detail_nl!r}")
87
page.screenshot(path=SHOTS.replace("t1196", "t1198") + "result-nl.png")
87
page.screenshot(path=SHOTS.replace("t1196-", "t1198-") + "result-nl.png")
88
88
ctx.close()
89
89
90
90
# ---- logged in: server profile (local test login only)
@@ -5,7 +5,7 @@ from playwright.sync_api import sync_playwright5
5
6
URL = sys.argv[1].rstrip("/") + "/"6
URL = sys.argv[1].rstrip("/") + "/"7
LOCAL = len(sys.argv) > 2 and sys.argv[2] == "local"7
LOCAL = len(sys.argv) > 2 and sys.argv[2] == "local"8
SHOTS = "/workspace/meteors-shots/t1196-"8
SHOTS = "/workspace/meteors-shots/t1196-" + ("" if LOCAL else "live-")9
fails = []9
fails = []10
def check(ok, msg):10
def check(ok, msg):11
print(("OK " if ok else "FAIL ") + msg)11
print(("OK " if ok else "FAIL ") + msg)@@ -57,9 +57,9 @@ with sync_playwright() as p:57
check(res["out"] == [0, 5, 10], f"combo bonus per match {res['out']} (combo {res['combo']})")57
check(res["out"] == [0, 5, 10], f"combo bonus per match {res['out']} (combo {res['combo']})")58
check(txt == "+10%", f"indicator text {txt!r}")58
check(txt == "+10%", f"indicator text {txt!r}")59
check("255, 230, 0" in style[0] and "255, 122, 0" in style[1], f"yellow fill, orange stroke {style}")59
check("255, 230, 0" in style[0] and "255, 122, 0" in style[1], f"yellow fill, orange stroke {style}")60
page.screenshot(path=SHOTS.replace("t1196", "t1197") + "plus-pct.png")60
page.screenshot(path=SHOTS.replace("t1196-", "t1197-") + "plus-pct.png")61
el = page.locator("#chain-indicator")61
el = page.locator("#chain-indicator")62
if el.is_visible(): el.screenshot(path=SHOTS.replace("t1196", "t1197") + "plus-pct-crop.png")62
if el.is_visible(): el.screenshot(path=SHOTS.replace("t1196-", "t1197-") + "plus-pct-crop.png")63
page.evaluate("() => { for (let i = 0; i < 120; i++) app.core.tick(0.05); }")63
page.evaluate("() => { for (let i = 0; i < 120; i++) app.core.tick(0.05); }")64
check(page.evaluate("() => app.core.combo") == 0, "combo reset after 6 s without a match")64
check(page.evaluate("() => app.core.combo") == 0, "combo reset after 6 s without a match")65
page.evaluate("() => teardownPlay && teardownPlay()") if False else None65
page.evaluate("() => teardownPlay && teardownPlay()") if False else None@@ -78,13 +78,13 @@ with sync_playwright() as p:78
page.wait_for_selector("#offline-result:not([hidden])", timeout=15000)78
page.wait_for_selector("#offline-result:not([hidden])", timeout=15000)79
reached = page.inner_text("#offline-reached-line"); detail = page.inner_text("#offline-result-detail")79
reached = page.inner_text("#offline-reached-line"); detail = page.inner_text("#offline-result-detail")80
check(detail.strip() == "2 opponents defeated", f"en result: {reached!r} / {detail!r}")80
check(detail.strip() == "2 opponents defeated", f"en result: {reached!r} / {detail!r}")81
page.screenshot(path=SHOTS.replace("t1196", "t1198") + "result-en.png")81
page.screenshot(path=SHOTS.replace("t1196-", "t1198-") + "result-en.png")82
page.evaluate("() => I18n.setLocale('nl'); ") if True else None82
page.evaluate("() => I18n.setLocale('nl'); ") if True else None83
page.evaluate("() => { if (typeof showOfflineResult === 'function') { app.offlineResultShown = false; showOfflineResult(); } }")83
page.evaluate("() => { if (typeof showOfflineResult === 'function') { app.offlineResultShown = false; showOfflineResult(); } }")84
page.wait_for_timeout(200)84
page.wait_for_timeout(200)85
detail_nl = page.inner_text("#offline-result-detail"); reached_nl = page.inner_text("#offline-reached-line")85
detail_nl = page.inner_text("#offline-result-detail"); reached_nl = page.inner_text("#offline-reached-line")86
check(detail_nl.strip() == "2 tegenstanders verslagen" and "bereikt" in reached_nl, f"nl result: {reached_nl!r} / {detail_nl!r}")86
check(detail_nl.strip() == "2 tegenstanders verslagen" and "bereikt" in reached_nl, f"nl result: {reached_nl!r} / {detail_nl!r}")87
page.screenshot(path=SHOTS.replace("t1196", "t1198") + "result-nl.png")87
page.screenshot(path=SHOTS.replace("t1196-", "t1198-") + "result-nl.png")88
ctx.close()88
ctx.close()89
89
90
# ---- logged in: server profile (local test login only)90
# ---- logged in: server profile (local test login only)