Add test for scaffold_state.show_bottom_sheet.0.dart (#152731)

Contributes to https://github.com/flutter/flutter/issues/130459

It adds a test for
- `examples/api/lib/material/scaffold/scaffold_state.show_bottom_sheet.0.dart`
This commit is contained in:
Valentin Vignal
2024-08-02 22:40:09 +08:00
committed by GitHub
parent a1a3b2ce3c
commit 8818e60a65
2 changed files with 26 additions and 1 deletions

View File

@@ -320,7 +320,6 @@ final Set<String> _knownMissingTests = <String>{
'examples/api/test/material/platform_menu_bar/platform_menu_bar.0_test.dart',
'examples/api/test/material/flexible_space_bar/flexible_space_bar.0_test.dart',
'examples/api/test/material/selection_area/selection_area.0_test.dart',
'examples/api/test/material/scaffold/scaffold_state.show_bottom_sheet.0_test.dart',
'examples/api/test/material/scaffold/scaffold_messenger_state.show_material_banner.0_test.dart',
'examples/api/test/material/scaffold/scaffold_messenger_state.show_snack_bar.0_test.dart',
'examples/api/test/material/app_bar/sliver_app_bar.2_test.dart',

View File

@@ -0,0 +1,26 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/material/scaffold/scaffold_state.show_bottom_sheet.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('The button should show a bottom sheet when pressed', (WidgetTester tester) async {
await tester.pumpWidget(
const example.ShowBottomSheetExampleApp(),
);
expect(find.widgetWithText(AppBar, 'ScaffoldState Sample'), findsOne);
await tester.tap(find.widgetWithText(ElevatedButton, 'showBottomSheet'));
await tester.pumpAndSettle();
expect(find.widgetWithText(BottomSheet, 'BottomSheet'), findsOne);
await tester.tap(find.widgetWithText(ElevatedButton, 'Close BottomSheet'));
await tester.pumpAndSettle();
expect(find.widgetWithText(BottomSheet, 'BottomSheet'), findsNothing);
});
}