Skip to content

Commit 838bcb0

Browse files
committed
fix(tests): stabilize stats for all scopes
1 parent f610c3c commit 838bcb0

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

weblate/trans/tests/test_selenium.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,15 @@ def stabilize_global_stats_timestamp(self) -> None:
369369
"""Freeze global stats cache timestamp for activity screenshots."""
370370
self.stabilize_stats_timestamp(GlobalStats())
371371

372-
def refresh_project_stats(self, project: Project) -> None:
373-
"""Refresh project dashboard stats through the normal invalidation path."""
372+
def stabilize_project_stats(self, project: Project) -> None:
373+
"""Rebuild project dashboard stats for reproducible screenshots."""
374374
for component in project.component_set.all():
375-
component.invalidate_cache()
375+
for translation in component.translation_set.all():
376+
self.stabilize_stats_timestamp(translation.stats)
377+
self.stabilize_stats_timestamp(component.stats)
378+
for language_stats in project.stats.get_language_stats():
379+
self.stabilize_stats_timestamp(language_stats)
380+
self.stabilize_stats_timestamp(project.stats)
376381

377382
def use_screenshot_site_domain_for_git_export(self, component: Component) -> None:
378383
"""Store the displayed Git export URL with the screenshot domain."""
@@ -2070,7 +2075,7 @@ def test_explanation(self) -> None:
20702075
def test_dark_theme(self) -> None:
20712076
project = self.create_component()
20722077
self.create_android_component(project)
2073-
self.refresh_project_stats(project)
2078+
self.stabilize_project_stats(project)
20742079
self.do_login()
20752080
self.click(htmlid="user-dropdown")
20762081
with self.wait_for_page_load():

0 commit comments

Comments
 (0)