From 7025ddf831a53769af639574b34ba49b157fe625 Mon Sep 17 00:00:00 2001 From: Alberto Balbo Date: Sat, 28 Nov 2026 15:11:30 +0100 Subject: [PATCH] =?UTF-8?q?E3:=20la=20prova=20del=20visualizzatore=20cerca?= =?UTF-8?q?=20la=20riga=20=C2=ABTolto=C2=BB=20fra=20tutte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Con E3 un file della dimostrazione può avere anche una copia di un'altra forma (un fotogramma «Copiato»), e l'ordine delle righe dipende dall'ora in cui si costruisce la dimostrazione: la prova di E2 prendeva la prima riga e nella CI 508 era quella del fotogramma. Ora cerca la riga «Tolto» o «Superato» e usa il suo «Copia di nuovo». Co-Authored-By: Claude Opus 5.5 --- tests/Febe.Tests/Web/ExportInterfaceTests.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Febe.Tests/Web/ExportInterfaceTests.cs b/tests/Febe.Tests/Web/ExportInterfaceTests.cs index 275c659..fdf942c 100644 --- a/tests/Febe.Tests/Web/ExportInterfaceTests.cs +++ b/tests/Febe.Tests/Web/ExportInterfaceTests.cs @@ -305,8 +305,11 @@ public sealed partial class ExportInterfaceTests await ui.WaitAsync($"{tile} !== null", "la tessera del file"); await ui.EvalAsync($"{tile}.click()"); - await ui.WaitAsync("document.querySelector('.vis .riga-copia') !== null", "le righe «Copia» del visualizzatore " + ui.Report()); - var row = (await ui.EvalAsync("document.querySelector('.vis .riga-copia').textContent")).GetString()!; + // The file may also have copies of other forms (a frame of the demo, «Copiato»), so the rows are many and their + // order depends on the demo: the one «Tolto» or «Superato» is looked for among them. + const string Gone = "[...document.querySelectorAll('.vis .riga-copia')].find((r) => r.textContent.startsWith('Tolto da Disco USB') || r.textContent.startsWith('Superato in Disco USB'))"; + await ui.WaitAsync($"document.querySelector('.vis .riga-copia') !== null && ({Gone}) !== undefined", "la riga «Tolto» o «Superato» del visualizzatore " + ui.Report()); + var row = (await ui.EvalAsync($"({Gone}).textContent")).GetString()!; Assert.IsTrue(row.StartsWith("Tolto da Disco USB", StringComparison.Ordinal) || row.StartsWith("Superato in Disco USB", StringComparison.Ordinal), row); Assert.AreEqual("Copia", (await ui.EvalAsync("document.querySelector('.vis .riga-copia').previousElementSibling.textContent")).GetString()); Assert.IsTrue((await ui.EvalAsync("[...document.querySelectorAll('.vis button')].some((b) => b.textContent.trim() === 'Copia in…')")).GetBoolean(), "«Copia in…» in fondo al pannello"); @@ -315,7 +318,7 @@ public sealed partial class ExportInterfaceTests const string Replaced = "fetch('/api/library?mode=files&copies=removedOrSuperseded&limit=1000').then((r) => r.json()).then((j) => j.tiles.length)"; var before = (await ui.EvalAsync(Replaced)).GetInt32(); Assert.IsGreaterThan(0, before); - await ui.EvalAsync("document.querySelector('.vis .riga-copia .copia-di-nuovo').click()"); + await ui.EvalAsync($"({Gone}).querySelector('.copia-di-nuovo').click()"); // The notice lasts 8 s: it is looked for among those shown. await ui.WaitAsync("window.__notices.some((n) => n.href !== null && !n.kind.includes('errore'))", "l'avviso breve del lavoro"); StringAssert.Contains((await ui.EvalAsync("window.__notices.findLast((n) => n.href !== null).text")).GetString(), "Copia avviata");