diff --git a/tools/e2e/47-vectorart.mjs b/tools/e2e/47-vectorart.mjs index 061bd4a5..426efb4b 100644 --- a/tools/e2e/47-vectorart.mjs +++ b/tools/e2e/47-vectorart.mjs @@ -832,23 +832,35 @@ export async function vectorArt(t) { const halvesName = await json( `__gm.state.project.assets.find((a) => a.id === ${JSON.stringify(halves?.id ?? '')})?.name ?? null`, ); - const halvesEntry = halvesName && (await inOverlay(halvesName)); - if (halvesEntry) await click(halvesEntry.x, halvesEntry.y); - else await press('Escape'); + // Picked through the search box: after the earlier modules the list holds 30-odd pictures, and + // an entry below the fold of the capped menu cannot be clicked. Enter takes the first match; a + // click would hit the typed name in the search box first. + if (halvesName) { + await typeText(halvesName); + await settle(); + } + const filteredOffers = (await json('__gm.menuRows()')) ?? []; + const halvesEntry = Boolean(halvesName) && filteredOffers.includes(halvesName); + await press(halvesEntry ? 'Enter' : 'Escape'); await settle(); + // The picture loads asynchronously and the shape keeps its plain fill until it is there. In the + // full run the tab then waits for the next redraw instead of drawing when the picture lands + // (#196), so the check asks for that redraw itself. Remove the preview() with #196. await sleep(300); + await evaluate('__gm.state.preview()'); + await settle(); const tiled = (await sky())?.paint; const leftHalf = await tabPixel(60, 100); const rightHalf = await tabPixel(196, 100); check( 'Texture offers the uploaded pictures but no drawing, and fills the shape with the one picked', - Boolean(halvesEntry) && + halvesEntry && !pictureOffers.includes('Emblem') && tiled?.type === 'texture' && tiled.texture === halves?.id && colourDistance(leftHalf, HALVES_LEFT) < 20 && colourDistance(rightHalf, HALVES_RIGHT) < 20, - JSON.stringify({ pictureOffers, tiled, leftHalf, rightHalf }), + JSON.stringify({ filteredOffers, tiled, leftHalf, rightHalf }), ); const tileCorner = await screenAt(228, 228); diff --git a/tools/e2e/lib/pictures.mjs b/tools/e2e/lib/pictures.mjs index 0e782dc2..5f95a36a 100644 --- a/tools/e2e/lib/pictures.mjs +++ b/tools/e2e/lib/pictures.mjs @@ -14,6 +14,10 @@ export const PASTE_HALVES = `(async () => { export const HALVES_LEFT = '#e63c3c'; export const HALVES_RIGHT = '#3cc85a'; -/** The pasted picture's asset, once the paste has landed. */ +/** + * The pasted picture's asset, once the paste has landed: the newest one named after the pasted + * file. Size alone is not enough – in the full run a module before 47 leaves a 32 px "wedge" + * behind, and taking the first 32 px texture picked that one (CI task 217). + */ export const FIND_HALVES = - "__gm.state.project.assets.filter((a) => a.type === 'texture' && a.width === 32 && a.height === 32).map((a) => ({ id: a.id, file: a.file }))[0] ?? null"; + "__gm.state.project.assets.filter((a) => a.type === 'texture' && a.name === 'halves' && a.width === 32 && a.height === 32).map((a) => ({ id: a.id, file: a.file })).at(-1) ?? null";