Skip to content

Commit 593f538

Browse files
committed
test: Fix new action-sheet tests
Like 38ed6c8, but for some tests that were still in PR-flight at the time and so didn't get that treatment.
1 parent 9a06553 commit 593f538

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/widgets/action_sheet_test.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,19 @@ void main() {
238238
TestZulipBinding.instance.reset();
239239
});
240240

241+
Future<void> tapCopyButton(WidgetTester tester) async {
242+
await tester.ensureVisible(find.byIcon(Icons.copy, skipOffstage: false));
243+
await tester.tap(find.byIcon(Icons.copy));
244+
await tester.pump(); // [MenuItemButton.onPressed] called in a post-frame callback: flutter/flutter@e4a39fa2e
245+
}
246+
241247
testWidgets('success', (WidgetTester tester) async {
242248
final message = eg.streamMessage();
243249
await setupToMessageActionSheet(tester, message: message, narrow: TopicNarrow.ofMessage(message));
244250
final store = await TestZulipBinding.instance.globalStore.perAccount(eg.selfAccount.id);
245251

246-
await tester.ensureVisible(find.byIcon(Icons.copy, skipOffstage: false));
247252
prepareRawContentResponseSuccess(store, message: message, rawContent: 'Hello world');
248-
await tester.tap(find.byIcon(Icons.copy));
253+
await tapCopyButton(tester);
249254
await tester.pump(Duration.zero);
250255
check(await Clipboard.getData('text/plain')).isNotNull().text.equals('Hello world');
251256
});
@@ -255,9 +260,8 @@ void main() {
255260
await setupToMessageActionSheet(tester, message: message, narrow: TopicNarrow.ofMessage(message));
256261
final store = await TestZulipBinding.instance.globalStore.perAccount(eg.selfAccount.id);
257262

258-
await tester.ensureVisible(find.byIcon(Icons.copy, skipOffstage: false));
259263
prepareRawContentResponseError(store);
260-
await tester.tap(find.byIcon(Icons.copy));
264+
await tapCopyButton(tester);
261265
await tester.pump(Duration.zero); // error arrives; error dialog shows
262266

263267
await tester.tap(find.byWidget(checkErrorDialog(tester,

0 commit comments

Comments
 (0)