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 <noreply@anthropic.com>
This commit is contained in:
parent
4b780f9e91
commit
b2b6af8f26
3 changed files with 27 additions and 21 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue