Sito di prova: /benvenuto, la «pagina di accesso» che Febe apre, esiste
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
d9da3b07cb
commit
5f968c69d9
4 files changed
+29
No files matched your search
@@ -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("<form", html, "No login form: the test site never asks for a password.");
|
||||
Assert.IsTrue(
|
||||
response.Headers.TryGetValues("Set-Cookie", out var cookies) && cookies.Any(c => c.StartsWith(TestSite.SessionCookie + "=", StringComparison.Ordinal)),
|
||||
"The visit opens the session of the site.");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Timeout(60_000, CooperativeCancellation = true)]
|
||||
public async Task TheReadersReadWhatTheSiteServesWithTheSeedOfThisRun()
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -76,6 +76,13 @@ internal static class Pages
|
||||
|
||||
public static string NotFound() => Layout("Pagina non trovata", "nessuna", string.Empty, "<h1>Pagina non trovata</h1>");
|
||||
|
||||
/// <summary>What Febe opens as the login page of the test site: there is nothing to type, the visit opens the session.</summary>
|
||||
public static string Welcome() => Layout("Benvenuto", "nessuna", string.Empty, """
|
||||
<h1>Benvenuto nel sito di prova</h1>
|
||||
<p>Qui non c'è nessuna password: il sito di prova ti considera entrato appena apri una sua pagina. Torna a Febe e
|
||||
premi «Ho finito».</p>
|
||||
""");
|
||||
|
||||
private static string Layout(string title, string page, string attributes, string main) => $"""
|
||||
<!doctype html>
|
||||
<html lang="it">
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user