Merge pull request 'Libreria e prove: il benvenuto del primo avvio non dipende dai tempi, la prova del pulsante Indietro non passa più per caso' (#6) from correzione/prova-pulsante-indietro into main
This commit was merged in pull request #6.
This commit is contained in:
commit
eb7db4d2bf
4 files changed
+88
-9
No files matched your search
+6
-1
@@ -18,6 +18,8 @@ Correzioni:
|
||||
restava «Storico in corso» per sempre.
|
||||
- Vista remota (Docker): aprirne una mentre un'altra la sostituisce, o mentre la pagina sta cambiando, non dà più «Il
|
||||
browser di Febe non risponde».
|
||||
- Libreria: al primo avvio poteva restare su «La libreria è ancora vuota» invece del benvenuto con «Collegati a
|
||||
Instagram», se lo stato del motore arrivava dopo quello della libreria. Ora aspetta di sapere se Febe è collegato.
|
||||
|
||||
Sviluppo e qualità:
|
||||
|
||||
@@ -30,7 +32,10 @@ Sviluppo e qualità:
|
||||
Dopo ogni unione in `main` l'immagine esce come `:main` e `:sha-<commit>`. Ogni esecuzione toglie ciò che ha creato,
|
||||
e c'è una pulizia settimanale.
|
||||
- **Sviluppo da VS Code**: attività e configurazioni di debug in `.vscode/` (guida, «Sviluppo» ▸ «Da VS Code»).
|
||||
- Prove: `tests/Febe.Tests` verdi anche su Windows, e prove nuove con WebView2 vero in `tests/Febe.Tests.Windows`.
|
||||
- Prove: `tests/Febe.Tests` verdi anche su Windows, e prove nuove con WebView2 vero in `tests/Febe.Tests.Windows`. Due
|
||||
prove che la CI ha fatto girare per la prima volta con Chromium vero fallivano a volte, e ora sono stabili: la vista
|
||||
remota durante un cambio di pagina (#3, un difetto del prodotto, corretto) e il pulsante Indietro con modifiche non
|
||||
salvate (#5, la prova passava per caso).
|
||||
- Sito di prova: `/benvenuto`, la pagina di accesso che Febe apre in sviluppo.
|
||||
|
||||
## 0.1.0
|
||||
|
||||
@@ -276,3 +276,6 @@ Ogni scelta tecnica presa strada facendo, con data e motivo (specifica §15).
|
||||
| 2026-10-20 | La dimostrazione da VS Code serve l'interfaccia dai sorgenti (`FEBE_INTERFACCIA`), apre da sola il browser (`serverReadyAction`) e su Windows tiene la cartella temporanea in `%USERPROFILE%\FebeSviluppo\<checkout>\temporanei` (`TEMP`, `TMP`) | Si modifica `wwwroot` e si ricarica senza ricompilare. Fermata dal debugger, la dimostrazione non può cancellare la sua cartella (una trentina di MB): così resta fra i dati di sviluppo invece di accumularsi in `%TEMP%` |
|
||||
| 2026-10-20 | I file di `.vscode/` sono JSON rigido, senza commenti: le spiegazioni stanno nella guida (pagina «Sviluppo», «Da VS Code»), nei campi `detail` delle attività e in queste righe | Il controllo «File JSON» della CI legge ogni `*.json` tracciato con `JSON.parse`, e con i commenti `//` il lavoro «controlli» falliva a ogni push dopo l'unione. VS Code legge anche il JSON rigido, così il ramo non dipende da come la CI tratta i commenti |
|
||||
| 2026-10-20 | `src/Febe.Desktop/Properties/launchSettings.json` con un solo profilo, «Sito di prova»: `--dati` e `--libreria` in `%USERPROFILE%\FebeSviluppo\comune`, `--sito-di-prova http://127.0.0.1:8481 --accesso-di-prova --prima-sessione 30 --sviluppo` | `dotnet run --project src/Febe.Desktop` e i comandi del C# Dev Kit (▷ «Debug project associated with this file», «Start New Instance», «C#: …») avviavano Febe senza opzioni: Instagram vero e dati veri, senza la conferma della configurazione ⚠. `dotnet run` e il Dev Kit leggono quel profilo ed espandono `%USERPROFILE%` (provato); se un altro strumento non lo facesse, Febe rifiuta il percorso non completo e non parte. Una cartella comune perché il file non conosce il checkout. Instagram vero dal terminale: `dotnet run --project src/Febe.Desktop --no-launch-profile` |
|
||||
| 2026-10-20 | Le prove dell'interfaccia aspettano lo stato finale di una pagina, mai uno di passaggio come il mosaico vuoto che la Libreria mette sullo schermo prima della risposta di `/api/library/days` | Issue #5: `TheBackButtonAsksBeforeLosingUnsavedChanges` aspettava `.vuoto-pagina` o `.mosaico`, ma una libreria vuota con Febe non collegato finisce sul benvenuto; la prova passava solo se il primo controllo cadeva nei circa 10 ms in cui c'è il mosaico vuoto (provato con Chrome: con il primo controllo ritardato di 5 ms o più falliva sempre) |
|
||||
| 2026-10-20 | Lo stato vuoto della Libreria senza filtri segue il collegamento finché è sullo schermo: se il motore risponde dopo la libreria, al suo arrivo compare il benvenuto del primo avvio; quando Febe si collega, il benvenuto lascia il posto alla libreria vuota. Si ridisegna solo quando cambia tipo. La prova trattiene `/api/engine` fino a un suo segnale e toglie `EventSource` (l'interfaccia ripiega su `/api/engine`) | Prima la scelta si faceva una volta sola, alla risposta della libreria: con il motore in ritardo il primo avvio mostrava la libreria vuota invece dei due pulsanti di §10.3, e ci restava (provato con Chrome trattenendo `/api/engine`). Un segnale invece di un ritardo: l'ordine delle risposte non dipende dalla velocità della macchina |
|
||||
| 2026-10-20 | Finché lo stato del motore non è noto, la Libreria vuota senza filtri non mostra nessuno stato vuoto: un riquadro vuoto con `aria-busy`, come il mosaico mentre carica, che il primo stato del motore sostituisce con il benvenuto o con «La libreria è ancora vuota». La prova aspetta quel riquadro, il conteggio «0 …» e nessuno stato vuoto | Senza il motore non si sa se è il primo avvio: «La libreria è ancora vuota» mostrata nell'attesa era falsa al primo avvio e poi lasciava il posto al benvenuto con un salto della pagina (rilievo della revisione). Il riquadro della barra laterale dice già «Caricamento…» finché il motore non risponde, e il motore arriva comunque: il flusso `/api/eventi` lo manda appena si apre e, senza flusso, l'interfaccia lo richiede a intervalli |
|
||||
@@ -323,6 +323,32 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// The empty state: no results of a filter, the first start (spec §10.3: not connected, the two ways to begin) or an
|
||||
// empty library. Whether Febe is connected comes with the engine, which may answer after the library: until then
|
||||
// the page stays blank, as the mosaic does while it loads, rather than guess. The empty state follows the engine
|
||||
// while it is on screen, and is drawn again only when it changes kind.
|
||||
let empty = null;
|
||||
function drawEmpty() {
|
||||
const kind = filtersActive() ? 'filtro' : !engineState() ? 'attesa' : notConnected() ? 'benvenuto' : 'vuota';
|
||||
if (empty && empty.kind === kind && empty.node.isConnected) return;
|
||||
let node;
|
||||
if (kind === 'attesa') {
|
||||
node = h('div', { 'aria-busy': 'true' });
|
||||
} else if (kind === 'filtro') {
|
||||
node = h('div.vuoto-pagina', icon('list-filter'), h('h2', t('libreria.nessuno')), h('p', t('libreria.nessunoTesto')),
|
||||
h('button.btn', { type: 'button', onclick: () => { Object.assign(state, readState(new URLSearchParams())); search.value = ''; apply(); } }, t('libreria.togliFiltri')));
|
||||
} else if (kind === 'benvenuto') {
|
||||
node = welcome();
|
||||
} else {
|
||||
node = h('div.vuoto-pagina', icon('image'), h('h2', t('libreria.vuota')), h('p', t('libreria.vuotaTesto')));
|
||||
}
|
||||
fill(host, node);
|
||||
empty = { kind, node };
|
||||
}
|
||||
page.onEngine(() => {
|
||||
if (empty && empty.node.isConnected) drawEmpty();
|
||||
});
|
||||
|
||||
// The mosaic.
|
||||
async function apply() {
|
||||
setQuery({
|
||||
@@ -347,12 +373,7 @@ export default {
|
||||
onOpen: (tile) => openViewer({ tile, source: mosaic, origin: t('libreria.titolo'), onDeleted: (ids) => mosaic.removeTiles(ids) }),
|
||||
onSelection: drawSelection,
|
||||
onTotals: ({ entries, accounts: n }) => page.count(t('libreria.quanti', { elementi: t('comune.elementi', { n: entries }), account: t('comune.account', { n }) })),
|
||||
onEmpty: () => fill(host, filtersActive()
|
||||
? h('div.vuoto-pagina', icon('list-filter'), h('h2', t('libreria.nessuno')), h('p', t('libreria.nessunoTesto')),
|
||||
h('button.btn', { type: 'button', onclick: () => { Object.assign(state, readState(new URLSearchParams())); search.value = ''; apply(); } }, t('libreria.togliFiltri')))
|
||||
: notConnected()
|
||||
? welcome()
|
||||
: h('div.vuoto-pagina', icon('image'), h('h2', t('libreria.vuota')), h('p', t('libreria.vuotaTesto')))),
|
||||
onEmpty: drawEmpty,
|
||||
});
|
||||
try {
|
||||
await mosaic.start();
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace Febe.Tests.Web;
|
||||
/// The interface itself in a real (headless) Chromium against a test server: what only shows when the scripts run.
|
||||
/// The «driving» lease of the Browser and Collegamento pages (spec §4.1, §10.3: the engine is still only while Alberto
|
||||
/// uses the browser), the remote view's keyboard and mouse, the mosaic and the account card when filters change,
|
||||
/// the unsaved-changes guard on the browser's Back button, the window bar of Limiti, the sidebar status box.
|
||||
/// the empty library that follows the connection, the unsaved-changes guard on the browser's Back button, the window
|
||||
/// bar of Limiti, the sidebar status box.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
[DoNotParallelize]
|
||||
@@ -30,6 +31,25 @@ public sealed class InterfaceTests
|
||||
|
||||
private static readonly ConnectionStatus Verification = new(ConnectionState.VerificationRequired, "tuo.profilo", "Il tuo profilo", false, "https://www.instagram.com/challenge/");
|
||||
|
||||
/// <summary>
|
||||
/// Installed before the page scripts: the answer of <c>/api/engine</c> waits until <c>window.__releaseEngine()</c>,
|
||||
/// and without the event stream (the interface then asks <c>/api/engine</c>) nothing brings the engine sooner.
|
||||
/// </summary>
|
||||
private const string HoldEngine = """
|
||||
(() => {
|
||||
const original = window.fetch.bind(window);
|
||||
let release;
|
||||
const gate = new Promise((resolve) => { release = resolve; });
|
||||
window.__releaseEngine = () => { release(); return true; };
|
||||
window.fetch = async (input, init) => {
|
||||
const url = typeof input === 'string' ? input : input.url;
|
||||
if (url.includes('/api/engine')) await gate;
|
||||
return original(input, init);
|
||||
};
|
||||
delete window.EventSource;
|
||||
})();
|
||||
""";
|
||||
|
||||
// ------------------------------------------------------------------------------------------ the driving lease
|
||||
|
||||
[TestMethod]
|
||||
@@ -362,6 +382,32 @@ public sealed class InterfaceTests
|
||||
await ui.WaitAsync("document.querySelector('main .mosaico .tess') !== null", "tessere disegnate");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TheEmptyLibraryFollowsTheConnectionAlsoWhenTheEngineAnswersLate()
|
||||
{
|
||||
await using var server = await WebTestServer.StartAsync();
|
||||
await using var ui = await UiBrowser.StartAsync();
|
||||
await ui.AddInitScriptAsync(HoldEngine);
|
||||
await ui.OpenAsync(new Uri(server.Address, "/libreria"));
|
||||
|
||||
// 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 [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));
|
||||
await ui.EvalAsync("import('/js/core/engine.js').then((m) => m.refreshEngine()).then(() => true)");
|
||||
await ui.WaitAsync("document.querySelector('main .benvenuto') === null && document.querySelector('main .vuoto-pagina h2') !== null", "libreria vuota da collegato");
|
||||
Assert.AreEqual("La libreria è ancora vuota", (await ui.EvalAsync("document.querySelector('main .vuoto-pagina h2').textContent")).GetString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TheAccountHeaderFollowsEveryMenuAction()
|
||||
{
|
||||
@@ -422,7 +468,11 @@ public sealed class InterfaceTests
|
||||
await ui.EvalAsync("history.back()");
|
||||
await ui.WaitAsync("document.querySelector('.dialogo') !== null", "di nuovo il dialogo");
|
||||
await ui.EvalAsync("[...document.querySelectorAll('.dialogo footer button')].find((b) => b.textContent === 'Lascia le modifiche').click()");
|
||||
await ui.WaitAsync("location.pathname === '/libreria' && document.querySelector('main .vuoto-pagina, main .mosaico') !== null", "Libreria");
|
||||
|
||||
// The Libreria drawn to its end, not its empty mosaic of the first milliseconds: this library is empty and Febe
|
||||
// is not connected, so it ends on the welcome of the first start (spec §10.3).
|
||||
await ui.WaitAsync("location.pathname === '/libreria' && document.querySelector('main .benvenuto') !== null", "Libreria (primo avvio)");
|
||||
Assert.IsTrue((await ui.EvalAsync("document.querySelector('.dialogo') === null && document.querySelector('.cerchio-giorno') === null && document.querySelector('.salva').hidden")).GetBoolean(), "Limiti and its edits are gone");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
Reference in new issue
Block a user