@@ -38,7 +38,7 @@ Element findElementOfExactWidgetTypeGoingUp(Element node, Type targetType) {
3838
3939final RegExp materialIconAssetNameColorExtractor = new RegExp (r'[^/]+/ic_.+_(white|black)_[0-9]+dp\.png' );
4040
41- void checkIconColor (WidgetTester tester, String label, Color color) {
41+ void checkIconColor (ElementTreeTester tester, String label, Color color) {
4242 // The icon is going to be in the same merged semantics box as the text
4343 // regardless of how the menu item is represented, so this is a good
4444 // way to find the menu item. I hope.
@@ -59,11 +59,11 @@ void main() {
5959 tester.pump (); // triggers a frame
6060
6161 // sanity check
62- expect (tester. findText ('MARKET' ), isNotNull );
63- expect (tester. findText ('Help & Feedback' ), isNull );
62+ expect (tester, hasWidget (find. text ('MARKET' )) );
63+ expect (tester, doesNotHaveWidget (find. text ('Help & Feedback' )) );
6464 tester.pump (new Duration (seconds: 2 ));
65- expect (tester. findText ('MARKET' ), isNotNull );
66- expect (tester. findText ('Help & Feedback' ), isNull );
65+ expect (tester, hasWidget (find. text ('MARKET' )) );
66+ expect (tester, doesNotHaveWidget (find. text ('Help & Feedback' )) );
6767
6868 // drag the drawer out
6969 Point left = new Point (0.0 , ui.window.size.height / 2.0 );
@@ -74,24 +74,24 @@ void main() {
7474 tester.pump ();
7575 gesture.up ();
7676 tester.pump ();
77- expect (tester. findText ('MARKET' ), isNotNull );
78- expect (tester. findText ('Help & Feedback' ), isNotNull );
77+ expect (tester, hasWidget (find. text ('MARKET' )) );
78+ expect (tester, hasWidget (find. text ('Help & Feedback' )) );
7979
8080 // check the colour of the icon - light mode
81- checkIconColor (tester, 'Stock List' , Colors .purple[500 ]); // theme primary color
82- checkIconColor (tester, 'Account Balance' , Colors .black45); // enabled
83- checkIconColor (tester, 'Help & Feedback' , Colors .black26); // disabled
81+ checkIconColor (tester.elementTreeTester , 'Stock List' , Colors .purple[500 ]); // theme primary color
82+ checkIconColor (tester.elementTreeTester , 'Account Balance' , Colors .black45); // enabled
83+ checkIconColor (tester.elementTreeTester , 'Help & Feedback' , Colors .black26); // disabled
8484
8585 // switch to dark mode
86- tester.tap (tester. findText ('Pessimistic' ));
86+ tester.tap (find. text ('Pessimistic' ));
8787 tester.pump (); // get the tap and send the notification that the theme has changed
8888 tester.pump (); // start the theme transition
8989 tester.pump (const Duration (seconds: 5 )); // end the transition
9090
9191 // check the colour of the icon - dark mode
92- checkIconColor (tester, 'Stock List' , Colors .redAccent[200 ]); // theme accent color
93- checkIconColor (tester, 'Account Balance' , Colors .white); // enabled
94- checkIconColor (tester, 'Help & Feedback' , Colors .white30); // disabled
92+ checkIconColor (tester.elementTreeTester , 'Stock List' , Colors .redAccent[200 ]); // theme accent color
93+ checkIconColor (tester.elementTreeTester , 'Account Balance' , Colors .white); // enabled
94+ checkIconColor (tester.elementTreeTester , 'Help & Feedback' , Colors .white30); // disabled
9595
9696 });
9797 });
0 commit comments