From e35855f47227cb9aaf235e8e4e39b18aff9c8c59 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Sat, 28 Mar 2026 23:50:08 -0400 Subject: [PATCH] fixed wobble timing condition to be slow enough for headless firefox to catch it --- src/functional_tests/test_room_tray.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/functional_tests/test_room_tray.py b/src/functional_tests/test_room_tray.py index 496755c..1058617 100644 --- a/src/functional_tests/test_room_tray.py +++ b/src/functional_tests/test_room_tray.py @@ -104,12 +104,29 @@ class TrayTest(FunctionalTest): tray = self.browser.find_element(By.ID, "id_tray") self.assertFalse(tray.is_displayed()) - # Clicking the closed btn adds a wobble class to the wrap + # Clicking the closed btn adds a wobble class to the wrap. + # Use a MutationObserver to capture the transient class change — in CI + # headless Firefox the 0.45s animation may complete before the first + # wait_for poll (0.5s), causing a false miss. + self.browser.execute_script(""" + window._trayWobbled = false; + var wrap = document.getElementById('id_tray_wrap'); + var obs = new MutationObserver(function(muts) { + muts.forEach(function(m) { + if (m.type === 'attributes' && m.attributeName === 'class') { + if (m.target.classList.contains('wobble')) { + window._trayWobbled = true; + obs.disconnect(); + } + } + }); + }); + obs.observe(wrap, {attributes: true, attributeFilter: ['class']}); + """) self.browser.find_element(By.ID, "id_tray_btn").click() self.wait_for( - lambda: self.assertIn( - "wobble", - self.browser.find_element(By.ID, "id_tray_wrap").get_attribute("class"), + lambda: self.assertTrue( + self.browser.execute_script("return window._trayWobbled;") ) ) # Tray still not visible — a click alone must not open it