fixed wobble timing condition to be slow enough for headless firefox to catch it
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user