test(renderer): run every Electron suite from one command

The Electron suites were only reachable one npm script at a time, so a new
one was covered by whoever remembered it existed. test:electron:all builds
once and runs all five, reporting a single summary and a non-zero exit.

The runner lives under tests/ rather than app/scripts/, which .gitignore
excludes entirely.

The image row spacing assertion also stops hard-coding the current gap --
it had 0.59px of headroom -- and calibrates against the spacing the rest of
the timeline is using.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
tommy0103
2026-08-03 02:12:38 +08:00
co-authored by Claude Opus 5
parent 5f7f6d7cd5
commit b72e0fcaf3
3 changed files with 48 additions and 2 deletions
+14 -1
View File
@@ -300,6 +300,16 @@ async function run() {
const smallImageRect = smallImage.getBoundingClientRect();
const wideRowRect = wideRow.getBoundingClientRect();
const nextRowRect = nextRow.getBoundingClientRect();
// Row spacing is applied by the virtualizer, not by CSS on the row, so
// calibrate against the spacing the rest of this timeline is using rather
// than hard-coding the current value.
const mountedRows = [...document.querySelectorAll('.virtual-timeline-row')]
.map(row => ({ index: Number(row.dataset.index), rect: row.getBoundingClientRect() }))
.sort((left, right) => left.index - right.index);
const gaps = mountedRows
.slice(1)
.map((row, offset) => row.rect.top - mountedRows[offset].rect.bottom)
.sort((left, right) => left - right);
return {
wrapClientWidth: wrap.clientWidth,
wrapScrollWidth: wrap.scrollWidth,
@@ -312,6 +322,7 @@ async function run() {
smallNaturalWidth: smallImage.naturalWidth,
rowHeight: wideRowRect.height,
rowGap: nextRowRect.top - wideRowRect.bottom,
typicalRowGap: gaps[Math.floor(gaps.length / 2)] ?? null,
brokenText: brokenHost.shadowRoot.querySelector('figcaption')?.textContent || '',
};
})()`, true);
@@ -337,7 +348,9 @@ async function run() {
`small images keep their intrinsic width (${JSON.stringify(layout)})`,
);
assert(
layout.rowHeight > layout.wideImageHeight && layout.rowGap >= 13,
layout.rowHeight > layout.wideImageHeight
&& layout.typicalRowGap !== null
&& Math.abs(layout.rowGap - layout.typicalRowGap) <= 1,
`measured image rows do not overlap the following row (${JSON.stringify(layout)})`,
);
assert(