Arreglado vision y funcion de zonas a evitar

This commit is contained in:
2026-09-10 08:59:29 +02:00
parent d50333f82a
commit 7f17dfeb2a
8 changed files with 71 additions and 71 deletions

View File

@@ -14,9 +14,10 @@ const path = require("node:path");
await page.goto("http://127.0.0.1:5199", { waitUntil: "domcontentloaded" });
await page.waitForFunction(() => !!window.rt?._dotNetHelper && !!window.__rtLeafletMap);
const initialErrors = errors.slice();
await page.keyboard.press("Control+Shift+KeyZ");
await page.keyboard.press("Control+Shift+KeyE");
await page.locator(".zones-panel").waitFor();
await page.waitForTimeout(1000);
await page.getByRole("button", { name: "Polígono", exact: true }).click();
await page.getByRole("button", { name: "Añadir zona", exact: true }).click();
for (const [x, y] of [[600, 420], [850, 430], [760, 640]]) {
await page.mouse.click(x, y);
@@ -52,7 +53,7 @@ const path = require("node:path");
await page.locator(".zones-panel").waitFor({ state: "detached" });
assert.equal(await page.locator(".rt-exclusion-vertex").count(), 0);
assert.equal(await page.locator('path[stroke="#e879f9"], path[stroke="#f97316"]').count(), 0);
await page.keyboard.press("Control+Shift+KeyZ");
await page.keyboard.press("Control+Shift+KeyE");
await page.locator(".zones-panel").waitFor();
assert.equal(await page.locator(".zones-panel__item").count(), 2, "Reabrir conserva zonas editables");
await page.getByRole("checkbox", { name: "Activar zona", exact: true }).first().uncheck();
@@ -60,7 +61,7 @@ const path = require("node:path");
await page.reload();
await page.waitForFunction(() => !!window.rt?._dotNetHelper && !!window.__rtLeafletMap);
await page.waitForTimeout(1000);
await page.keyboard.press("Control+Shift+KeyZ");
await page.keyboard.press("Control+Shift+KeyE");
await page.locator(".zones-panel__item").first().waitFor();
assert.equal(await page.locator(".zones-panel__item").count(), 2, "F5 conserva zonas");
assert.equal(await page.getByRole("checkbox", { name: "Activar zona", exact: true }).first().isChecked(), false);
@@ -81,6 +82,16 @@ const path = require("node:path");
await page.getByRole("button", { name: "Eliminar zona", exact: true }).first().click();
await page.waitForFunction(() => document.querySelectorAll(".zones-panel__item").length === 1);
assert.equal(await page.locator(".zones-panel__item").count(), 1);
await page.getByRole("button", { name: "Punto", exact: true }).click();
await page.getByRole("button", { name: "Añadir punto", exact: true }).click();
await page.mouse.click(1050, 720);
await page.waitForFunction(() => document.querySelectorAll(".zones-panel__item").length === 2);
assert.match(await page.locator(".zones-panel__item").last().innerText(), /Punto/);
assert.equal(await page.locator(".zones-panel__item").last().innerText().then(text => text.includes("abierta")), false,
"Un clic cierra la exclusion puntual");
const puntoGuardado = await page.evaluate(() => JSON.parse(localStorage.getItem("rutasdbus.zonas.v1")).at(-1));
assert.equal(puntoGuardado.EsPunto, true);
assert.equal(puntoGuardado.Vertices.length, 1, "El punto se guarda con un solo vertice");
await page.getByRole("button", { name: "Borrar todas", exact: true }).click();
await page.waitForFunction(() => document.querySelectorAll(".zones-panel__item").length === 0);
assert.equal(await page.locator(".zones-panel__item").count(), 0);
@@ -88,6 +99,7 @@ const path = require("node:path");
await page.screenshot({ path: path.join(artifacts, "mobile.png") });
const box = await page.locator(".zones-panel").boundingBox();
assert.ok(box.x >= 0 && box.x + box.width <= 390 && box.y + box.height <= 844, "Panel dentro del movil");
await page.getByRole("button", { name: "Polígono", exact: true }).click();
await page.getByRole("button", { name: "Añadir zona", exact: true }).click();
await page.getByRole("button", { name: "Cerrar herramienta", exact: true }).click();
await page.setViewportSize({ width: 1440, height: 1000 });
@@ -99,7 +111,7 @@ const path = require("node:path");
const newErrors = errors.filter(error => !initialErrors.includes(error) && !externalErrors.includes(error));
assert.equal(newErrors.length, 0, newErrors.join("\n"));
if (externalErrors.length) console.log("Aviso del complemento externo de geocodificacion: " + externalErrors[0]);
console.log("OK multiples zonas, arrastre en vivo, cierre, reapertura, borrado, alturas de botones y movil");
console.log("OK poligonos y puntos, arrastre en vivo, cierre, reapertura, borrado, alturas de botones y movil");
} finally {
await browser.close();
}