Prove: l'errore di chi ascolta la ripartenza si prova sulla CI per Linux
La prova che un gestore di Reconnected che lancia non disfa l'Attach di WebView2CdpSession usa solo un finto WebView2, ma stava in tests/Febe.Tests.Windows, che la CI non esegue mai (rilievo R4 della revisione). Ora sta in tests/Febe.Tests/Desktop/WebView2CdpSessionTests.cs, accanto alle altre prove della sessione, e gira a ogni push. Controllata con il vecchio Reconnected?.Invoke rimesso a mano: rossa; con il codice vero: verde. La guida di Windows ora dice dove sta quella prova e cita, fra le prove per Windows, «Esci» mentre l'avvio non si completa. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7aaa93fe3b
commit
f48b6abac4
3 files changed
+29
-62
No files matched your search
@@ -286,6 +286,26 @@ public sealed class WebView2CdpSessionTests
|
||||
CollectionAssert.AreEqual(new[] { "uno", "due" }, received.ToArray());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task AFailingReconnectionHandlerDoesNotUndoTheAttach()
|
||||
{
|
||||
// Attach runs inside the start of the new WebView: an error of whoever listens must not turn a start that worked
|
||||
// into a failed one, retried with the same outcome for ever.
|
||||
var log = new RecordingBrowserLog();
|
||||
await using var session = new WebView2CdpSession(log);
|
||||
var later = 0;
|
||||
session.Reconnected += (_, _) => throw new InvalidOperationException("guasto di chi ascolta");
|
||||
session.Reconnected += (_, _) => later++;
|
||||
|
||||
session.Attach(new FakeDevTools());
|
||||
session.Attach(new FakeDevTools());
|
||||
|
||||
Assert.IsTrue(session.IsAttached, "the new WebView stays attached");
|
||||
Assert.AreEqual(1, later, "the other handlers still hear of it");
|
||||
Assert.IsTrue(log.Lines.Any(l => l.StartsWith("Warning ", StringComparison.Ordinal) && l.Contains("InvalidOperationException", StringComparison.Ordinal)), log.All);
|
||||
Assert.AreEqual("{}", (await session.SendAsync("Page.enable", ct: TestContext.CancellationToken)).GetRawText());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ProtocolErrorsAreReadFromTheMessageOfWebView2()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user