feat: upload audio, get a private Swedish transcript, discuss it (#33, ADR-033) #39
@@ -229,16 +229,25 @@ func TestUploadProgress_ADoneJobKeepsItsRecordOfWhatWasDoneAndHowLongEachTook(t
|
|||||||
assert.NotContains(t, b, "spinner")
|
assert.NotContains(t, b, "spinner")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUploadProgress_TheFullPageRendersTheSameDisplayAsTheFragment(t *testing.T) {
|
// stepsBlock is the progress list of a page: from its opening tag to its closing one.
|
||||||
|
func stepsBlock(t *testing.T, html string) string {
|
||||||
|
t.Helper()
|
||||||
|
start := strings.Index(html, `<ol class="steps"`)
|
||||||
|
require.GreaterOrEqual(t, start, 0, "no progress list in:\n%s", html)
|
||||||
|
end := strings.Index(html[start:], "</ol>")
|
||||||
|
require.GreaterOrEqual(t, end, 0)
|
||||||
|
return html[start : start+end+len("</ol>")]
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUploadProgress_TheFullPageCarriesTheVerySameProgressListAsTheFragment(t *testing.T) {
|
||||||
app, _ := newUploadApp(t, audioOK, 200<<20)
|
app, _ := newUploadApp(t, audioOK, 200<<20)
|
||||||
fixedClock(app)
|
fixedClock(app)
|
||||||
id := seedUpload(t, userID, "m", "transcribing", "")
|
id := seedUpload(t, userID, "m", "transcribing", "")
|
||||||
seedProgress(t, id, twoEngineRun(), progressNow.Add(-10*time.Second), progressNow.Add(-4*time.Second))
|
seedProgress(t, id, twoEngineRun(), progressNow.Add(-10*time.Second), progressNow.Add(-4*time.Second))
|
||||||
|
|
||||||
rec := do(t, app, get("/uploads/"+id))
|
full := body(t, do(t, app, get("/uploads/"+id)))
|
||||||
|
fragment := statusBody(t, app, id)
|
||||||
|
|
||||||
require.Equal(t, 200, rec.Code)
|
assert.Equal(t, stepsBlock(t, fragment), stepsBlock(t, full),
|
||||||
b := body(t, rec)
|
"the page a user opens and the fragment HTMX swaps in must show the same list, or the display jumps on the first poll")
|
||||||
assert.Contains(t, b, "Transcribing with iguana/kb-whisper", "the page a user opens, not only the polled fragment, shows the phases")
|
|
||||||
assert.Contains(t, b, "3m 12s")
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user