Libreria: nessuno stato vuoto finché non si sa se Febe è collegato

Con la libreria vuota e lo stato del motore ancora sconosciuto, lo stato vuoto sceglieva
«La libreria è ancora vuota». Al primo avvio, con /api/engine più lento di
/api/library/days, quel testo era falso e poi lasciava il posto al benvenuto con un salto
della pagina (rilievo R2 della revisione).

Ora, senza filtri e senza lo stato del motore, la Libreria resta bianca come il mosaico
mentre carica: un riquadro vuoto con aria-busy, che il primo stato del motore sostituisce
con il benvenuto o con «La libreria è ancora vuota». La barra laterale dice già
«Caricamento…» in quell'attesa, e il motore arriva comunque: il flusso lo manda appena si
apre e, senza flusso, l'interfaccia lo richiede a intervalli. Benvenuto e libreria vuota
non cambiano.

La prova TheEmptyLibraryFollowsTheConnectionAlsoWhenTheEngineAnswersLate, con il motore
trattenuto, ora aspetta quel riquadro e controlla che il conteggio dica 0 e che non ci
siano né stato vuoto né mosaico; sul codice di prima fallisce («timeout: libreria vuota in
attesa del motore»).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-20 21:00:07 +02:00
1 parent 3719adc2d9
commit 0a6dd19595
3 files changed
+15 -8

No files matched your search

+6 -3
View File
@@ -390,13 +390,16 @@ public sealed class InterfaceTests
await ui.AddInitScriptAsync(HoldEngine);
await ui.OpenAsync(new Uri(server.Address, "/libreria"));
// The library answered first: nothing says yet whether Febe is connected.
await ui.WaitAsync("document.querySelector('main .vuoto-pagina') !== null", "libreria vuota prima del motore");
// The library answered first (empty: its count and its empty state come together) and nothing says yet whether
// Febe is connected: the page waits blank, neither the empty library nor the welcome, and not the mosaic.
await ui.WaitAsync("document.querySelector('main [aria-busy=true]') !== null", "libreria vuota in attesa del motore");
Assert.IsTrue((await ui.EvalAsync("import('/js/core/engine.js').then((m) => m.engineState() === null)")).GetBoolean(), "the engine has not answered yet");
Assert.IsTrue((await ui.EvalAsync("document.querySelector('main .vuoto-pagina, main .benvenuto, main .mosaico') === null")).GetBoolean(), "no empty state is guessed " + ui.Report());
StringAssert.StartsWith((await ui.EvalAsync("document.querySelector('.testa .quanti').textContent")).GetString(), "0 ");
// Not connected (no own account): the first start with its two ways to begin (spec §10.3).
await ui.EvalAsync("window.__releaseEngine()");
await ui.WaitAsync("document.querySelector('main .benvenuto') !== null && document.querySelector('main .vuoto-pagina') === null", "primo avvio dopo la risposta del motore");
await ui.WaitAsync("document.querySelector('main .benvenuto') !== null && document.querySelector('main [aria-busy=true]') === null", "primo avvio dopo la risposta del motore");
// Connected now (the own account is known): the welcome gives way to the empty library.
await server.Db.Accounts.AddAsync(Make.Account("tuo.profilo", mine: true));