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
@@ -132,6 +132,33 @@ public sealed class RemoteViewStartTests
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Timeout(30_000, CooperativeCancellation = true)]
|
||||
public async Task OnlyAViewClosedByItsPageIsToldToTheConnection()
|
||||
{
|
||||
// Docker (answer of 25 November 2026): a view closed by its page may be Alberto leaving the browser; one replaced
|
||||
// by another tab, one that did not start, or one closed because Febe stops is not.
|
||||
var ct = TestContext.CancellationToken;
|
||||
var told = 0;
|
||||
await using var bed = new Bed(attempt => attempt == 3 ? new CdpDisconnectedException("Il collegamento con il browser si è chiuso.") : null, viewClosed: () => Interlocked.Increment(ref told));
|
||||
|
||||
var older = await bed.Host.OpenAsync(ct);
|
||||
var newer = await bed.Host.OpenAsync(ct);
|
||||
Assert.AreEqual(RemoteViewEnd.Replaced, older.Ended);
|
||||
Assert.AreEqual(0, Volatile.Read(ref told), "replaced by another tab: Alberto is still at the browser");
|
||||
|
||||
await newer.DisposeAsync();
|
||||
Assert.AreEqual(1, Volatile.Read(ref told), "the page closed its view");
|
||||
|
||||
await Assert.ThrowsExactlyAsync<RemoteViewUnavailableException>(() => bed.Host.OpenAsync(ct));
|
||||
Assert.AreEqual(1, Volatile.Read(ref told), "a view that did not start was never the page's");
|
||||
|
||||
var last = await bed.Host.OpenAsync(ct);
|
||||
await bed.Host.ShutdownAsync();
|
||||
Assert.AreEqual(RemoteViewEnd.ShuttingDown, last.Ended);
|
||||
Assert.AreEqual(1, Volatile.Read(ref told), "Febe stopping is not Alberto leaving");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Timeout(30_000, CooperativeCancellation = true)]
|
||||
public async Task PaginaInizialeOpensTheStartPageOfTheMoment()
|
||||
@@ -300,7 +327,8 @@ public sealed class RemoteViewStartTests
|
||||
/// tested in BrowserStartPageTests); null: nowhere.
|
||||
/// </param>
|
||||
/// <param name="open">What «Pagina iniziale» does instead (it wins over <paramref name="startPage"/>).</param>
|
||||
public Bed(Func<int, Exception?> startFailure, Func<string>? startPage = null, Func<CancellationToken, Task>? open = null)
|
||||
/// <param name="viewClosed">What the connection is told when a view is closed by its page.</param>
|
||||
public Bed(Func<int, Exception?> startFailure, Func<string>? startPage = null, Func<CancellationToken, Task>? open = null, Action? viewClosed = null)
|
||||
{
|
||||
Clock = new VirtualClock();
|
||||
_start = Clock.Now;
|
||||
@@ -326,7 +354,7 @@ public sealed class RemoteViewStartTests
|
||||
};
|
||||
Browser = new PageBrowser(Cdp);
|
||||
_log = new FebeLog(null, null, Clock);
|
||||
Host = new BrowserRemoteViewHost(Browser, new BrowserUseTracker(), Clock, _log, browserClock: Clock, openStartPage: open ?? (startPage is null ? null : async ct => await Cdp.NavigateAsync(startPage(), ct)))
|
||||
Host = new BrowserRemoteViewHost(Browser, new BrowserUseTracker(), Clock, _log, browserClock: Clock, openStartPage: open ?? (startPage is null ? null : async ct => await Cdp.NavigateAsync(startPage(), ct)), viewClosed: viewClosed)
|
||||
{
|
||||
// The virtual clock moves only in the pauses: a watchdog on it would never wait.
|
||||
Watchdog = null,
|
||||
|
||||
Reference in new issue
Block a user