From b2b6af8f265bd347cfc8a03ea41982daa2ea60a0 Mon Sep 17 00:00:00 2001 From: Olive Vaughn Date: Sat, 10 Oct 2026 18:28:03 -0400 Subject: [PATCH] Bring the browser tests up to date - automation: pin the fixture to 120 frames; a blank document is 48 now, and the drags measure frames as fractions of a 120-frame ruler. - lane: create from the timeline's symbol/lane buttons, skip the palette lane when looking for lanes and rename buttons, and expect a lane's rename on its symbol. - lane, peg: wait out the page reloading under the first probes. Co-Authored-By: Claude Opus 5.5 --- frontend/test/browser/automation.mjs | 4 ++- frontend/test/browser/lane.mjs | 40 +++++++++++++++------------- frontend/test/browser/peg.mjs | 4 ++- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/frontend/test/browser/automation.mjs b/frontend/test/browser/automation.mjs index b5f5e7a..a748c4d 100644 --- a/frontend/test/browser/automation.mjs +++ b/frontend/test/browser/automation.mjs @@ -78,7 +78,9 @@ try { await evaluate(`(() => { const k = cljs.core.keyword, v = cljs.core.vector, m = cljs.core.hash_map; - let c = arthur.domain.clip.blank(); + // The drags below measure frames as fractions of a 120-frame ruler, so the + // ruler is pinned rather than left to the blank document's length. + let c = cljs.core.assoc_in(arthur.domain.clip.blank(), v(k('symbols'), k('main'), k('frames')), 120); const rect = (id, at, keys) => m(k('id'), k(id), k('kind'), k('rect'), k('z'), id, k('time'), m(k('at'), at, k('rate'), 1), k('span'), v(0, 20), k('channels'), keys ? m(v(k('xform'), k('pos')), arthur.domain.channel.keyed(m(2, v(2,0), 4, v(4,0)), k('linear'))) : m()); diff --git a/frontend/test/browser/lane.mjs b/frontend/test/browser/lane.mjs index 6f7b32a..29b2fab 100644 --- a/frontend/test/browser/lane.mjs +++ b/frontend/test/browser/lane.mjs @@ -58,7 +58,11 @@ try { await send('Runtime.enable'); for (let i = 0; i < 100; i++) { - if (await evaluate('typeof arthur !== "undefined" && !!document.querySelector("canvas.stage")')) break; + try { + if (await evaluate('typeof arthur !== "undefined" && !!document.querySelector("canvas.stage")')) break; + } catch (error) { + if (!error.message.includes("Cannot find default execution context")) throw error; + } await sleep(100); } await evaluate(`(() => { @@ -78,21 +82,16 @@ try { await evaluate(`(() => { document.querySelectorAll('.menu-scrim').forEach(x => x.click()); return true })()`); await sleep(80); }; + // Creation is two buttons in the timeline's toolbar: a symbol, or a lane. const clickNew = async label => { await closeMenus(); assert(await evaluate(`(() => { - const menu = document.querySelector('.loc .menu-wrap > button'); - if (!menu) return false; - menu.click(); return true; - })()`), 'new menu exists'); - await sleep(100); - assert(await evaluate(`(() => { - const item = [...document.querySelectorAll('.menu-item')].find(${named(label)}); - if (!item || item.disabled) return false; - item.click(); return true; + const button = [...document.querySelectorAll('.creation-controls button')] + .find(b => b.textContent.trim() === ${JSON.stringify(label)}); + if (!button || button.disabled) return false; + button.click(); return true; })()`), `enabled creation command: ${label}`); await sleep(220); - await closeMenus(); }; const shot = async () => JSON.parse(JSON.stringify(await evaluate('laneSnapshot()'), (_key, value) => value?.uuid ?? value)); @@ -111,7 +110,7 @@ try { assert.equal((await shot()).clip.symbols.main.display, undefined, 'a blank document starts as an ordinary symbol'); - await clickNew('inside'); + await clickNew('symbol'); let s = await shot(); let placed = mainInstances(s); assert.equal(placed.length, 1, 'new symbol places one instance'); @@ -130,12 +129,12 @@ try { placed = mainInstances(s); assert.equal(placed.length, 2, 'explicit lane places a second symbol'); assert.equal(laneSymbols(s).length, 1, 'only the lane command marks a symbol as a lane'); - assert.equal(await evaluate('[...document.querySelectorAll(".tl-track")].filter(t => t.arthurLane).length'), 1, + assert.equal(await evaluate('[...document.querySelectorAll(".tl-track:not(.palette)")].filter(t => t.arthurLane).length'), 1, 'the explicit lane is drawn as one linear track'); - assert.equal(await evaluate('document.querySelectorAll(".tl-rename").length'), 1, + assert.equal(await evaluate('document.querySelectorAll(".tl-label:not(.palette) .tl-rename").length'), 1, 'the lane exposes its rename control'); - await evaluate('document.querySelector(".tl-rename").click()'); + await evaluate('document.querySelector(".tl-label:not(.palette) .tl-rename").click()'); await sleep(80); assert(await evaluate(`(() => { const input = document.querySelector('.tl-name-input'); @@ -147,13 +146,16 @@ try { })()`), 'lane rename editor opens'); await sleep(180); s = await shot(); - assert(mainInstances(s).some(n => n.name === 'Foreground'), 'lane name persists'); + // A lane is an instance, and an instance is called what it places: the + // rename lands on the lane's symbol, not on the placement. + assert(laneSymbols(s).some(sym => sym.name === 'Foreground'), 'lane name persists on its symbol'); + assert(!mainInstances(s).some(n => n.name), 'and the placement carries no name of its own'); // Drag a library symbol into the explicit lane. The row itself is the target; // no temporary lane is previewed or created. const drop = await evaluate(`(() => { const source = document.querySelector('.pool-row:not(.main) .pool-item[draggable="true"]'); - const track = [...document.querySelectorAll('.tl-track')].find(t => t.arthurLane); + const track = [...document.querySelectorAll('.tl-track:not(.palette)')].find(t => t.arthurLane); if (!source || !track) return null; source.scrollIntoView({block: 'center'}); const a = source.getBoundingClientRect(), b = track.getBoundingClientRect(); @@ -192,7 +194,7 @@ try { s = await shot(); assert.equal(laneSymbols(s).length, 2, 'a second explicit command creates a second lane'); const move = await evaluate(`(() => { - const tracks = [...document.querySelectorAll('.tl-track')].filter(t => t.arthurLane); + const tracks = [...document.querySelectorAll('.tl-track:not(.palette)')].filter(t => t.arthurLane); const from = tracks.find(t => t.querySelector('.tl-cel')); const to = tracks.find(t => t !== from); const cel = from?.querySelector('.tl-cel'); @@ -218,7 +220,7 @@ try { await evaluate(`re_frame.core.dispatch_sync(cljs.core.vector( cljs.core.keyword('arthur.events.project/new'))) `); await sleep(250); - await clickNew('inside'); + await clickNew('symbol'); const clipboardBaseline = (await shot()).clip; await shortcut('d', 'KeyD'); assert.equal(mainInstances(await shot()).length, 2, 'duplicate copies the selected instance'); diff --git a/frontend/test/browser/peg.mjs b/frontend/test/browser/peg.mjs index 8d30c02..cb44973 100644 --- a/frontend/test/browser/peg.mjs +++ b/frontend/test/browser/peg.mjs @@ -62,7 +62,9 @@ try { await send('Runtime.enable'); await send('Page.enable'); for (let i = 0; i < 160; i++) { - if (await evalJS('return !!(window.cljs && window.re_frame && window.arthur)')) break; + // The page can reload under the first probes, which then have no context + // to run in; that is not the page being broken, so wait it out. + try { if (await evalJS('return !!(window.cljs && window.re_frame && window.arthur)')) break; } catch {} await sleep(250); }