From 5f968c69d921c9a774b3fee17bcc724779221f7a Mon Sep 17 00:00:00 2001 From: Alberto Balbo Date: Tue, 20 Oct 2026 13:53:52 +0200 Subject: [PATCH] =?UTF-8?q?Sito=20di=20prova:=20/benvenuto,=20la=20=C2=ABp?= =?UTF-8?q?agina=20di=20accesso=C2=BB=20che=20Febe=20apre,=20esiste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Il Collegamento di Febe, con il sito di prova, apre /benvenuto come pagina di accesso, ma il sito rispondeva «Pagina non trovata»: la sessione si apriva lo stesso (il cookie arriva con ogni pagina), però chi prova vedeva un errore. Ora è una pagina di solo testo che dice di tornare a Febe e premere «Ho finito»; nessun modulo, nessuna password. Una prova senza browser lo controlla, con qualunque seme. Co-Authored-By: Claude Opus 5.5 --- .../Collection/SyntheticSiteSeedTests.cs | 17 +++++++++++++++++ tools/Febe.SitoDiProva/LEGGIMI.md | 1 + tools/Febe.SitoDiProva/Pages.cs | 7 +++++++ tools/Febe.SitoDiProva/TestSite.cs | 4 ++++ 4 files changed, 29 insertions(+) diff --git a/tests/Febe.Tests/Collection/SyntheticSiteSeedTests.cs b/tests/Febe.Tests/Collection/SyntheticSiteSeedTests.cs index 2c43a0b..97fafce 100644 --- a/tests/Febe.Tests/Collection/SyntheticSiteSeedTests.cs +++ b/tests/Febe.Tests/Collection/SyntheticSiteSeedTests.cs @@ -138,6 +138,23 @@ public sealed partial class SyntheticSiteSeedTests } } + [TestMethod] + [Timeout(30_000, CooperativeCancellation = true)] + public async Task TheLoginAddressOfTheTestSiteIsAWelcomePageThatOpensTheSession() + { + // Febe opens /benvenuto as the «pagina di accesso» of the test site (LoginUrl of DesktopOptions and ServerOptions). + await using var site = await SyntheticSite.StartAsync(); + using var client = new HttpClient(new SocketsHttpHandler { UseProxy = false, UseCookies = false }); + using var response = await client.GetAsync(new Uri(site.Url("/benvenuto")), TestContext.CancellationToken); + Assert.AreEqual(System.Net.HttpStatusCode.OK, response.StatusCode); + var html = await response.Content.ReadAsStringAsync(TestContext.CancellationToken); + StringAssert.Contains(html, "Ho finito"); + Assert.DoesNotContain(" c.StartsWith(TestSite.SessionCookie + "=", StringComparison.Ordinal)), + "The visit opens the session of the site."); + } + [TestMethod] [Timeout(60_000, CooperativeCancellation = true)] public async Task TheReadersReadWhatTheSiteServesWithTheSeedOfThisRun() diff --git a/tools/Febe.SitoDiProva/LEGGIMI.md b/tools/Febe.SitoDiProva/LEGGIMI.md index 285ff27..607de78 100644 --- a/tools/Febe.SitoDiProva/LEGGIMI.md +++ b/tools/Febe.SitoDiProva/LEGGIMI.md @@ -53,6 +53,7 @@ storie attive di Marta è anche nella raccolta «Estate», con lo **stesso ident | `/post/{codice}/` | pagina di un post, con tutti i file | | `/verifica` | pagina di verifica, semplice testo | | `/sessione-scaduta` | pagina di sessione terminata, semplice testo (non è un modulo di accesso) | +| `/benvenuto` | quella che Febe apre come «pagina di accesso» del sito di prova (Collegamento): semplice testo, nessun modulo; la visita apre la sessione, come ogni pagina | La mappa dei bersagli di queste pagine è `src/Febe.Core/Config/bersagli.prova.json` (copiata accanto al programma in `config/`), i segnali di arresto sono in `segnali.prova.json`. diff --git a/tools/Febe.SitoDiProva/Pages.cs b/tools/Febe.SitoDiProva/Pages.cs index 7536f44..df27c6f 100644 --- a/tools/Febe.SitoDiProva/Pages.cs +++ b/tools/Febe.SitoDiProva/Pages.cs @@ -76,6 +76,13 @@ internal static class Pages public static string NotFound() => Layout("Pagina non trovata", "nessuna", string.Empty, "

Pagina non trovata

"); + /// What Febe opens as the login page of the test site: there is nothing to type, the visit opens the session. + public static string Welcome() => Layout("Benvenuto", "nessuna", string.Empty, """ +

Benvenuto nel sito di prova

+

Qui non c'è nessuna password: il sito di prova ti considera entrato appena apri una sua pagina. Torna a Febe e + premi «Ho finito».

+ """); + private static string Layout(string title, string page, string attributes, string main) => $""" diff --git a/tools/Febe.SitoDiProva/TestSite.cs b/tools/Febe.SitoDiProva/TestSite.cs index 0908faa..0c8fc88 100644 --- a/tools/Febe.SitoDiProva/TestSite.cs +++ b/tools/Febe.SitoDiProva/TestSite.cs @@ -215,6 +215,10 @@ public sealed class TestSite : IAsyncDisposable case []: html = Pages.Home(); break; + case ["benvenuto"]: + // The «pagina di accesso» Febe opens on the test site (LoginUrl): the cookie above already opened the session. + html = Pages.Welcome(); + break; case ["profilo", var user, ..] when World.FindByUsername(user) is null: html = Pages.ProfileNotFound(user); status = 404;