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;