Files
DOSSIER/e2e/stairU.spec.ts
Claude e2952538a3 [151] Handlauf im Grundriss, Kropfstück an Podesten, Mittellauf-Versatz (midOffset), e2e U-Treppe
Handlauf-Achse für alle Treppenformen mit Geländer aus einer Quelle (stair_rail.rs) für Grundriss und
3D/IFC: 4 cm innen, unter der Bruchhöhe ausgezogen, darüber gestrichelt, ab 1:50/fein Doppellinie,
0.1 mm. Kropfstück statt Sprung an der Podestkante (einen Auftritt weit, ausgerundet). U mit
Mittellauf: Feld midOffset (Modell, Kern, kernel2d, Objekt-Info, IFC-Import). Goldens Musterhaus
komplex (Grundrisse, 3D) nachgeführt.
2026-11-07 13:41:30 +00:00

77 lines
3.5 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// [151] U-Treppe: mit dem Befehl setzen (Grundform-Zyklus), Treppenauge am Griff „Ende letzter Lauf“
// quer aufziehen, Rückgängig stellt das Auge wieder her. Geprüft über das Objekt-Info (Feld Treppenauge).
import { blurFocus, commandInput, expect, openTab, startNewProject, test, typeCommand } from "./app";
import type { Page } from "@playwright/test";
/** Modellpunkt (m) → Client-Pixel (wie `grid.spec.ts::screenOf`). */
async function screenOf(page: Page, x: number, y: number): Promise<{ x: number; y: number }> {
return page.locator("svg.plan-svg").evaluate(
(el, [mx, my]) => {
const [vx, vy, vw, vh] = el.getAttribute("viewBox")!.split(/\s+/).map(Number);
const ox = Number(el.getAttribute("data-origin-x") ?? 0);
const oy = Number(el.getAttribute("data-origin-y") ?? 0);
const r = el.getBoundingClientRect();
const s = Math.min(r.width / vw, r.height / vh);
return {
x: r.left + (r.width - vw * s) / 2 + (mx * 90 - ox - vx) * s,
y: r.top + (r.height - vh * s) / 2 + (-my * 90 - oy - vy) * s,
};
},
[x, y],
);
}
/** Wert eines Objekt-Info-Felds (Beschriftung exakt). */
function field(page: Page, label: string) {
return page.locator(".objinfo-field").filter({ has: page.getByText(label, { exact: true }) }).locator("input");
}
test("U-Treppe setzen, Auge per Griff ändern, Rückgängig ([151])", async ({ page }) => {
await startNewProject(page);
await openTab(page, "Elemente");
await commandInput(page).focus();
await typeCommand(page, "treppe");
await expect(page.locator(".cmdline-prompt")).toHaveText(/Startpunkt der Treppe/);
// Grundform: gerade → L → U
const shape = page.locator(".cmdline-option").filter({ hasText: "Grundform" });
await shape.dispatchEvent("mousedown");
await shape.dispatchEvent("mousedown");
await expect(shape).toContainText("=U");
await commandInput(page).focus();
await typeCommand(page, "0,0");
// Lauf 1 nach +y, 3 m; Gegenlauf links daneben (Auge 0.1, Breite 1.0 → Achse bei x = −1.1)
await typeCommand(page, "0,3");
await blurFocus(page);
await page.keyboard.press("Escape");
await page.getByTitle("Auf Plan einpassen").click();
// Treppe wählen (Klick auf Lauf 1) → Objekt-Info zeigt U-Treppe mit Auge 0.100
const onRun = await screenOf(page, 0, 1.5);
await page.mouse.click(onRun.x, onRun.y);
await openTab(page, "Objekt-Info");
const gap = field(page, "Treppenauge");
await expect(gap).toHaveValue("0.100");
// Griff „Ende letzter Lauf“ (Mitte der Austrittskante, x = −1.1, y = 0) quer nach x = −1.4 ziehen: Auge ≈ 0.4
await expect.poll(() => page.locator(".plan-grip").count()).toBeGreaterThan(2);
const from = await screenOf(page, -1.1, 0);
const to = await screenOf(page, -1.4, 0);
await page.mouse.move(from.x, from.y);
await page.mouse.down();
await page.mouse.move((from.x + to.x) / 2, from.y, { steps: 4 });
await page.mouse.move(to.x, to.y, { steps: 4 });
await page.mouse.up();
await page.mouse.click(to.x, to.y);
// (Fang kann den Zielpunkt um einige cm verschieben: Auge deutlich grösser, um 0.4)
await expect.poll(async () => Number(await gap.inputValue())).toBeGreaterThan(0.25);
expect(Number(await gap.inputValue())).toBeLessThan(0.5);
// Rückgängig (der Griff-Zug kann je nach Last in zwei Schritten ankommen): bis das alte Auge wieder steht.
await blurFocus(page);
for (let i = 0; i < 3 && (await gap.inputValue()) !== "0.100"; i++) {
await page.keyboard.press("ControlOrMeta+z");
await page.waitForTimeout(300);
}
await expect(gap).toHaveValue("0.100");
});