test: стабилизировать проверку угла magnet лестницы (#663)

Issue: #663
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-09-27 02:12:56 +03:00
parent 8176f1190f
commit 8852207b18
+5 -1
View File
@@ -60,6 +60,10 @@ const out = await page.evaluate(async () => {
const activeSpace = () => root().querySelector('[data-hp="space-tab"][aria-current="page"]')
?.getAttribute('data-id');
const closeTo = (a, b, tolerance = 1e-5) => Math.abs(a - b) <= tolerance;
const axisAngleDistance = (angle) => {
const normalized = ((angle % 180) + 180) % 180;
return Math.min(normalized, 180 - normalized);
};
const result = {};
await hp.setServerConfig((config) => {
@@ -84,7 +88,7 @@ const out = await page.evaluate(async () => {
result.straightCreatedOnlyOnCurrentFloor = !!straight && stairs('garden').length === 0;
result.wallMagnetUsesPhysicalFace = !!straight
&& closeTo(Math.abs(straight.y * 1000 - 600), straight.width * 500 + (20 / 5) * (1000 / 240) / 2, 2)
&& closeTo(((straight.angle % 180) + 180) % 180, 0);
&& closeTo(axisAngleDistance(straight.angle), 0);
result.spiralToolExists = await chooseStair('spiral');
await clickPlan([580, 650]);