Is there a regex matcher in the test package

Issue

I have an element like <span class="percent-complete-bar" style="width: 85%; background: green;"></span> and I want to check if the style attribute contains width: xx%; with a regex like r'width: \d{1,3}%;'

await bar.attributes['style']

returns width: 85%; background: green;

Solution

expect(await bar.attributes['style'], matches(r'width: \d{1,3}%;'));

Answered By – Günter Zöchbauer

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.