Ricerca dei profili con suggerimenti e foto (#37)
verifica / controlli (push) Successful in 20s
verifica / prove (push) Failing after 19m40s
verifica / installatore (push) Skipped
verifica / immagine (push) Skipped

«Aggiungi account» ha una sola casella: mentre Alberto scrive compaiono
subito i suggerimenti locali, poi i profili di Instagram con la foto, come
chiesto in #37. Il browser di Febe scrive nella casella «Cerca» di Instagram
con tasti veri da una mappa chiusa (mai Invio, Tab o Esc), controlla prima
il fuoco, legge la risposta della pagina e non clicca mai un risultato.

La ricerca ha una categoria propria nel Governatore, con tetti larghi che
non consumano quelli della raccolta, e si dà il turno con il motore
sull'unica pagina; a fine sessione la pagina torna comunque al riposo. Le
foto passano dal CDN con un permesso ciascuna e restano solo in memoria.

Le risposte di Alberto del 15 novembre (controllo del fuoco, turni, evento
requestWillBeSent, niente foto dei seguiti per ora) sono in §6.1 e in
docs/decisioni.md. Su Instagram vero la ricerca parte quando i bersagli
search-open e search-box saranno raccolti dal vivo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-15 16:30:03 +01:00
1 parent 5e417c666d
commit 9941a2fa1f
98 files changed
+8021 -229

No files matched your search

+45
View File
@@ -260,6 +260,51 @@ public sealed class DemoTests
Assert.IsFalse(string.IsNullOrWhiteSpace(body.RootElement.Str("message")));
}
[TestMethod]
public async Task TheSearchOfTheDemoFindsProfilesWithDrawnPhotos()
{
var origin = $"{Demo.Address.Scheme}://{Demo.Address.Authority}";
async Task<JsonElement> PostAsync(string text, string scene = "normale")
{
using var request = new HttpRequestMessage(HttpMethod.Post, $"/api/ricerca?scena={scene}")
{
Content = new StringContent(JsonSerializer.Serialize(new { client = "0123456789abcdef", text }), System.Text.Encoding.UTF8, "application/json"),
};
request.Headers.Add("Origin", origin);
using var response = await Client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, body);
return JsonDocument.Parse(body).RootElement.Clone();
}
Assert.AreEqual("solo-locale", (await PostAsync("m")).Str("state"));
Assert.AreEqual("cerca", (await PostAsync("marta")).Str("state"));
JsonElement view = default;
await TestWait.UntilAsync(
async () =>
{
view = await GetAsync("/api/ricerca?client=0123456789abcdef");
return view.Str("state") == "pronta" && view.Items("hits").All(h => h.Bool("photoReady"));
},
"the demo answer with its photos");
var hits = view.Items("hits").ToList();
Assert.IsTrue(hits.Count is > 0 and <= 6);
Assert.IsTrue(hits.Any(h => h.Str("username") == "marta.demo"), "a demo account whose name holds the text");
Assert.IsTrue(hits.Any(h => h.GetProperty("accountId").ValueKind == JsonValueKind.Number), "already in Febe");
using var photo = await Client.GetAsync($"/api/ricerca/foto/{hits[0].Str("photo")}");
Assert.AreEqual(HttpStatusCode.OK, photo.StatusCode);
Assert.AreEqual("image/jpeg", photo.Content.Headers.ContentType?.MediaType);
Assert.AreEqual("ferma", (await PostAsync("luca", "fermo")).Str("state"));
Assert.AreEqual("non-pronto", (await PostAsync("luca", "scollegato")).Str("state"));
// «alvolante»: Alberto uses the browser; the engine says so and the search on Instagram is not possible.
var driving = await PostAsync("luca", "alvolante");
Assert.AreEqual("non-possibile", driving.Str("state"));
StringAssert.Contains(driving.Str("message"), "Stai usando il browser");
Assert.AreEqual("UserDriving", (await GetAsync("/api/engine?scena=alvolante")).GetProperty("snapshot").Str("mode"));
}
[TestMethod]
public async Task TheEditionCanBeChosenByAddress()
{