Skip to content

Commit f8af659

Browse files
committed
compose_box test [nfc]: Pull out sendButtonFinder helper
1 parent c3a03fd commit f8af659

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/widgets/compose_box_test.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ void main() {
117117
.controller.isNotNull().value.text.equals(expected);
118118
}
119119

120+
final sendButtonFinder = find.byIcon(ZulipIcons.send);
121+
120122
Future<void> tapSendButton(WidgetTester tester) async {
121123
connection.prepare(json: SendMessageResult(id: 123).toJson());
122-
await tester.tap(find.byIcon(ZulipIcons.send));
124+
await tester.tap(sendButtonFinder);
123125
await tester.pump(Duration.zero);
124126
}
125127

@@ -618,7 +620,7 @@ void main() {
618620

619621
connection.prepare(json: {});
620622
connection.prepare(json: SendMessageResult(id: 123).toJson());
621-
await tester.tap(find.byIcon(ZulipIcons.send));
623+
await tester.tap(sendButtonFinder);
622624
await tester.pump(Duration.zero);
623625
final requests = connection.takeRequests();
624626
checkSetTypingStatusRequests([requests.first], [(TypingOp.stop, narrow)]);
@@ -782,7 +784,7 @@ void main() {
782784

783785
await enterTopic(tester, narrow: narrow, topic: topicInputText);
784786
await tester.enterText(contentInputFinder, 'test content');
785-
await tester.tap(find.byIcon(ZulipIcons.send));
787+
await tester.tap(sendButtonFinder);
786788
await tester.pump();
787789
}
788790

@@ -839,7 +841,7 @@ void main() {
839841
group('uploads', () {
840842
void checkAppearsLoading(WidgetTester tester, bool expected) {
841843
final sendButtonElement = tester.element(find.ancestor(
842-
of: find.byIcon(ZulipIcons.send),
844+
of: sendButtonFinder,
843845
matching: find.byType(IconButton)));
844846
final sendButtonWidget = sendButtonElement.widget as IconButton;
845847
final designVariables = DesignVariables.of(sendButtonElement);

0 commit comments

Comments
 (0)