E2: correzioni della revisione delle copie esterne
- Nome libero scelto prima di scrivere, libero sul disco e nel database; una riga orfana sul nome diventa «Tolto» (guardando il suo percorso, anche se differisce solo per le maiuscole): prima la copia finiva «Non riuscito» con il file già scritto, o toglieva la copia buona. - «Controlla le copie» rilegge la radice e riguarda i file mancanti; con il disco staccato si ferma e mette in pausa senza segnare nulla. - Su Linux lo spostamento sul nome finale non sostituisce mai un file (renameat2 RENAME_NOREPLACE, poi link e unlink). - Le copie in coda di un lavoro interrotto diventano «Interrotta» e si riprendono; il permesso dei lavori lunghi si tiene già nel piano. - «Superato» con il file di nuovo in libreria: filtro, piano e «Copia di nuovo» d'accordo; l'adozione ravviva la riga invece di fallire. - «Una copia sola» con una regola sola in filtro, piano, visualizzatore e copiatore (solo copie di un altro account in cartelle in uso). - Controllo della cartella per identità vera (percorso finale, realpath, dispositivo di mountinfo): riconosce collegamenti e bind mount di una sottocartella della libreria. - Sfoglia delle cartelle con tempi massimi; «Nessuna cartella» solo se non ce n'è; «In copia…» nel visualizzatore; numero e fuoco stabili in «Copia di nuovo anche…»; una sola lettura per volta nella Dashboard. - Prove dell'interfaccia indipendenti dall'ora e dal file scelto; prove nuove in ExportReviewTests, ExportFolderCheckTests, ExportRootTests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28c7f814b1
commit
36ad5c6f9d
28 files changed
+1314
-112
No files matched your search
@@ -135,11 +135,20 @@ public sealed class ExportInterfaceTests
|
||||
using var temp = new TempFolder("esporta-selezione-ui");
|
||||
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
|
||||
|
||||
// The three newest entries of the demo have four files still to copy.
|
||||
// The newest entries of marta.demo (general folder) with a file still to copy. The demo places its entries by the
|
||||
// hour it is built (decision of 26 November 2026), so how many files they have is asked of the plan, not assumed.
|
||||
await ui.OpenAsync(new Uri(demo.Address, "/libreria"));
|
||||
await ui.WaitAsync("document.querySelectorAll('.mosaico .tess').length >= 3", "il mosaico");
|
||||
await ui.WaitAsync("document.querySelector('.mosaico .tess') !== null", "il mosaico");
|
||||
var marta = (await ui.EvalAsync("fetch('/api/accounts').then((r) => r.json()).then((j) => j.accounts.find((a) => a.username === 'marta.demo').id)")).GetInt64();
|
||||
await ui.OpenAsync(new Uri(demo.Address, $"/libreria?copie=non-copiati&account={marta}"));
|
||||
await ui.WaitAsync("document.querySelectorAll('.mosaico .tess').length >= 1 && [...document.querySelectorAll('.mosaico .tess')].every((t) => t.dataset.id)", "il mosaico dei non ancora copiati");
|
||||
Assert.IsTrue((await ui.EvalAsync(ClickText(".strumenti", ".btn", "Seleziona"))).GetBoolean());
|
||||
await ui.EvalAsync("[...document.querySelectorAll('.mosaico .tess')].slice(0, 3).forEach((t) => t.click())");
|
||||
var files = (await ui.EvalAsync(
|
||||
"fetch('/api/export/plan', { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, "
|
||||
+ "body: JSON.stringify({ entryIds: [...document.querySelectorAll('.mosaico .tess')].slice(0, 3).map((t) => Number(t.dataset.id)), copyAgain: false }) })"
|
||||
+ ".then((r) => r.json()).then((j) => j.files)")).GetInt32();
|
||||
Assert.IsGreaterThan(0, files, "«Non ancora copiati» has files to copy");
|
||||
const string CopyIn = "[...document.querySelectorAll('.salva button')].find((b) => b.textContent.includes('Copia in'))";
|
||||
await ui.WaitAsync($"({CopyIn}) && !({CopyIn}).disabled", "«Copia in…» nella barra della scelta");
|
||||
await ui.EvalAsync($"({CopyIn}).click()");
|
||||
@@ -147,10 +156,10 @@ public sealed class ExportInterfaceTests
|
||||
const string Dialog = "document.querySelector('.dialogo.copia-in')";
|
||||
await ui.WaitAsync($"{Dialog}?.querySelector('.riepilogo-copia') != null", "il riepilogo");
|
||||
var summary = (await ui.EvalAsync($"{Dialog}.querySelector('.riepilogo-copia').textContent")).GetString()!;
|
||||
StringAssert.StartsWith(summary, "4 file", summary);
|
||||
StringAssert.StartsWith(summary, $"{files} file", summary);
|
||||
StringAssert.Contains(summary, "circa", "lo spazio");
|
||||
StringAssert.Contains((await ui.EvalAsync($"{Dialog}.querySelector('.destinazioni-copia').textContent")).GetString(), "In Disco USB");
|
||||
Assert.AreEqual("Copia 4 file", (await ui.EvalAsync($"{Dialog}.querySelector('footer .btn.primo').textContent.trim()")).GetString());
|
||||
Assert.AreEqual($"Copia {files} file", (await ui.EvalAsync($"{Dialog}.querySelector('footer .btn.primo').textContent.trim()")).GetString());
|
||||
|
||||
await ui.EvalAsync($"{Dialog}.querySelector('footer .btn.primo').click()");
|
||||
await ui.WaitAsync($"{Dialog} === null", "il dialogo si chiude");
|
||||
@@ -160,7 +169,7 @@ public sealed class ExportInterfaceTests
|
||||
// The job is in the Dashboard tab, finished: the demo copies at once.
|
||||
await ui.EvalAsync("document.querySelector('.brevi .breve a.breve-link').click()");
|
||||
await ui.WaitAsync("location.pathname === '/dashboard/esportazione' && document.querySelector('.esportazione-dashboard .elenco-attivita li') !== null", "la linguetta «Esportazione»");
|
||||
await ui.WaitAsync("document.querySelector('.esportazione-dashboard .elenco-attivita li').textContent.includes('4 di 4 file')", "il lavoro di 4 file " + ui.Report());
|
||||
await ui.WaitAsync($"document.querySelector('.esportazione-dashboard .elenco-attivita li').textContent.includes('{files} di {files} file')", $"il lavoro di {files} file " + ui.Report());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -223,7 +232,17 @@ public sealed class ExportInterfaceTests
|
||||
await ui.WaitAsync("document.querySelector('.strumenti .modo-mosaico [data-value=files]') !== null && document.querySelector('.mosaico .tess') !== null", "la Libreria con «Tolti o superati»");
|
||||
await ui.EvalAsync("document.querySelector('.strumenti .modo-mosaico [data-value=files]').click()");
|
||||
await ui.WaitAsync("document.querySelector('.strumenti .modo-mosaico [aria-checked=true]').dataset.value === 'files' && document.querySelector('.mosaico .tess') !== null", "«Tutte le foto»");
|
||||
await ui.EvalAsync("document.querySelector('.mosaico .tess').click()");
|
||||
|
||||
// The first of those files that is on disk (the demo shares the bytes of a picture with a video that has no file,
|
||||
// and which comes first depends on the hour the demo is built): «Copia in…» is offered only for a file on disk.
|
||||
var target = (await ui.EvalAsync(
|
||||
"(async () => { const j = await (await fetch('/api/library?mode=files&copies=removedOrSuperseded&limit=1000')).json(); "
|
||||
+ "for (const tile of j.tiles) { if (!tile.cover) continue; const e = await (await fetch('/api/entries/' + tile.id)).json(); "
|
||||
+ "const m = e.media.find((x) => x.id === tile.cover.mediaId); if (m && m.available) return tile.cover.mediaId; } return 0; })()")).GetInt64();
|
||||
Assert.IsGreaterThan(0L, target, "a «tolto o superato» file on disk");
|
||||
var tile = $"document.querySelector('.mosaico .tess[data-id=\"{target}\"]')";
|
||||
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()!;
|
||||
|
||||
Reference in new issue
Block a user