Files
pipelines/app/test/features/chat/ui/sessions/expand_closed.dart
T

22 lines
834 B
Dart

import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
/// Closed chats start folded away; opens that section when it is shown.
Future<void> expandClosedChats(WidgetTester tester) async {
final section = find.byKey(const ValueKey('chat-section-Closed'));
if (section.evaluate().isEmpty) {
await tester.scrollUntilVisible(
section,
200,
scrollable: find.byType(Scrollable).first,
);
}
final heading = find.descendant(of: section, matching: find.text('Closed'));
// Centred rather than at the top edge: the list scrolls behind a floating
// bar, which would take a tap at the edge.
await Scrollable.ensureVisible(tester.element(heading.first), alignment: 0.5);
await tester.pumpAndSettle();
await tester.tap(heading.first);
await tester.pumpAndSettle();
}