Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(tests): retry swallowed thumbnail click in virtual background dialog (#17548)

Дамян Минков639f900edc8d
diff --git a/tests/pageobjects/VirtualBackgroundDialog.ts b/tests/pageobjects/VirtualBackgroundDialog.ts
index 7e286e133b..9372e47585 100644
--- a/tests/pageobjects/VirtualBackgroundDialog.ts
+++ b/tests/pageobjects/VirtualBackgroundDialog.ts
@@ -39,14 +39,32 @@ export default class VirtualBackgroundDialog extends BaseDialog {
const el = this.participant.driver.$(selector);
await el.waitForClickable({ timeout: 3000, timeoutMsg: `${label} thumbnail not clickable` });
- await el.click();
- // The preview applies the selected effect on every change, which loads the segmentation
- // model/wasm and saturates the main thread. During rapid switching this can delay the
- // aria-checked re-render by several seconds, so allow a generous timeout here.
+ // Selecting an effect makes the preview (re)load the segmentation model/wasm, which
+ // saturates the main thread. Two flaky failure modes follow from that:
+ // 1. A click issued while React is mid-reconciliation (e.g. during rapid switching) is
+ // dropped — the onClick handler never fires and the thumbnail never becomes checked.
+ // 2. The first selection of a blur effect triggers a cold model/worker init that blocks
+ // the main thread for several seconds, delaying the aria-checked re-render (and the
+ // attribute reads themselves) well past a short timeout.
+ // Re-issue the click on every poll until aria-checked confirms it landed (covers 1), and
+ // allow a generous timeout for the cold-start re-render under load (covers 2). The poll
+ // interval is kept large so a still-pending selection is not needlessly re-triggered.
await this.participant.driver.waitUntil(
- async () => (await el.getAttribute('aria-checked')) === 'true',
- { timeout: 5000, timeoutMsg: `${label} thumbnail did not become checked after click` }
+ async () => {
+ if (await el.getAttribute('aria-checked') === 'true') {
+ return true;
+ }
+
+ await el.click();
+
+ return false;
+ },
+ {
+ timeout: 15000,
+ interval: 1500,
+ timeoutMsg: `${label} thumbnail did not become checked after click`
+ }
);
}