Files
DOSSIER/e2e/railing291.spec.ts
Claude 4505761ac4 [291] Geländer: Aufbau je Feld (Pfosten, Handlauf-Profil/-Höhe, Zwischenholme, Füllung je Feld) und Bindung an Treppenwange/Deckenkante
Achse im Kern abgeleitet (railing::path): Treppe = Handlauf-Achse der Wange, Fuss lotrecht unter dem Handlauf,
Teile geschert (Piece.slope); Deckenkante = Kantenzug nach innen versetzt auf Decken-OK. Gebundene Treppenseite
ohne eigenen Treppen-Handlauf (railing::stair_code). Grundriss an der Schnitthöhe geteilt, Schnitt/Ansicht/3D/
Schatten/IFC aus denselben Prismen. Befehl gelaender mit Option an Treppe/Kante, Objekt-Info-Felder, Lösen,
keine Griffe für gebundene Geländer. Bestehende Geländer unverändert (Goldens gleich).
2026-11-19 09:33:44 +00:00

67 lines
3.4 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.
// [291] Geländer an der Treppe: im Musterhaus mit „gelaender“ und der Option „an Treppe/Kante“ auf die Treppe ST1 klicken
// (Kern bindet an die nächste Wange), das Geländer im Plan wählen, Bindung und Felder in der Objekt-Info sehen,
// Pfostenabstand ändern, rückgängig machen und lösen.
import type { Page } from "@playwright/test";
import { blurFocus, commandInput, expect, openSample, openTab, startNewProject, test, typeCommand } from "./app";
async function clickModel(page: Page, x: number, y: number): Promise<void> {
const p = await page.locator("svg.plan-svg").first().evaluate(
(el, [x, y]) => {
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 + (x * 90 - ox - vx) * s, y: r.top + (r.height - vh * s) / 2 + (-y * 90 - oy - vy) * s };
},
[x, y],
);
await page.mouse.click(p.x, p.y);
}
test("Geländer an Treppe binden, Felder ändern, lösen", async ({ page }) => {
test.setTimeout(90_000);
await startNewProject(page);
await openSample(page);
await openTab(page, "Objekt-Info");
await commandInput(page).focus();
await typeCommand(page, "gelaender");
const bind = page.locator(".cmdline-option").filter({ hasText: "an Treppe/Kante" });
await bind.click();
await expect(page.locator(".cmdline-prompt")).toHaveText("Treppe (Wange) oder Deckenkante anklicken:");
await commandInput(page).focus();
// Treppe ST1: x 3.2–4.2, Lauf in +y; der Klick nahe x = 3.3 trifft die linke Wange.
await typeCommand(page, "3.3,1.2");
await blurFocus(page);
// Option zurücksetzen (gilt über Aufrufe hinweg), damit spätere Befehle frei zeichnen.
await commandInput(page).focus();
await typeCommand(page, "gelaender");
await page.locator(".cmdline-option").filter({ hasText: "an Treppe/Kante" }).click();
await page.keyboard.press("Escape");
await blurFocus(page);
const objInfo = page.locator(".objinfo-panel").first();
await expect(async () => {
await page.keyboard.press("Escape");
// Achse auf der Wange unter der Schnitthöhe (Pick-Fläche um die Achse).
await clickModel(page, 3.24, 1.0);
await expect(page.getByTestId("railing-bound")).toBeVisible({ timeout: 1000 });
}).toPass({ timeout: 30_000 });
await expect(page.getByTestId("railing-bound")).toHaveText("ST1");
const fields = page.getByTestId("railing-fields");
const before = Number(await fields.textContent());
expect(before).toBeGreaterThan(0);
const spacing = objInfo.locator("label.objinfo-field").filter({ has: page.locator(".objinfo-flabel", { hasText: /^Pfostenabstand \(max\.\)$/ }) }).locator("input");
await spacing.fill("0.5");
await spacing.press("Enter");
await expect(async () => expect(Number(await fields.textContent())).toBeGreaterThan(before)).toPass({ timeout: 10_000 });
await blurFocus(page);
await page.keyboard.press("ControlOrMeta+z");
await expect(fields).toHaveText(String(before));
// Lösen: die Achse bleibt als freie Polylinie, die Bindung ist weg.
await page.getByTestId("railing-unbind").click();
await expect(page.getByTestId("railing-bound")).toBeHidden();
await expect(page.getByTestId("railing-length")).toBeVisible();
});