@noego/wood 0.4.8 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/axe.js +313 -98
- package/bin/wood.js +7 -1
- package/dist/automation/actions.cjs +17 -0
- package/dist/automation/actions.cjs.map +1 -0
- package/dist/automation/actions.d.cts +57 -0
- package/dist/automation/actions.d.ts +57 -0
- package/dist/automation/actions.js +1 -0
- package/dist/automation/actions.js.map +1 -0
- package/dist/automation/actions_executor.cjs +101 -0
- package/dist/automation/actions_executor.cjs.map +1 -0
- package/dist/automation/actions_executor.d.cts +16 -0
- package/dist/automation/actions_executor.d.ts +16 -0
- package/dist/automation/actions_executor.js +76 -0
- package/dist/automation/actions_executor.js.map +1 -0
- package/dist/automation/connection.cjs +86 -0
- package/dist/automation/connection.cjs.map +1 -0
- package/dist/automation/connection.d.cts +18 -0
- package/dist/automation/connection.d.ts +18 -0
- package/dist/automation/connection.js +51 -0
- package/dist/automation/connection.js.map +1 -0
- package/dist/automation/errors.cjs +50 -0
- package/dist/automation/errors.cjs.map +1 -0
- package/dist/automation/errors.d.cts +31 -0
- package/dist/automation/errors.d.ts +31 -0
- package/dist/automation/errors.js +24 -0
- package/dist/automation/errors.js.map +1 -0
- package/dist/automation/index.cjs +49 -0
- package/dist/automation/index.cjs.map +1 -0
- package/dist/automation/index.d.cts +16 -0
- package/dist/automation/index.d.ts +16 -0
- package/dist/automation/index.js +15 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/introspection_reader.cjs +75 -0
- package/dist/automation/introspection_reader.cjs.map +1 -0
- package/dist/automation/introspection_reader.d.cts +20 -0
- package/dist/automation/introspection_reader.d.ts +20 -0
- package/dist/automation/introspection_reader.js +48 -0
- package/dist/automation/introspection_reader.js.map +1 -0
- package/dist/automation/locator.cjs +102 -0
- package/dist/automation/locator.cjs.map +1 -0
- package/dist/automation/locator.d.cts +51 -0
- package/dist/automation/locator.d.ts +51 -0
- package/dist/automation/locator.js +75 -0
- package/dist/automation/locator.js.map +1 -0
- package/dist/automation/observation.cjs +17 -0
- package/dist/automation/observation.cjs.map +1 -0
- package/dist/automation/observation.d.cts +44 -0
- package/dist/automation/observation.d.ts +44 -0
- package/dist/automation/observation.js +1 -0
- package/dist/automation/observation.js.map +1 -0
- package/dist/automation/receipts.cjs +17 -0
- package/dist/automation/receipts.cjs.map +1 -0
- package/dist/automation/receipts.d.cts +27 -0
- package/dist/automation/receipts.d.ts +27 -0
- package/dist/automation/receipts.js +1 -0
- package/dist/automation/receipts.js.map +1 -0
- package/dist/automation/scenario.cjs +696 -0
- package/dist/automation/scenario.cjs.map +1 -0
- package/dist/automation/scenario.d.cts +89 -0
- package/dist/automation/scenario.d.ts +89 -0
- package/dist/automation/scenario.js +660 -0
- package/dist/automation/scenario.js.map +1 -0
- package/dist/automation/scrolling.cjs +17 -0
- package/dist/automation/scrolling.cjs.map +1 -0
- package/dist/automation/scrolling.d.cts +51 -0
- package/dist/automation/scrolling.d.ts +51 -0
- package/dist/automation/scrolling.js +1 -0
- package/dist/automation/scrolling.js.map +1 -0
- package/dist/automation/scrolling_executor.cjs +109 -0
- package/dist/automation/scrolling_executor.cjs.map +1 -0
- package/dist/automation/scrolling_executor.d.cts +13 -0
- package/dist/automation/scrolling_executor.d.ts +13 -0
- package/dist/automation/scrolling_executor.js +84 -0
- package/dist/automation/scrolling_executor.js.map +1 -0
- package/dist/automation/target_identity.cjs +17 -0
- package/dist/automation/target_identity.cjs.map +1 -0
- package/dist/automation/target_identity.d.cts +28 -0
- package/dist/automation/target_identity.d.ts +28 -0
- package/dist/automation/target_identity.js +1 -0
- package/dist/automation/target_identity.js.map +1 -0
- package/dist/automation/target_registry.cjs +148 -0
- package/dist/automation/target_registry.cjs.map +1 -0
- package/dist/automation/target_registry.d.cts +32 -0
- package/dist/automation/target_registry.d.ts +32 -0
- package/dist/automation/target_registry.js +122 -0
- package/dist/automation/target_registry.js.map +1 -0
- package/dist/automation/waits.cjs +17 -0
- package/dist/automation/waits.cjs.map +1 -0
- package/dist/automation/waits.d.cts +44 -0
- package/dist/automation/waits.d.ts +44 -0
- package/dist/automation/waits.js +1 -0
- package/dist/automation/waits.js.map +1 -0
- package/dist/automation/waits_executor.cjs +104 -0
- package/dist/automation/waits_executor.cjs.map +1 -0
- package/dist/automation/waits_executor.d.cts +14 -0
- package/dist/automation/waits_executor.d.ts +14 -0
- package/dist/automation/waits_executor.js +79 -0
- package/dist/automation/waits_executor.js.map +1 -0
- package/dist/client/index.d.cts +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/codegen/renderer_app_generator.cjs +16 -1
- package/dist/codegen/renderer_app_generator.cjs.map +1 -1
- package/dist/codegen/renderer_app_generator.js +16 -1
- package/dist/codegen/renderer_app_generator.js.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/navigation/automation_introspection.cjs +110 -0
- package/dist/navigation/automation_introspection.cjs.map +1 -0
- package/dist/navigation/automation_introspection.d.cts +60 -0
- package/dist/navigation/automation_introspection.d.ts +60 -0
- package/dist/navigation/automation_introspection.js +85 -0
- package/dist/navigation/automation_introspection.js.map +1 -0
- package/dist/navigation/index.cjs +7 -2
- package/dist/navigation/index.cjs.map +1 -1
- package/dist/navigation/index.d.cts +2 -0
- package/dist/navigation/index.d.ts +2 -0
- package/dist/navigation/index.js +4 -1
- package/dist/navigation/index.js.map +1 -1
- package/dist/testing/automation_assertions.cjs +417 -0
- package/dist/testing/automation_assertions.cjs.map +1 -0
- package/dist/testing/automation_assertions.d.cts +44 -0
- package/dist/testing/automation_assertions.d.ts +44 -0
- package/dist/testing/automation_assertions.js +385 -0
- package/dist/testing/automation_assertions.js.map +1 -0
- package/dist/testing/browser.cjs +26 -34
- package/dist/testing/browser.cjs.map +1 -1
- package/dist/testing/browser.d.cts +2 -1
- package/dist/testing/browser.d.ts +2 -1
- package/dist/testing/browser.js +30 -31
- package/dist/testing/browser.js.map +1 -1
- package/dist/testing/create_controller_harness.d.cts +1 -0
- package/dist/testing/create_controller_harness.d.ts +1 -0
- package/dist/testing/geometry.cjs +109 -0
- package/dist/testing/geometry.cjs.map +1 -0
- package/dist/testing/geometry.d.cts +45 -0
- package/dist/testing/geometry.d.ts +45 -0
- package/dist/testing/geometry.js +79 -0
- package/dist/testing/geometry.js.map +1 -0
- package/dist/testing/index.cjs +31 -2
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +4 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +31 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/tracing/trace_hub.cjs +3 -0
- package/dist/tracing/trace_hub.cjs.map +1 -1
- package/dist/tracing/trace_hub.js +3 -0
- package/dist/tracing/trace_hub.js.map +1 -1
- package/package.json +7 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { c as TraceLevel } from '../trace_hub-Cob54qRx.cjs';
|
|
2
2
|
import { TraceRecorder } from '../trace-testing/trace_recorder.cjs';
|
|
3
3
|
import { WoodRpcTransport } from '../transport/wood_rpc_transport.cjs';
|
|
4
|
+
import { RectAxis } from './geometry.cjs';
|
|
4
5
|
import 'rxjs';
|
|
5
6
|
import '@noego/trace/testing';
|
|
6
7
|
import '../tracing/trace_provider.cjs';
|
|
@@ -156,7 +157,7 @@ interface WoodRectSnapshot {
|
|
|
156
157
|
height: number;
|
|
157
158
|
}
|
|
158
159
|
/** Axis along which edge-to-edge spacing is measured. */
|
|
159
|
-
type WoodSpacingAxis =
|
|
160
|
+
type WoodSpacingAxis = RectAxis;
|
|
160
161
|
/**
|
|
161
162
|
* Description of the top-most element painted at a hit-test point, plus its
|
|
162
163
|
* relationship to the queried target. `document.elementFromPoint` honours
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { c as TraceLevel } from '../trace_hub-Cob54qRx.js';
|
|
2
2
|
import { TraceRecorder } from '../trace-testing/trace_recorder.js';
|
|
3
3
|
import { WoodRpcTransport } from '../transport/wood_rpc_transport.js';
|
|
4
|
+
import { RectAxis } from './geometry.js';
|
|
4
5
|
import 'rxjs';
|
|
5
6
|
import '@noego/trace/testing';
|
|
6
7
|
import '../tracing/trace_provider.js';
|
|
@@ -156,7 +157,7 @@ interface WoodRectSnapshot {
|
|
|
156
157
|
height: number;
|
|
157
158
|
}
|
|
158
159
|
/** Axis along which edge-to-edge spacing is measured. */
|
|
159
|
-
type WoodSpacingAxis =
|
|
160
|
+
type WoodSpacingAxis = RectAxis;
|
|
160
161
|
/**
|
|
161
162
|
* Description of the top-most element painted at a hit-test point, plus its
|
|
162
163
|
* relationship to the queried target. `document.elementFromPoint` honours
|
package/dist/testing/browser.js
CHANGED
|
@@ -7,6 +7,14 @@ import {
|
|
|
7
7
|
dispatchRendererTracePayload
|
|
8
8
|
} from "../tracing/index.js";
|
|
9
9
|
import { TraceRecorder } from "../trace-testing/index.js";
|
|
10
|
+
import {
|
|
11
|
+
axisEdges,
|
|
12
|
+
axisGap,
|
|
13
|
+
evenSpacing as evenSpacingRects,
|
|
14
|
+
rectsOverlap,
|
|
15
|
+
sharedEdges as sharedRectEdges,
|
|
16
|
+
snapshotRectsOverlap
|
|
17
|
+
} from "./geometry.js";
|
|
10
18
|
const DEFAULT_VIEWPORT = {
|
|
11
19
|
width: 1280,
|
|
12
20
|
height: 800
|
|
@@ -776,15 +784,6 @@ function collectMaxPaintOrders(snapshot) {
|
|
|
776
784
|
}
|
|
777
785
|
return paintByBackend;
|
|
778
786
|
}
|
|
779
|
-
function axisEdges(rect, axis) {
|
|
780
|
-
return axis === "horizontal" ? { leading: rect.left, trailing: rect.right } : { leading: rect.top, trailing: rect.bottom };
|
|
781
|
-
}
|
|
782
|
-
function axisGap(first, second, axis) {
|
|
783
|
-
const a = axisEdges(first, axis);
|
|
784
|
-
const b = axisEdges(second, axis);
|
|
785
|
-
const [earlier, later] = a.leading <= b.leading ? [a, b] : [b, a];
|
|
786
|
-
return later.leading - earlier.trailing;
|
|
787
|
-
}
|
|
788
787
|
function describeGapConstraint(constraint) {
|
|
789
788
|
const parts = [];
|
|
790
789
|
if (constraint.equals !== void 0) parts.push(`equals ${constraint.equals}`);
|
|
@@ -804,11 +803,6 @@ function gapConstraintViolation(gap, constraint, tolerance) {
|
|
|
804
803
|
}
|
|
805
804
|
return null;
|
|
806
805
|
}
|
|
807
|
-
function rectsOverlap(a, b) {
|
|
808
|
-
return Boolean(
|
|
809
|
-
a && b && a.left < b.right && a.right > b.left && a.top < b.bottom && a.bottom > b.top
|
|
810
|
-
);
|
|
811
|
-
}
|
|
812
806
|
const COVERAGE_STYLE_KEYS = [
|
|
813
807
|
"opacity",
|
|
814
808
|
"visibility",
|
|
@@ -826,9 +820,6 @@ function colorAlphaIsZero(color) {
|
|
|
826
820
|
const parts = match[1].split(",").map((s) => s.trim());
|
|
827
821
|
return parts.length >= 4 && parseFloat(parts[3]) === 0;
|
|
828
822
|
}
|
|
829
|
-
function snapshotRectsOverlap(a, b) {
|
|
830
|
-
return a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y;
|
|
831
|
-
}
|
|
832
823
|
function indexLayoutNodes(doc, strings) {
|
|
833
824
|
const byNode = /* @__PURE__ */ new Map();
|
|
834
825
|
const nodeIndex = doc.layout?.nodeIndex ?? [];
|
|
@@ -1077,8 +1068,7 @@ function createExpect(page, outputDir) {
|
|
|
1077
1068
|
const first = await elementRect(page, firstSelector);
|
|
1078
1069
|
const second = await elementRect(page, secondSelector);
|
|
1079
1070
|
if (!first || !second) throw new Error(`Expected both "${firstSelector}" and "${secondSelector}" to exist.`);
|
|
1080
|
-
|
|
1081
|
-
if (overlaps) {
|
|
1071
|
+
if (rectsOverlap(first, second)) {
|
|
1082
1072
|
throw new Error(`Expected "${firstSelector}" not to overlap "${secondSelector}".`);
|
|
1083
1073
|
}
|
|
1084
1074
|
},
|
|
@@ -1121,8 +1111,9 @@ function createExpect(page, outputDir) {
|
|
|
1121
1111
|
const first = await firstRect(page, a);
|
|
1122
1112
|
const second = await firstRect(page, b);
|
|
1123
1113
|
if (!first || !second) throw new Error(`Expected both "${a}" and "${b}" to exist.`);
|
|
1124
|
-
const
|
|
1125
|
-
if (
|
|
1114
|
+
const verdict = sharedRectEdges([first, second], edge, { tolerance });
|
|
1115
|
+
if (!verdict.pass) {
|
|
1116
|
+
const delta = Number(verdict.details?.maximumDelta);
|
|
1126
1117
|
throw new Error(
|
|
1127
1118
|
`Expected "${a}" and "${b}" to share ${edge} edge within ${tolerance}px, but delta was ${delta.toFixed(2)}px ("${a}".${edge}=${first[edge].toFixed(2)}, "${b}".${edge}=${second[edge].toFixed(2)}). Rects: ${a}=${JSON.stringify(first)}, ${b}=${JSON.stringify(second)}`
|
|
1128
1119
|
);
|
|
@@ -1213,16 +1204,24 @@ function createExpect(page, outputDir) {
|
|
|
1213
1204
|
if (!rect) throw new Error(`Expected "${selector}" to exist.`);
|
|
1214
1205
|
boxes.push({ selector, rect });
|
|
1215
1206
|
}
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1207
|
+
const verdict = evenSpacingRects(
|
|
1208
|
+
boxes.map((box) => box.rect),
|
|
1209
|
+
axis,
|
|
1210
|
+
{ tolerance }
|
|
1211
|
+
);
|
|
1212
|
+
if (!verdict.pass) {
|
|
1213
|
+
const sorted = [...boxes].sort(
|
|
1214
|
+
(x, y) => axisEdges(x.rect, axis).leading - axisEdges(y.rect, axis).leading
|
|
1215
|
+
);
|
|
1216
|
+
const measuredGaps = verdict.details?.gaps;
|
|
1217
|
+
const gaps = sorted.slice(1).map((box, i) => ({
|
|
1218
|
+
from: sorted[i].selector,
|
|
1219
|
+
to: box.selector,
|
|
1220
|
+
gap: measuredGaps[i]
|
|
1221
|
+
}));
|
|
1222
|
+
const widest = gaps.reduce((acc, g) => g.gap > acc.gap ? g : acc);
|
|
1223
|
+
const narrowest = gaps.reduce((acc, g) => g.gap < acc.gap ? g : acc);
|
|
1224
|
+
const spread = Number(verdict.details?.spread);
|
|
1226
1225
|
const list = gaps.map((g) => `${g.from}\u2192${g.to}=${g.gap.toFixed(2)}px`).join(", ");
|
|
1227
1226
|
throw new Error(
|
|
1228
1227
|
`Expected elements to be evenly spaced along ${axis} within ${tolerance}px, but gap spread was ${spread.toFixed(2)}px (widest ${widest.from}\u2192${widest.to}=${widest.gap.toFixed(2)}px, narrowest ${narrowest.from}\u2192${narrowest.to}=${narrowest.gap.toFixed(2)}px). Gaps: ${list}`
|