diff --git a/tests/smoke/find/documentFind.smoke.mjs b/tests/smoke/find/documentFind.smoke.mjs index 1ab1e25..5d937d3 100644 --- a/tests/smoke/find/documentFind.smoke.mjs +++ b/tests/smoke/find/documentFind.smoke.mjs @@ -33,9 +33,9 @@ await runSmoke("find/documentFind", async ({ page }) => { async function onePanel() { assert.equal(await page.locator('.rs-find-bar:visible').count(), 1); assert.equal(await page.locator('.cm-search').count(), 0, 'No default CodeMirror search panel'); - const bar = await page.locator('.rs-find-bar:visible').boundingBox(); - const pane = await page.locator('.editor.pane-active').boundingBox(); - assert.ok(Math.abs(bar.width - pane.width) < 3, 'Find spans the document pane'); + // Read both widths in one task. Two separate reads can cross a layout change. + const [bar, pane] = await page.locator('.rs-find-bar:visible').evaluate(node => [node, node.closest('.editor.pane-active')].map(element => element.getBoundingClientRect().width)); + assert.ok(Math.abs(bar - pane) < 3, 'Find spans the document pane'); } async function sourceEditor() { await page.waitForFunction(() => !!document.querySelector('.source-editor .cm-content')); @@ -120,6 +120,8 @@ await runSmoke("find/documentFind", async ({ page }) => { await page.keyboard.press('F3'); await page.screenshot({ path: `${output}/source-replace-${theme}.png` }); await page.setViewportSize({ width: 800, height: 700 }); + // The outline closes in the resize event, one frame after the viewport changes. The pane width changes again at that point. + await page.locator('.shell.right-open').waitFor({ state: 'detached' }); await onePanel(); assert.equal(await page.locator('.rs-find-bar').evaluate(node => node.scrollWidth <= node.clientWidth), true); await page.screenshot({ path: `${output}/source-narrow-${theme}.png` });