How nightly Meastro test prevented accessibility bug
We have few Maestro tests for our flutter app. Since they are E2E and might not be reliable we are only running them nightly as opposed to other unit and integration tests that run on every MR.
I got a notify from our nightly run that these tests fail instead of brushing it off as flaky test, I looked through the logs and screen recordings. And there isn't any noticeable change but it was a consistent repro.
So, I fired up Maestro studio and behold I see this wonky string "Banking\nBanking" in the label. In the test we just search for "Banking"
This is how it is supposed to look like.
Turns out, there was change in the bottom nav icons and it was wrapped in a semantics widget. By default this widget merges the child widgets labels.
Code that caused the error
return Semantics(
label: item.label,
child: ConstrainedBox(
So, we excluded the semantics behaviour for the purposes of label
return Semantics(
excludeSemantics: true,
button: true,
child: ConstrainedBox....
...
And now the tests pass again!
ps: Another way this could be fixed is adding the property explicitChildNodes=true to semantics widget and the previous label would have retained.
Let this post serve up as a reminder for next time to debug the root cause before marking a test as flaky