Skip to content

Commit bf38693

Browse files
committed
compose_box test [nfc]: Pull out sendButtonFinder helper
1 parent 9e27a11 commit bf38693

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
@@ -115,9 +115,11 @@ void main() {
115115
.controller.isNotNull().value.text.equals(expected);
116116
}
117117

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

@@ -690,7 +692,7 @@ void main() {
690692

691693
connection.prepare(json: {});
692694
connection.prepare(json: SendMessageResult(id: 123).toJson());
693-
await tester.tap(find.byIcon(ZulipIcons.send));
695+
await tester.tap(sendButtonFinder);
694696
await tester.pump(Duration.zero);
695697
final requests = connection.takeRequests();
696698
checkSetTypingStatusRequests([requests.first], [(TypingOp.stop, narrow)]);
@@ -854,7 +856,7 @@ void main() {
854856

855857
await enterTopic(tester, narrow: narrow, topic: topicInputText);
856858
await tester.enterText(contentInputFinder, 'test content');
857-
await tester.tap(find.byIcon(ZulipIcons.send));
859+
await tester.tap(sendButtonFinder);
858860
await tester.pump();
859861
}
860862

@@ -911,7 +913,7 @@ void main() {
911913
group('uploads', () {
912914
void checkAppearsLoading(WidgetTester tester, bool expected) {
913915
final sendButtonElement = tester.element(find.ancestor(
914-
of: find.byIcon(ZulipIcons.send),
916+
of: sendButtonFinder,
915917
matching: find.byType(IconButton)));
916918
final sendButtonWidget = sendButtonElement.widget as IconButton;
917919
final designVariables = DesignVariables.of(sendButtonElement);

0 commit comments

Comments
 (0)