Scheduled-result notifications: first lines, a lock-screen version, Open / Run again
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
From the push's `notification` (server fd0a386): the task's name and the result's first lines
in BigTextStyle for an unlocked phone, setPublicVersion with the task's name and Finished /
Failed for the lock screen, and the actions with the server's labels in the owner's language.
Run again calls POST /schedules/{id}/run and needs the phone unlocked
(setAuthenticationRequired); Pause stays as it was. An older server's payload (no
`notification`) keeps the app's fixed sentences. ScheduleContractTest reads
push_schedule.json and push_schedule_failed.json.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
15 files changed
+119
-26
No files matched your search
@@ -209,6 +209,35 @@ class ScheduleContractTest {
|
||||
assertTrue(notice.id != notice.copy(runId = "run3").id)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theServersNotificationWordsAndRunAgain() {
|
||||
// `push_schedule.json`: the task's name and first lines unlocked, Finished on the lock
|
||||
// screen, Open and Run again with the owner's labels.
|
||||
val done = ScheduledNotice.from(read("push_schedule", PushPayload.serializer()))!!
|
||||
assertEquals("Waybread check", done.title)
|
||||
assertEquals("All the waybread is wrapped.", done.body)
|
||||
assertEquals("Waybread check", done.publicTitle)
|
||||
assertEquals("Finished", done.publicBody)
|
||||
assertTrue(done.open)
|
||||
assertTrue(done.runAgain)
|
||||
assertFalse(done.pause)
|
||||
assertEquals("Run again", done.label("run_again", "x"))
|
||||
assertEquals("x", done.label("pause", "x"))
|
||||
|
||||
// `push_schedule_failed.json`: three failures ask about Pause, beside Open and Run again.
|
||||
val failed = ScheduledNotice.from(read("push_schedule_failed", PushPayload.serializer()))!!
|
||||
assertTrue(failed.failed)
|
||||
assertTrue(failed.askPause)
|
||||
assertTrue(failed.pause)
|
||||
assertTrue(failed.runAgain)
|
||||
assertEquals("Failed", failed.publicBody)
|
||||
assertEquals("run3", failed.runId)
|
||||
|
||||
// The run's own copy (the schedules frame) says the same.
|
||||
val run = read("schedule_run", RunResult.serializer()).run
|
||||
assertEquals(listOf("open", "run_again"), run.notification!!.actions)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aPushWithOnlyItsUrlAndOneThatIsNotScheduled() {
|
||||
val bare = PushPayload(kind = "schedule", url = "/scheduled/sched1?run=run1")
|
||||
|
||||
Reference in new issue
Block a user