Wait for the layout in the Find width test

The documentFind smoke test failed about 1 run in 6 with "Find spans the
document pane". It read two widths in separate steps while the outline
closed after a resize. The app did not change.

- The test waits for the outline to close.
- The test reads both widths in one task.
This commit is contained in:
Knotty Wyvern
2026-11-04 21:41:21 -07:00
parent bfb549fd02
commit f37d48fe7a
+5 -3
View File
@@ -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` });