Prove della vista remota: i tasti partono a socket aperto
AltGrCharactersReachTheRemotePageAsText mandava i tasti 300 ms dopo che il server aveva aperto la vista. Il server la apre prima di rispondere al WebSocket e la pagina scarta i messaggi finché il socket non è aperto: su una macchina più lenta di così i tasti andavano persi e la prova falliva dopo 30 s. Ora aspetta che il WebSocket della pagina sia aperto. ReleasingTheMouseOutsideTheViewReleasesTheRemoteButton aspettava 300 ms prima di scrivere meta e fotogramma, senza bisogno: ciò che il server scrive resta nella vista finché il socket non è aperto e la pagina ascolta da subito. Il primo fotogramma sullo schermo dice già che il mouse può partire. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d07ed07db6
commit
7a9c235552
2 files changed
+8
-2
No files matched your search
@@ -247,10 +247,13 @@ public sealed class InterfaceTests
|
||||
var view = new FakeRemoteViewHost();
|
||||
await using var server = await DockerAsync(connection, view);
|
||||
await using var ui = await UiBrowser.StartAsync();
|
||||
await ui.AddInitScriptAsync(UiBrowser.Requests);
|
||||
await ui.OpenAsync(new Uri(server.Address, "/browser"));
|
||||
await ui.WaitForAsync(() => view.Opened.Count == 1, "vista aperta");
|
||||
await ui.WaitAsync("document.querySelector('canvas.vista-schermo') !== null", "schermo della vista");
|
||||
await Task.Delay(300);
|
||||
|
||||
// The view sends keys only once its socket is open (the server opens the view before it answers the socket).
|
||||
await ui.WaitAsync("window.__sockets.some((s) => s.url.endsWith('/api/vista') && s.readyState === WebSocket.OPEN)", "vista collegata");
|
||||
|
||||
// Italian layout on Windows: AltGr+ò is «@», reported as Ctrl+Alt with the AltGraph modifier.
|
||||
Assert.IsTrue((await ui.EvalAsync("new KeyboardEvent('keydown', { key: '@', modifierAltGraph: true }).getModifierState('AltGraph')")).GetBoolean());
|
||||
@@ -287,7 +290,9 @@ public sealed class InterfaceTests
|
||||
await ui.OpenAsync(new Uri(server.Address, "/browser"));
|
||||
await ui.WaitForAsync(() => view.Opened.Count == 1, "vista aperta");
|
||||
var remote = view.Opened.Single();
|
||||
await Task.Delay(300);
|
||||
|
||||
// What the view writes waits in it until the socket is open, and the page listens from the start; the first
|
||||
// frame on the screen says that the socket is open, so the buttons can go.
|
||||
remote.Write(new RemoteViewMeta(320, 225, "https://www.instagram.com/"));
|
||||
remote.Write(new RemoteViewFrame(TestFile.PhotoBytes(3, 320, 225)));
|
||||
await ui.WaitAsync("!document.querySelector('canvas.vista-schermo').hidden", "primo fotogramma");
|
||||
|
||||
Reference in new issue
Block a user