1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Add deeplink store sample (#1698)

* Adds deeplink store app

* push

* update md

* update
This commit is contained in:
chunhtai
2023-03-16 09:12:32 -07:00
committed by GitHub
parent db18c98799
commit 481c2e3d1d
134 changed files with 5281 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter_test/flutter_test.dart';
import 'package:deeplink_store_example/main.dart';
import 'package:go_router/go_router.dart';
void main() {
testWidgets('Can open home page', (WidgetTester tester) async {
await tester.pumpWidget(const MyApp());
await tester.pumpAndSettle();
expect(find.text('Material Store'), findsOneWidget);
});
testWidgets('Can open detail page', (WidgetTester tester) async {
await tester.pumpWidget(const MyApp());
await tester.pumpAndSettle();
expect(find.text('Vagabond sack'), findsOneWidget);
await tester.tap(find.text('Vagabond sack'));
await tester.pumpAndSettle();
expect(find.text('Material Store'), findsNothing);
expect(find.text('Vagabond sack'), findsOneWidget);
expect(find.text('\$120'), findsOneWidget);
});
testWidgets('Can show category page', (WidgetTester tester) async {
await tester.pumpWidget(const MyApp());
await tester.pumpAndSettle();
tester.element(find.text('Material Store')).go('/category/home');
await tester.pumpAndSettle();
expect(find.text('Home Decorations'), findsOneWidget);
});
}