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.
-- Multi-region smoke test
-- KV.setAll validates every value first, then saves them together
local checks = {
{ name = "logo", region = Region(50, 50, 200, 80), asset = "main_logo" },
{ name = "start_button", region = Region(400, 800, 280, 100), asset = "start_button" },
{ name = "counter", region = Region(900, 100, 180, 60), asset = "counter_background" },
}
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
results["smoke_test_ts"] = DateTime.now():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: every region OK")
System.vibrate(50)
else
local message = "Smoke test FAIL: " .. table.concat(failures, ", ")
toast(message)
System.noti(message)
end