From 773ca6f724aac0e6d82ff6cc83fdad13779f4042 Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Fri, 1 Aug 2025 03:51:40 +0200 Subject: [PATCH] Improve item pane test stability (#5436) --- test/tests/itemPaneTest.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/tests/itemPaneTest.js b/test/tests/itemPaneTest.js index 9544a87678..375cd17df3 100644 --- a/test/tests/itemPaneTest.js +++ b/test/tests/itemPaneTest.js @@ -1,9 +1,10 @@ describe("Item pane", function () { var win, doc, ZoteroPane, Zotero_Tabs, ZoteroContextPane, itemsView; - async function waitForPreviewBoxRender(box) { + async function waitForPreviewBoxRender(box, itemID) { let res = await waitForCallback( - () => box._asyncRenderItemID && !box._asyncRendering, + () => box._asyncRenderItemID && !box._asyncRendering + && (!itemID || box._asyncRenderItemID == itemID), 100, 3); if (res instanceof Error) { throw res; @@ -1292,7 +1293,7 @@ describe("Item pane", function () { await ZoteroPane.selectItem(item.id); await waitForScrollToPane(itemDetails, paneID); - await waitForPreviewBoxRender(attachmentsBox); + await waitForPreviewBoxRender(attachmentsBox, item.id); assert.isTrue(attachmentsBox._preview._isReaderInitialized);