Skip to content

Commit

Permalink
Widget test file modified
Browse files Browse the repository at this point in the history
  • Loading branch information
firoz3130 committed Jul 20, 2023
1 parent f56250b commit c70b359
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
// 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/material.dart';
//import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; // Import the Description widget

void main() {
// testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
//await tester.pumpWidget(const MyApp());
// Define a test case for the Description widget
testWidgets('Test Description Widget', (WidgetTester tester) async {
// Build the Description widget and trigger a frame.
// await tester.pumpWidget(
// MaterialApp(
// home: Description(
// imageUrl: 'https://firebasestorage.googleapis.com/v0/b/tripiton-fe9c9.appspot.com/o/images%2F1688375048528?alt=media&token=9c8ee7d8-4f61-49b3-ac7a-da274303784c', // Replace with a valid image URL
// placeName: 'Venice', // Replace with a place name for testing
// description: ' Venice is a city in northeastern Italy, in the Veneto region. It is situated on a group of 118 small islands that are separated by canals and linked by bridges. The historic center of Venice is divided into six districts, or sestieri, which are named Cannaregio, Castello, Dorsoduro, San Marco, San Polo, and Santa Croce. Venice is known as the "City of Canals" and is one of the most popular tourist destinations in the world. The city is famous for its beautiful bridges, gondola rides, atmospheric streets, and carnival celebrations. Venice has a long and rich history. The city was founded in the 5th century AD by refugees from the mainland who were fleeing from barbarian invasions. Venice became a major trading power during the Middle Ages and Renaissance, and it was a staging area for the Crusades. The citys decline began in the 18th century, and it was finally annexed by Italy in 1866. Today, Venice is a popular tourist destination, but it is also facing a number of challenges. The city is sinking at an alarming rate, and it is also struggling to cope with the large number of tourists who visit each year.', // Replace with a description for testing
// ),
// ),
// );

// Verify that the widgets you expect are displayed using 'expect' statements.
// For example, you can find the text widget with the description and check if it is present.
expect(find.text('Description text'), findsOneWidget);

// Verify that our counter starts at 0.
// expect(find.text('0'), findsOneWidget);
// expect(find.text('1'), findsNothing);
// You can also find other widgets, like Image widgets, and check if they are displayed.
expect(find.byType(Image), findsOneWidget);

// // Tap the '+' icon and trigger a frame.
// await tester.tap(find.byIcon(Icons.add));
// await tester.pump();
// Test widget interactions if applicable. For example, tap on buttons or icons.
// Here, we can find the home icon button and tap it.
await tester.tap(find.byIcon(Icons.home));
await tester.pump();

// // Verify that our counter has incremented.
// expect(find.text('0'), findsNothing);
// expect(find.text('1'), findsOneWidget);
// });
// Verify the result of the interaction.
// For example, you can check if the navigation to the home page was successful.
expect(find.text('Home Page'),
findsOneWidget); // Replace 'Home Page' with a text that should appear on the home page.
});
}

0 comments on commit c70b359

Please sign in to comment.