fix: refresh public dashboard and BI telemetry

This commit is contained in:
Wyndham ARR
2026-08-03 16:08:14 +08:00
parent 2107f00e32
commit 5294edab89
20 changed files with 584 additions and 75 deletions

View File

@@ -79,6 +79,22 @@ class ChannelBiVisualStaticContractTests(unittest.TestCase):
self.assertIn(".chart-data-range", self.desktop_styles)
self.assertIn(".card-title .data-range", self.mobile_styles)
def test_bi_uses_five_second_updated_at_refresh_without_reloading_every_poll(self) -> None:
self.assertIn("const BI_POLL_INTERVAL = 5000", self.desktop_script)
self.assertIn("const BI_POLL_INTERVAL = 5000", self.mobile_script)
self.assertIn('api("/api/months")', self.desktop_script)
self.assertIn('api("/api/public/h5/months")', self.mobile_script)
self.assertIn("metadata.updated_at !== current.updated_at", self.desktop_script)
self.assertIn("metadata.updated_at !== lastData.updated_at", self.mobile_script)
self.assertIn("loadAnalytics(false, Boolean(current))", self.desktop_script)
self.assertIn("load(false, Boolean(lastData))", self.mobile_script)
self.assertIn("function checkBiFreshness", self.desktop_script)
self.assertIn("function checkBiFreshness", self.mobile_script)
self.assertIn("clearBiPoll()", self.desktop_script)
self.assertIn("clearBiPoll()", self.mobile_script)
self.assertIn("document.hidden", self.desktop_script)
self.assertIn("document.hidden", self.mobile_script)
if __name__ == "__main__":
unittest.main(verbosity=2)