|
| 1 | +Feature: Progress History |
| 2 | + As a KOReader user |
| 3 | + I want to query my reading progress at two points in time |
| 4 | + So that I can see how much I read during a session |
| 5 | + |
| 6 | + Background: |
| 7 | + Given a user "reader" with password "readerpass" exists |
| 8 | + |
| 9 | + Scenario: History records are created when progress is synced |
| 10 | + When user "reader" updates progress for document "bookA" |
| 11 | + | progress | /body/p[10] | |
| 12 | + | percentage | 0.10 | |
| 13 | + | device | Kindle | |
| 14 | + | device_id | k-001 | |
| 15 | + Then user "reader" should have history for document "bookA" |
| 16 | + |
| 17 | + Scenario: Query returns progress at two points in time |
| 18 | + Given user "reader" has saved progress for document "book1" |
| 19 | + | progress | /body/p[10] | |
| 20 | + | percentage | 0.10 | |
| 21 | + | device | Kindle | |
| 22 | + | device_id | k-001 | |
| 23 | + And user "reader" updates progress for document "book1" after a delay |
| 24 | + | progress | /body/p[50] | |
| 25 | + | percentage | 0.50 | |
| 26 | + | device | Kindle | |
| 27 | + | device_id | k-001 | |
| 28 | + When user "reader" queries history for document "book1" around those two syncs |
| 29 | + Then at_start should show percentage 0.10 |
| 30 | + And at_end should show percentage 0.50 |
| 31 | + |
| 32 | + Scenario: Returns null fields when no history exists before start timestamp |
| 33 | + Given user "reader" has saved progress for document "book2" |
| 34 | + | progress | /body/p[20] | |
| 35 | + | percentage | 0.20 | |
| 36 | + | device | Kindle | |
| 37 | + | device_id | k-001 | |
| 38 | + When user "reader" queries history for document "book2" with start=0 and end=1 |
| 39 | + Then at_start should have null fields |
| 40 | + And at_end should have null fields |
| 41 | + |
| 42 | + Scenario: No reading detected when queried window has no new syncs |
| 43 | + Given user "reader" has saved progress for document "book3" |
| 44 | + | progress | /body/p[10] | |
| 45 | + | percentage | 0.10 | |
| 46 | + | device | Kindle | |
| 47 | + | device_id | k-001 | |
| 48 | + When user "reader" queries history for document "book3" with a future window |
| 49 | + Then at_start and at_end should have the same timestamp |
| 50 | + |
| 51 | + Scenario: History resolves linked document to canonical hash |
| 52 | + Given user "reader" has saved progress for document "hashA" |
| 53 | + | progress | /body/p[30] | |
| 54 | + | percentage | 0.30 | |
| 55 | + | device | Kindle | |
| 56 | + | device_id | k-001 | |
| 57 | + And user "reader" has linked documents "hashA" and "hashB" |
| 58 | + When user "reader" queries history for document "hashB" up to now |
| 59 | + Then at_end should have a non-null percentage |
| 60 | + |
| 61 | + Scenario: start greater than end returns 400 |
| 62 | + When user "reader" queries history for document "anydoc" with start=2000 and end=1000 |
| 63 | + Then the request should fail with status 400 |
| 64 | + |
| 65 | + Scenario: All-books history endpoint returns records in range |
| 66 | + Given user "reader" has saved progress for document "chartbook" |
| 67 | + | progress | /body/p[10] | |
| 68 | + | percentage | 0.10 | |
| 69 | + | device | Kindle | |
| 70 | + | device_id | k-001 | |
| 71 | + When user "reader" queries all history with start=0 and end=9999999999 |
| 72 | + Then the response should contain a book entry for document "chartbook" |
| 73 | + And that book entry should have at least 1 record |
0 commit comments