Sessione salvata: terza revisione di S4b (#36)

La fine della guida da sola, dopo la copia, guarda di nuovo nello stesso
passo in cui rilascia il permesso: se la vista remota, la finestra o un
nuovo «Accedi» / «Usa il browser» sono tornati durante la copia, il
permesso resta. Prima finiva comunque, e alla chiusura successiva il
motore riprendeva subito, senza attesa e senza copia.

Un «Ho finito» che prova davvero a copiare, o che chiude lui il permesso,
e la chiusura della finestra che rinuncia dimenticano la copia di un
abbandono precedente: un secondo «Ho finito» non dice più «era già stata
copiata» dopo una copia appena rifiutata.

Il registro non incolpa il browser quando il tempo della finestra finisce
in attesa della pagina tenuta dalla ricerca dei profili; la riga di avvio
del motore segue IsReadyToCollect e dice quando aspetta la copia; il
riquadro «Se una copia nuova è incompleta» non mostra né accetta una
scelta finché il server non dice quella salvata, non si fa cambiare da
una risposta tardiva e torna alla scelta precedente se il salvataggio
fallisce; singolare italiano nei messaggi («manca 1 valore che serve»).

La guida e PROTOCOLLO.md dicono che in Docker copia solo «Ho finito»:
lasciare la pagina vale «Annulla». Nuova riga in decisioni.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-18 13:34:00 +01:00
1 parent 74e67adbab
commit b29b35a284
13 files changed
+343 -50

No files matched your search

@@ -47,6 +47,13 @@ public sealed class HostingAndSecurityTests
// The text resource is valid JSON with the Italian texts.
using var texts = JsonDocument.Parse(files.ReadText("testi/it.json")!);
Assert.AreEqual("Libreria", texts.RootElement.GetProperty("nav").GetProperty("libreria").GetString());
// A count of one has its singular (t() picks the part before «|» when n is 1): never «1 di questi servono».
var needed = texts.RootElement.GetProperty("impostazioni").GetProperty("collegamento").GetProperty("salvata").GetProperty("servono").GetString()!;
var forms = needed.Split('|');
Assert.HasCount(2, forms, needed);
StringAssert.StartsWith(forms[0], "{n} di questi serve ");
StringAssert.StartsWith(forms[1], "{n} di questi servono ");
}
[TestMethod]
+25
View File
@@ -180,6 +180,31 @@ public sealed class InterfaceTests
Assert.IsFalse((await ui.EvalAsync("document.querySelector('.chi-collegato').textContent.includes('@')")).GetBoolean(), "no «@» without a name");
}
[TestMethod]
public async Task TheIncompleteCopyChoiceIsShownOnlyOnceTheServerSaysWhichOneIsStored()
{
// «Tieni la copia completa» stored; the page must not show «Sostituisci comunque» meanwhile, nor let a choice be
// made that the late answer would then undo.
var saved = new SavedSessionStatus(SavedSessionStatus.Present, null, 3, 7, 7, [], 2, 2, [], 0);
var connection = new RecordingConnection { Status = Connected with { SavedSession = saved } };
await using var server = await DockerAsync(connection, new FakeRemoteViewHost());
await server.Db.Settings.SetAsync(Febe.Core.Collection.Requests.SessionCopySettings.IncompleteCopyKey, Febe.Core.Collection.Requests.SessionCopySettings.KeepCompleteText);
await using var ui = await UiBrowser.StartAsync();
await ui.AddInitScriptAsync(UiBrowser.Requests);
await ui.OpenAsync(new Uri(server.Address, "/libreria"));
await ui.EvalAsync("window.__hold('/api/connection/settings')");
await ui.NavigateAsync("/impostazioni/collegamento");
await ui.WaitAsync("document.querySelector('.sessione-salvata input[value=\"tieni-completa\"]') !== null", "riquadro della sessione salvata");
await ui.WaitAsync("window.__started['/api/connection/settings'] >= 1", "scelta chiesta al server");
Assert.IsTrue((await ui.EvalAsync("[...document.querySelectorAll('.sessione-salvata input[type=radio]')].every((i) => !i.checked && i.disabled)")).GetBoolean(), "neither choice shown nor pickable before the answer " + ui.Report());
await ui.EvalAsync("window.__release('/api/connection/settings')");
await ui.WaitAsync("document.querySelector('.sessione-salvata input[value=\"tieni-completa\"]').checked", "la scelta salvata mostrata");
Assert.IsFalse((await ui.EvalAsync("document.querySelector('.sessione-salvata input[value=\"sostituisci\"]').checked")).GetBoolean());
Assert.IsTrue((await ui.EvalAsync("[...document.querySelectorAll('.sessione-salvata input[type=radio]')].every((i) => !i.disabled)")).GetBoolean(), "pickable once known");
Assert.IsTrue((await ui.EvalAsync("document.querySelector('.scelta-ignota').hidden")).GetBoolean(), "no warning when the choice was read");
}
[TestMethod]
public async Task HoFinitoOnCollegamentoClosesTheRemoteView()
{