Il filtro «Copie» con 200.000 elementi stava al limite dei 250 ms («Copiati» 249 ms): la migrazione 0004 aggiunge solo l'indice ix_media_sha256_entry e la finestra scende a 160 ms. Totali e giorni contano «Copiati» partendo dalle copie e gli altri valori con un solo passaggio sui file dietro gli elenchi degli SHA-256 copiati (1,5 s -> 0,7 s); hanno un limite loro di 3 s, scritto in decisioni.md con le misure. «Copia di nuovo» sceglie un file dell'account che è sul disco: prima prendeva il primo con quello SHA-256 e, nella demo, a certe ore non scriveva nulla. Nuove prove: API delle copie, coerenza della demo, interfaccia nel browser, opzioni del server, avvio del contenitore con /esporta, contenuto dell'immagine e modelli, migrazione 4 e scala. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
280 lines
23 KiB
C#
280 lines
23 KiB
C#
using Febe.Tests.Support;
|
|
using Febe.Tests.Web.Support;
|
|
using Febe.Web.Demo;
|
|
|
|
namespace Febe.Tests.Web;
|
|
|
|
/// <summary>
|
|
/// The copies to external folders in a real browser, on the demo (spec §4.10, §10.3, tappa E2): Impostazioni →
|
|
/// Esportazione with the note of Docker, the dialog of a destination (folders of /esporta, the check of the folder, the
|
|
/// types, the preview of the names), the block «Copie esterne» of an account whose switch acts at once, «Copia in…» from
|
|
/// the selection with its summary and the toast that leads to the Dashboard, the «Copie» filter in the address with the
|
|
/// marks of the tiles and the menu of the CSV icon, the rows «Copia» of the viewer with «Copia di nuovo», and the
|
|
/// Dashboard tab «Esportazione». Chromium only (CI); the selectors follow the pages of WP3, checked on the demo.
|
|
/// </summary>
|
|
[TestClass]
|
|
public sealed class ExportInterfaceTests
|
|
{
|
|
/// <summary>The demo copies its general folder to «Disco USB», under /esporta in the Docker look.</summary>
|
|
private const string General = "document.querySelector('.cartella-impostazioni .val')?.textContent || ''";
|
|
|
|
/// <summary>The «Copie» button of the tools row (the one whose label is a value of the filter).</summary>
|
|
private const string CopiesButton = "[...document.querySelectorAll('.strumenti .campo.scelta')].find((b) => /^(Copie|Copiati|Non ancora copiati|Tolti o superati)$/.test(b.textContent.trim()))";
|
|
|
|
/// <summary>Clicks the button (or menu item) of a scope whose text contains a given text.</summary>
|
|
private static string ClickText(string scope, string selector, string text) =>
|
|
$"(() => {{ const b = [...document.querySelectorAll({Js(scope + " " + selector)})].find((x) => x.textContent.includes({Js(text)})); if (!b) return false; b.click(); return true; }})()";
|
|
|
|
/// <summary>The last open menu.</summary>
|
|
private const string LastMenu = "[...document.querySelectorAll('.menu[role=menu]')].pop()";
|
|
|
|
private static string Js(string text) => System.Text.Json.JsonSerializer.Serialize(text);
|
|
|
|
[TestMethod]
|
|
public async Task TheExportSettingsPageShowsTheGeneralFolderAndTheDockerNote()
|
|
{
|
|
await using var ui = await UiBrowser.StartAsync(1440, 900);
|
|
using var temp = new TempFolder("esporta-impostazioni-ui");
|
|
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
|
|
|
|
// Docker: the folders are under /esporta, and the page says so.
|
|
await ui.OpenAsync(new Uri(demo.Address, "/impostazioni/esportazione?veste=docker"));
|
|
await ui.WaitAsync($"({General}) !== ''", "la cartella generale " + ui.Report());
|
|
Assert.AreEqual("/esporta/Disco USB", (await ui.EvalAsync(General)).GetString());
|
|
var notes = (await ui.EvalAsync("[...document.querySelectorAll('.avviso')].map((a) => a.textContent).join(' | ')")).GetString()!;
|
|
StringAssert.Contains(notes, "sottocartelle di /esporta", "la nota di Docker");
|
|
StringAssert.Contains(notes, "da riprendere", "il lavoro interrotto della demo");
|
|
CollectionAssert.AreEqual(
|
|
new[] { "Esportazione", "Cartella generale", "Lo stesso post in due account", "Cartelle degli account" },
|
|
(await ui.EvalAsync<string[]>("[...document.querySelectorAll('.sezione h2')].map((x) => x.textContent)")));
|
|
StringAssert.Contains((await ui.EvalAsync("document.querySelector('.stato-copie')?.textContent || ''")).GetString(), "copiati", "i conteggi della cartella");
|
|
Assert.IsTrue((await ui.EvalAsync("[...document.querySelectorAll('.stato-copie button')].some((b) => b.textContent.includes('Controlla le copie'))")).GetBoolean(), "«Controlla le copie»");
|
|
StringAssert.Contains((await ui.EvalAsync("[...document.querySelectorAll('table tbody tr')].map((r) => r.textContent).join(' | ')")).GetString(), "@studio.lumen.demo", "la cartella sua di un account");
|
|
|
|
// Windows: the path of the folder, no note of Docker.
|
|
await ui.OpenAsync(new Uri(demo.Address, "/impostazioni/esportazione?veste=desktop"));
|
|
await ui.WaitAsync($"({General}).endsWith('Disco USB') && !({General}).startsWith('/esporta')", "la cartella generale in Windows");
|
|
Assert.IsFalse((await ui.EvalAsync("[...document.querySelectorAll('.avviso')].some((a) => a.textContent.includes('sottocartelle di'))")).GetBoolean(), "nessuna nota di Docker");
|
|
}
|
|
|
|
[TestMethod]
|
|
public async Task TheDestinationDialogChecksTheFolderAndPreviewsNames()
|
|
{
|
|
await using var ui = await UiBrowser.StartAsync(1440, 900);
|
|
using var temp = new TempFolder("esporta-dialogo-ui");
|
|
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
|
|
|
|
await ui.OpenAsync(new Uri(demo.Address, "/impostazioni/esportazione?veste=docker"));
|
|
await ui.WaitAsync($"({General}) !== ''", "la cartella generale");
|
|
Assert.IsTrue((await ui.EvalAsync(ClickText(".cartella-impostazioni", "button", "Modifica"))).GetBoolean());
|
|
const string Dialog = "document.querySelector('.dialogo.destinazione')";
|
|
await ui.WaitAsync($"{Dialog}?.querySelector('.sfoglia-voce') && /liberi/.test({Dialog}.querySelector('.controllo-cartella').textContent)", "il dialogo con le cartelle di /esporta e il controllo");
|
|
CollectionAssert.IsSubsetOf(
|
|
new[] { "Chiavetta", "Disco USB", "Studio Lumen" },
|
|
await ui.EvalAsync<string[]>($"[...{Dialog}.querySelectorAll('.sfoglia-voce')].map((b) => b.textContent.trim())"));
|
|
Assert.AreEqual("Disco USB", (await ui.EvalAsync($"{Dialog}.querySelector('.sfoglia-voce[aria-pressed=true]').textContent.trim()")).GetString(), "la cartella di adesso è scelta");
|
|
|
|
// Another folder: the check follows it.
|
|
await ui.EvalAsync($"[...{Dialog}.querySelectorAll('.sfoglia-voce')].find((b) => b.textContent.trim() === 'Chiavetta').click()");
|
|
await ui.WaitAsync($"{Dialog}.querySelector('.controllo-cartella').textContent.includes('/esporta/Chiavetta')", "il controllo della cartella scelta");
|
|
|
|
// «Uno schema suo»: the three schemes of the library to start from, and the tree follows what is typed.
|
|
await ui.EvalAsync($"{Dialog}.querySelector('input[value=suo]').click()");
|
|
await ui.WaitAsync($"!{Dialog}.querySelector('.schemi-copie').hidden", "gli schemi");
|
|
Assert.IsTrue((await ui.EvalAsync($"[...{Dialog}.querySelectorAll('.schemi-copie input')].every((i) => i.value.includes('{{account}}'))")).GetBoolean(), "gli schemi partono da quelli della libreria");
|
|
var before = (await ui.EvalAsync($"{Dialog}.querySelector('.albero').textContent")).GetString();
|
|
await ui.EvalAsync($"(() => {{ const i = {Dialog}.querySelector('#schema-copie'); i.value = '{{account}}/{{anno}}/{{codice}}_{{n}}'; i.dispatchEvent(new Event('input', {{ bubbles: true }})); }})()");
|
|
await ui.WaitAsync($"{Dialog}.querySelector('.albero').textContent !== {Js(before!)} && {Dialog}.querySelector('.albero').textContent.startsWith('Chiavetta')", "l'anteprima dei nomi nella cartella scelta");
|
|
StringAssert.Contains((await ui.EvalAsync($"{Dialog}.querySelector('.albero').textContent")).GetString(), "marta.demo / 2026");
|
|
|
|
// No type: nothing to save.
|
|
await ui.EvalAsync($"{Dialog}.querySelectorAll('.tipi input:checked').forEach((i) => i.click())");
|
|
await ui.WaitAsync($"!{Dialog}.querySelector('.errore-testo').hidden", "«Scegli almeno un tipo.»");
|
|
Assert.IsTrue((await ui.EvalAsync($"[...{Dialog}.querySelectorAll('footer button')].find((b) => b.textContent.includes('Salva')).disabled")).GetBoolean());
|
|
|
|
// «Annulla» keeps the folder of before.
|
|
await ui.EvalAsync($"[...{Dialog}.querySelectorAll('footer button')].find((b) => b.textContent === 'Annulla').click()");
|
|
await ui.WaitAsync($"{Dialog} === null", "il dialogo si chiude");
|
|
Assert.AreEqual("/esporta/Disco USB", (await ui.EvalAsync(General)).GetString());
|
|
}
|
|
|
|
[TestMethod]
|
|
public async Task TheAccountBlockSwitchActsAtOnce()
|
|
{
|
|
await using var ui = await UiBrowser.StartAsync(1440, 900);
|
|
using var temp = new TempFolder("esporta-account-ui");
|
|
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
|
|
|
|
await ui.OpenAsync(new Uri(demo.Address, "/account"));
|
|
await ui.WaitAsync("document.querySelector('a[href^=\"/account/\"]') !== null", "elenco degli account");
|
|
var id = (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, $"/account/{id}/impostazioni"));
|
|
const string Block = "document.querySelector('.copie-esterne')";
|
|
await ui.WaitAsync($"{Block}?.querySelector('.conteggio-copie') != null", "il blocco «Copie esterne»");
|
|
Assert.IsTrue((await ui.EvalAsync($"{Block}.querySelector('input[role=switch]').checked")).GetBoolean(), "«Esporta questo account» acceso");
|
|
StringAssert.Contains((await ui.EvalAsync($"{Block}.textContent")).GetString(), "Nella cartella generale");
|
|
StringAssert.Contains((await ui.EvalAsync($"{Block}.querySelector('.conteggio-copie').textContent")).GetString(), "non ancora copiati");
|
|
|
|
// Off: at once, without «Salva», the server knows it and the block says what it means.
|
|
await ui.EvalAsync($"{Block}.querySelector('input[role=switch]').click()");
|
|
await ui.WaitAsync($"{Block}.textContent.includes('Questo account non si esporta')", "il blocco spento");
|
|
await ui.WaitAsync($"fetch('/api/accounts/{id}').then((r) => r.json()).then((j) => j.export.enabled === false)", "spento sul server");
|
|
await ui.WaitAsync("[...document.querySelectorAll('.brevi .breve')].some((b) => b.textContent.includes('non si copia più'))", "l'avviso breve");
|
|
Assert.IsFalse((await ui.EvalAsync($"[...{Block}.querySelectorAll('button')].some((b) => b.textContent.includes('Copia in'))")).GetBoolean(), "niente «Copia in…» da spento");
|
|
|
|
// On again.
|
|
await ui.EvalAsync($"{Block}.querySelector('input[role=switch]').click()");
|
|
await ui.WaitAsync($"{Block}.querySelector('.conteggio-copie')?.textContent.includes('non ancora copiati') && {Block}.querySelector('input[role=switch]').checked", "di nuovo acceso");
|
|
await ui.WaitAsync($"fetch('/api/accounts/{id}').then((r) => r.json()).then((j) => j.export.enabled === true)", "acceso sul server");
|
|
}
|
|
|
|
[TestMethod]
|
|
public async Task CopyInFromTheSelectionShowsTheSummaryAndStarts()
|
|
{
|
|
await using var ui = await UiBrowser.StartAsync(1440, 900);
|
|
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.
|
|
await ui.OpenAsync(new Uri(demo.Address, "/libreria"));
|
|
await ui.WaitAsync("document.querySelectorAll('.mosaico .tess').length >= 3", "il mosaico");
|
|
Assert.IsTrue((await ui.EvalAsync(ClickText(".strumenti", ".btn", "Seleziona"))).GetBoolean());
|
|
await ui.EvalAsync("[...document.querySelectorAll('.mosaico .tess')].slice(0, 3).forEach((t) => t.click())");
|
|
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()");
|
|
|
|
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.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());
|
|
|
|
await ui.EvalAsync($"{Dialog}.querySelector('footer .btn.primo').click()");
|
|
await ui.WaitAsync($"{Dialog} === null", "il dialogo si chiude");
|
|
await ui.WaitAsync("document.querySelector('.brevi .breve a.breve-link') !== null", "l'avviso breve con il collegamento");
|
|
Assert.AreEqual("/dashboard/esportazione", (await ui.EvalAsync("new URL(document.querySelector('.brevi .breve a.breve-link').href).pathname")).GetString());
|
|
|
|
// 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());
|
|
}
|
|
|
|
[TestMethod]
|
|
public async Task TheCopiesFilterIsRememberedInTheAddressAndTheTilesShowTheCopiedMark()
|
|
{
|
|
await using var ui = await UiBrowser.StartAsync(1440, 900);
|
|
using var temp = new TempFolder("esporta-filtro-ui");
|
|
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
|
|
|
|
// «Copiati» from the address: the button says it, every tile has the mark.
|
|
await ui.OpenAsync(new Uri(demo.Address, "/libreria?copie=copiati"));
|
|
await ui.WaitAsync($"({CopiesButton}) && document.querySelectorAll('.mosaico .tess').length > 0", "la Libreria con «Copiati»");
|
|
Assert.AreEqual("Copiati", (await ui.EvalAsync($"({CopiesButton}).textContent.trim()")).GetString());
|
|
Assert.IsTrue((await ui.EvalAsync($"({CopiesButton}).classList.contains('attivo')")).GetBoolean());
|
|
Assert.IsTrue((await ui.EvalAsync("[...document.querySelectorAll('.mosaico .tess')].every((t) => t.querySelector('.segno span.copia:not(.parte)') !== null)")).GetBoolean(), "il segno «copiato» su ogni tessera " + ui.Report());
|
|
Assert.AreEqual("copia", (await ui.EvalAsync("document.querySelector('.mosaico .tess .segno').lastElementChild.className")).GetString(), "il segno sta per ultimo");
|
|
|
|
// The menu of the filter: «Tolti o superati» goes to the address and stays after a reload.
|
|
await ui.EvalAsync($"({CopiesButton}).click()");
|
|
await ui.WaitAsync($"({LastMenu})?.querySelectorAll('[role=menuitemradio]').length === 4", "il menu delle copie");
|
|
CollectionAssert.AreEqual(
|
|
new[] { "Tutti", "Non ancora copiati", "Copiati", "Tolti o superati" },
|
|
await ui.EvalAsync<string[]>($"[...({LastMenu}).querySelectorAll('[role=menuitemradio]')].map((b) => b.textContent.trim())"));
|
|
await ui.EvalAsync($"[...({LastMenu}).querySelectorAll('[role=menuitemradio]')].find((b) => b.textContent.trim() === 'Tolti o superati').click()");
|
|
await ui.WaitAsync("new URLSearchParams(location.search).get('copie') === 'tolti'", "«copie=tolti» nell'indirizzo");
|
|
await ui.OpenAsync(new Uri(demo.Address, "/libreria?copie=tolti"));
|
|
await ui.WaitAsync($"({CopiesButton})?.textContent.trim() === 'Tolti o superati'", "il filtro dopo il ricaricamento");
|
|
await ui.WaitAsync("document.querySelectorAll('.mosaico .tess').length > 0", "le tessere dei tolti o superati");
|
|
|
|
// The CSV icon is a menu: the list, and «Copia i file in…» of what the filter shows.
|
|
await ui.EvalAsync("document.querySelector('.strumenti button[aria-label=Esporta]').click()");
|
|
await ui.WaitAsync($"({LastMenu})?.querySelectorAll('[role=menuitem]').length === 2", "il menu dell'icona CSV");
|
|
CollectionAssert.AreEqual(
|
|
new[] { "Esporta l'elenco (CSV)", "Copia i file in…" },
|
|
await ui.EvalAsync<string[]>($"[...({LastMenu}).querySelectorAll('[role=menuitem]')].map((b) => b.textContent.trim())"));
|
|
await ui.EvalAsync($"[...({LastMenu}).querySelectorAll('[role=menuitem]')].find((b) => b.textContent.includes('Copia i file')).click()");
|
|
await ui.WaitAsync("document.querySelector('.dialogo.copia-in .di-nuovo input') != null", "«Copia in…» del filtro, con «Copia di nuovo anche…»");
|
|
Assert.IsFalse((await ui.EvalAsync("document.querySelector('.dialogo.copia-in .di-nuovo input').checked")).GetBoolean(), "«Copia di nuovo» spento");
|
|
StringAssert.Contains((await ui.EvalAsync("document.querySelector('.dialogo.copia-in .di-nuovo').textContent")).GetString(), "Copia di nuovo anche i");
|
|
await ui.EvalAsync("[...document.querySelectorAll('.dialogo.copia-in footer button')].find((b) => b.textContent === 'Annulla').click()");
|
|
await ui.WaitAsync("document.querySelector('.dialogo.copia-in') === null", "il dialogo si chiude");
|
|
|
|
// «Tutti» takes the filter out of the address.
|
|
await ui.EvalAsync($"({CopiesButton}).click()");
|
|
await ui.WaitAsync($"({LastMenu})?.querySelectorAll('[role=menuitemradio]').length === 4", "il menu delle copie");
|
|
await ui.EvalAsync($"[...({LastMenu}).querySelectorAll('[role=menuitemradio]')].find((b) => b.textContent.trim() === 'Tutti').click()");
|
|
await ui.WaitAsync("!new URLSearchParams(location.search).has('copie')", "nessun filtro nell'indirizzo");
|
|
Assert.AreEqual("Copie", (await ui.EvalAsync($"({CopiesButton}).textContent.trim()")).GetString());
|
|
}
|
|
|
|
[TestMethod]
|
|
public async Task TheViewerShowsCopyRowsWithCopyAgain()
|
|
{
|
|
await using var ui = await UiBrowser.StartAsync(1440, 900);
|
|
using var temp = new TempFolder("esporta-visualizzatore-ui");
|
|
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
|
|
|
|
// «Tutte le foto» with «Tolti o superati»: every tile is a file whose copy was removed or superseded.
|
|
await ui.OpenAsync(new Uri(demo.Address, "/libreria?copie=tolti"));
|
|
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()");
|
|
|
|
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()!;
|
|
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");
|
|
|
|
// «Copia di nuovo»: the job starts, with its toast, and the file is copied again (no longer «tolto o superato»).
|
|
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.WaitAsync("document.querySelector('.brevi .breve a.breve-link') !== null", "l'avviso breve del lavoro");
|
|
StringAssert.Contains((await ui.EvalAsync("document.querySelector('.brevi .breve').textContent")).GetString(), "Copia avviata");
|
|
await ui.WaitAsync($"({Replaced}).then((n) => n < {before})", "il file copiato di nuovo");
|
|
await ui.EvalAsync("document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))");
|
|
await ui.WaitAsync("document.querySelector('.vis') === null", "Esc chiude");
|
|
}
|
|
|
|
[TestMethod]
|
|
public async Task TheDashboardExportTabShowsProgressAndResume()
|
|
{
|
|
await using var ui = await UiBrowser.StartAsync(1440, 900);
|
|
using var temp = new TempFolder("esporta-dashboard-ui");
|
|
await using var demo = await DemoHost.StartAsync(new DemoOptions(0, TestZones.Rome, temp.Path));
|
|
|
|
// The engine tab says there is a copy to resume and leads to the export tab.
|
|
await ui.OpenAsync(new Uri(demo.Address, "/dashboard"));
|
|
const string Notice = "[...document.querySelectorAll('.avviso')].find((a) => a.textContent.includes('da riprendere'))";
|
|
await ui.WaitAsync($"({Notice}) !== undefined", "l'avviso della copia da riprendere");
|
|
CollectionAssert.AreEqual(new[] { "Motore", "Esportazione" }, await ui.EvalAsync<string[]>("[...document.querySelectorAll('.linguette-dashboard a')].map((a) => a.textContent)"));
|
|
await ui.EvalAsync($"({Notice}).querySelector('a').click()");
|
|
|
|
await ui.WaitAsync("location.pathname === '/dashboard/esportazione' && document.querySelector('.esportazione-dashboard .riga-riprendi') !== null", "la linguetta «Esportazione»");
|
|
Assert.AreEqual("Esportazione", (await ui.EvalAsync("document.querySelector('.linguette-dashboard a.qui').textContent")).GetString());
|
|
CollectionAssert.AreEqual(new[] { "In corso", "Da riprendere", "Ultimi lavori" }, await ui.EvalAsync<string[]>("[...document.querySelectorAll('.esportazione-dashboard h2')].map((x) => x.textContent)"));
|
|
StringAssert.Contains((await ui.EvalAsync("document.querySelector('.copia-in-corso').textContent")).GetString(), "Nessuna copia al lavoro");
|
|
StringAssert.Contains((await ui.EvalAsync("document.querySelector('.riga-riprendi').textContent")).GetString(), "interrotta");
|
|
|
|
// «Resoconto» of the last job.
|
|
await ui.EvalAsync("[...document.querySelectorAll('.esportazione-dashboard .elenco-attivita li')][0].querySelector('button').click()");
|
|
await ui.WaitAsync("document.querySelector('.dialogo.resoconto-copia') !== null", "il resoconto");
|
|
StringAssert.StartsWith((await ui.EvalAsync("document.querySelector('.dialogo.resoconto-copia h2').textContent")).GetString(), "Resoconto");
|
|
StringAssert.Contains((await ui.EvalAsync("document.querySelector('.dialogo.resoconto-copia').textContent")).GetString(), "Per account");
|
|
await ui.EvalAsync("document.querySelector('.dialogo.resoconto-copia header button').click()");
|
|
await ui.WaitAsync("document.querySelector('.dialogo.resoconto-copia') === null", "il resoconto si chiude");
|
|
|
|
// «Riprendi»: the job goes on (the demo copies at once) and leaves «Da riprendere».
|
|
Assert.IsTrue((await ui.EvalAsync(ClickText(".riga-riprendi", "button", "Riprendi"))).GetBoolean());
|
|
await ui.WaitAsync("[...document.querySelectorAll('.brevi .breve')].some((b) => b.textContent.includes('ripresa'))", "«Copia ripresa»");
|
|
await ui.WaitAsync("document.querySelector('.esportazione-dashboard .riga-riprendi') === null", "niente più da riprendere " + ui.Report());
|
|
}
|
|
}
|