Company
Date Published
Author
Filip Hric
Word count
678
Language
-
Hacker News points
None

Summary

Over the past six months, efforts have been made to reduce test failures and flakes for Metabase, revealing various unique debugging cases. One such case involved a pagination table where a React component's use of Math.round led to inconsistent test results, showing either 7 or 8 elements due to a slight 2-pixel height difference between passing and failing tests. This discrepancy was traced back to a rounding error in calculating the currentPageSize, which determined how many items were displayed per page. The issue arose because the Math.floor function consistently rounded down, causing unexpected behavior when minor changes shifted the table's height. A potential fix involves using Math.round or adjusting the test to accept both outcomes. This case study highlights the significant impact of minor changes in modern end-to-end testing and underscores the efficacy of Replay in simplifying debugging by allowing developers to trace value changes over time, making it possible to aim for zero test flakes.