Skip to content

Commit 61bb0ce

Browse files
committed
action_sheet test: Silence a noisy warning in an upcoming new test
We're about to add a test that renders a poll-style message, and we'd get this warning on that.
1 parent b4e2568 commit 61bb0ce

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/widgets/action_sheet_test.dart

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,21 @@ Future<void> setupToMessageActionSheet(WidgetTester tester, {
7979
// global store, per-account store, and message list get loaded
8080
await tester.pumpAndSettle();
8181

82-
// request the message action sheet
83-
await tester.longPress(find.byType(MessageContent));
82+
// Request the message action sheet.
83+
//
84+
// We use `warnIfMissed: false` to suppress warnings in cases where
85+
// MessageContent itself didn't hit-test as true but the action sheet still
86+
// opened. The action sheet still opens because the gesture handler is an
87+
// ancestor of MessageContent, but MessageContent might not hit-test as true
88+
// because its render box effectively has HitTestBehavior.deferToChild, and
89+
// the long-press might land on a child such that it doesn't hit-test as true,
90+
// like if it's in padding around a Paragraph.
91+
await tester.longPress(find.byType(MessageContent), warnIfMissed: false);
8492
// sheet appears onscreen; default duration of bottom-sheet enter animation
8593
await tester.pump(const Duration(milliseconds: 250));
94+
// Check the action sheet did in fact open, so we don't defeat any tests that
95+
// use simple `find.byIcon`-style checks to test presence/absence of a button.
96+
check(find.byType(BottomSheet)).findsOne();
8697
}
8798

8899
void main() {

0 commit comments

Comments
 (0)