Docker: lasciare la pagina del browser copia la sessione (#36, S4b, risposta 1)
In Docker lasciare la pagina «Browser» o la vista remota di Collegamento mentre Alberto guida (un'altra pagina, la scheda chiusa, il collegamento perso) valeva «Annulla» e la sessione non si copiava. Ora è come chiudere la finestra del browser su Windows: `cancel` con `pageLeft` va a LeavePageAsync, la vista remota chiusa dalla sua pagina lo dice alla connessione, e se per 5 secondi non si apre un'altra vista né arriva un `begin` (una pagina ricaricata) il controllo del permesso copia la sessione con CopyOnLetGoAsync, solo da una pagina del sito che non sia di accesso o di verifica, poi rilascia il permesso e il motore rimette il browser a riposo. Il pulsante «Annulla» continua a non copiare; Windows non cambia. Prove nuove per la copia lasciando la pagina, la ricarica che non è lasciare, la pagina di accesso, la vista sostituita o chiusa da Febe; guida, protocollo e una riga in decisioni.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
537517b855
commit
2fc4b40c41
15 files changed
+312
-44
No files matched your search
@@ -63,19 +63,21 @@ public sealed class ConnectionApiTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task LeavingThePageIsAnnullaInDockerAndOnlyTheEndOfTheHoldOnWindows()
|
||||
public async Task LeavingThePageLetsGoOfTheBrowserInDockerAndOnlyEndsTheHoldOnWindows()
|
||||
{
|
||||
// Docker: the remote view is the page, leaving it gives the browser back to rest.
|
||||
// Docker: the remote view is the page; leaving it lets go of the browser like closing the window on Windows (the
|
||||
// session is copied: answer of 25 November 2026), while the button «Annulla» still cancels.
|
||||
var docker = new RecordingConnection();
|
||||
await using (var server = await Part2.StartAsync(services: s => s.AddSingleton<IConnectionService>(docker)))
|
||||
{
|
||||
var (status, _) = await server.SendJsonAsync(HttpMethod.Post, "/api/connection/cancel", new { pageLeft = true });
|
||||
Assert.AreEqual(HttpStatusCode.NoContent, status);
|
||||
await server.SendJsonAsync(HttpMethod.Post, "/api/connection/cancel");
|
||||
var (showStatus, _) = await server.SendJsonAsync(HttpMethod.Post, "/api/browser/show");
|
||||
Assert.AreEqual(HttpStatusCode.BadRequest, showStatus, "in Docker the browser is the Browser page");
|
||||
}
|
||||
|
||||
CollectionAssert.AreEqual(new[] { "cancel" }, docker.Calls);
|
||||
CollectionAssert.AreEqual(new[] { "leave", "cancel" }, docker.Calls);
|
||||
|
||||
// Windows (issue #52): the window stays as it is; «Annulla» is still «Annulla»; «Apri il browser» says which page.
|
||||
var windows = new RecordingConnection();
|
||||
|
||||
@@ -90,12 +90,12 @@ public sealed class InterfaceTests
|
||||
await ui.OpenAsync(new Uri(server.Address, "/browser"));
|
||||
await ui.WaitForAsync(() => connection.Snapshot().Contains("begin:False") && view.Opened.Count == 1, "il browser in uso con la vista aperta");
|
||||
|
||||
// Another page from the sidebar: the view closes and the lease of «begin» goes too (like «Annulla»).
|
||||
// Another page from the sidebar: the view closes and the page lets go of the browser (not «Annulla»: the session is copied).
|
||||
await ui.EvalAsync("document.querySelector('a[data-nav=libreria]').click()");
|
||||
await ui.WaitAsync("location.pathname === '/libreria'", "Libreria");
|
||||
await ui.WaitForAsync(() => connection.Snapshot().Contains("cancel"), "il browser restituito lasciando la pagina");
|
||||
await ui.WaitForAsync(() => connection.Snapshot().Contains("leave"), "il browser restituito lasciando la pagina");
|
||||
await ui.WaitForAsync(() => view.Opened.All(v => v.Disposed), "vista remota chiusa");
|
||||
CollectionAssert.AreEqual(new[] { "begin:False", "cancel" }, connection.Snapshot());
|
||||
CollectionAssert.AreEqual(new[] { "begin:False", "leave" }, connection.Snapshot());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -111,7 +111,7 @@ public sealed class InterfaceTests
|
||||
|
||||
// The document goes away (tab closed, reload, another site): only the page-hide event is left to say so.
|
||||
await ui.SendAsync("Page.navigate", new JsonObject { ["url"] = "about:blank" });
|
||||
await ui.WaitForAsync(() => connection.Snapshot().Contains("cancel"), "il browser restituito chiudendo la scheda");
|
||||
await ui.WaitForAsync(() => connection.Snapshot().Contains("leave"), "il browser restituito chiudendo la scheda");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -258,7 +258,7 @@ public sealed class InterfaceTests
|
||||
await ui.NavigateAsync("/libreria");
|
||||
await ui.WaitAsync("location.pathname === '/libreria'", "Libreria");
|
||||
await ui.WaitForQuietAsync("richieste della pagina finite");
|
||||
CollectionAssert.AreEqual(new[] { "begin:False", "finish", "begin:False", "cancel" }, connection.Snapshot(), "leaving the page gives the browser back");
|
||||
CollectionAssert.AreEqual(new[] { "begin:False", "finish", "begin:False", "leave" }, connection.Snapshot(), "leaving the page gives the browser back");
|
||||
await ui.WaitForAsync(() => view.Opened.All(v => v.Disposed), "vista remota chiusa");
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,14 @@ internal sealed class RecordingConnection : IConnectionService
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>Docker: the page of the browser left without «Ho finito» or «Annulla» (not «Annulla»: it copies).</summary>
|
||||
public Task LeavePageAsync(CancellationToken ct)
|
||||
{
|
||||
Record("leave");
|
||||
Status = Status with { UserIsDriving = false };
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task ReleaseAsync(CancellationToken ct)
|
||||
{
|
||||
Record("release");
|
||||
|
||||
Reference in new issue
Block a user