Copyable Example Code
You can paste this into the code editor; still verify target image, region, color, text, and timing values in your own device flow.
-- Coklu bolge smoke testi / Multi-region smoke test
-- KV.setAll ile atomik sonuc yazma, basarisizlik raporu
local checks = {
{ name = "logo", region = Region(50, 50, 200, 80), asset = "ana_logo" },
{ name = "baslat_btn", region = Region(400, 800, 280, 100), asset = "baslat_buton" },
{ name = "sayac", region = Region(900, 100, 180, 60), asset = "sayac_arka" },
}
Snap.screenRefresh()
local results = {}
local failures = {}
for _, check in ipairs(checks) do
local found = check.region:find(Asset.image(check.asset))
if found then
results[check.name] = "OK"
else
results[check.name] = "FAIL"
table.insert(failures, check.name)
end
end
-- Atomik yaz — eger setAll fail olursa hicbiri yazilmaz
results["smoke_test_ts"] = DateTime():format("YYYY-MM-DD HH:mm:ss")
results["smoke_test_pass"] = (#failures == 0) and "true" or "false"
KV.setAll(results)
if #failures == 0 then
toast("Smoke test PASS — tum bolgeler OK")
System.vibrate(50)
else
local msg = "Smoke test FAIL: " .. table.concat(failures, ", ")
toast(msg)
System.noti("Smoke test basarisiz", msg)
end