Skip to content

Commit

Permalink
Merge branch 'main' into find-a-bus-for-child
Browse files Browse the repository at this point in the history
  • Loading branch information
HasiniSama authored Aug 17, 2024
2 parents e3b4f7c + 6a62875 commit dcc4489
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/lib/screens/login/SignUpDriver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,42 +75,49 @@ class SignUpDriverPage extends StatelessWidget {
const CustomText(text: 'Driver Sign Up', fontSize: 25),
const SizedBox(height: 30),
LabeledFormField(
key: const Key('driverfirstname'),
labelText: 'First Name',
controller: firstNameController,
keyboardType: TextInputType.name,
),
const SizedBox(height: 30),
LabeledFormField(
key: const Key('driverlastname'),
labelText: 'Last Name',
controller: lastNameController,
keyboardType: TextInputType.name,
),
const SizedBox(height: 30),
LabeledFormField(
key: const Key('driveremail'),
labelText: 'Email',
controller: emailController,
keyboardType: TextInputType.emailAddress,
),
const SizedBox(height: 30),
LabeledFormField(
key: const Key('drivernic'),
labelText: 'NIC No.',
controller: nicController,
keyboardType: TextInputType.number,
),
const SizedBox(height: 30),
LabeledFormField(
key: const Key('drivermobile'),
labelText: 'Mobile',
controller: mobileController,
keyboardType: TextInputType.phone,
),
const SizedBox(height: 30),
LabeledFormField(
key: const Key('driverpassword'),
labelText: 'Password',
controller: passController,
keyboardType: TextInputType.visiblePassword,
),
const SizedBox(height: 30),
LabeledFormField(
key: const Key('driverconpassword'),
labelText: 'Confirm Password',
controller: confirmPassController,
keyboardType: TextInputType.visiblePassword,
Expand All @@ -122,6 +129,7 @@ class SignUpDriverPage extends StatelessWidget {
),
const SizedBox(height: 30),
ElevatedButton(
key: const Key('driverbtn'),
style: AppButtonsStyle.blueButtonStyle,
onPressed: () {

Expand Down
1 change: 1 addition & 0 deletions frontend/lib/screens/login/SignUpParent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class SignUpParentPage extends StatelessWidget {
),
const SizedBox(height: 30),
ElevatedButton(
key: const Key('signupparentButton'),
style: AppButtonsStyle.blueButtonStyle,
onPressed: () {
registerNewUser(context);
Expand Down
61 changes: 61 additions & 0 deletions frontend/test/signupdriver_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:safe_ride_mobile/screens/login/SignUpDriver.dart';
import 'package:safe_ride_mobile/widgets/PopUp.dart';

void main() {
testWidgets('validateFormFields returns correct validation messages',
(WidgetTester tester) async {

tester.view.devicePixelRatio = 1;
tester.view.physicalSize = const Size(1200, 1200);

// Build the MaterialApp with LoginPage.
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SignUpDriverPage(),
),
),
);

await tester.pumpAndSettle();

final driverfirstnameFinder = find.byKey(Key('driverfirstname'));
final driverlastnameFinder = find.byKey(Key('driverlastname'));
final driveremailFinder = find.byKey(Key('driveremail'));
final drivernicFinder = find.byKey(Key('drivernic'));
final drivermobileFinder = find.byKey(Key('drivermobile'));
final driverpasswordFinder = find.byKey(Key('driverpassword'));
final driverconpasswordFinder = find.byKey(Key('driverconpassword'));
final driverbtnFinder = find.byKey(Key('driverbtn'));


// Fill in the email and password fields
await tester.tap(driverbtnFinder);
await tester.pumpAndSettle();

expect(find.byType(BottomPopupBar), findsOneWidget);
expect(find.text('All fields are required'), findsOneWidget);

expect(find.text('Ok'), findsOneWidget);
await tester.pumpAndSettle();

// await tester.enterText(emailFieldFinder, '[email protected]');
// await tester.pumpAndSettle();
//
// expect(find.byType(BottomPopupBar), findsOneWidget);
// expect(find.text('All fields are required'), findsOneWidget);
//
// expect(find.text('Ok'), findsOneWidget);
// await tester.pumpAndSettle();
//
// await tester.enterText(emailFieldFinder, '');
// await tester.enterText(passwordFieldFinder, '123456');
// await tester.pumpAndSettle();
//
// expect(find.byType(BottomPopupBar), findsOneWidget);
// expect(find.text('All fields are required'), findsOneWidget);
});
}
59 changes: 59 additions & 0 deletions frontend/test/signupdriverdoc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:safe_ride_mobile/screens/login/SignUpDriverDoc.dart';
import 'package:safe_ride_mobile/widgets/PopUp.dart';

void main() {
testWidgets('validateFormFields returns correct validation messages',
(WidgetTester tester) async {

tester.view.devicePixelRatio = 1;
tester.view.physicalSize = const Size(1200, 800);

// Build the MaterialApp with LoginPage.
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SignUpDriverDocPage(firstName: 'firstName',
lastName: 'lastName',
email: 'email',
nic: 'nic',
mobile: 'mobile',
pass: 'pass'),
),
),
);

await tester.pumpAndSettle();

// final emailFieldFinder = find.byKey(Key('emailField'));
// final passwordFieldFinder = find.byKey(Key('passwordField'));
final signupdriverdocButtonFinder = find.byKey(Key('signupdriverdocButton'));

// Fill in the email and password fields
await tester.tap(signupdriverdocButtonFinder);
await tester.pumpAndSettle();

expect(find.byType(BottomPopupBar), findsOneWidget);
expect(find.text('All fields are required'), findsOneWidget);

expect(find.text('Ok'), findsOneWidget);
await tester.pumpAndSettle();

// await tester.enterText(emailFieldFinder, '[email protected]');
// await tester.pumpAndSettle();
//
// expect(find.byType(BottomPopupBar), findsOneWidget);
// expect(find.text('All fields are required'), findsOneWidget);
//
// expect(find.text('Ok'), findsOneWidget);
// await tester.pumpAndSettle();
//
// await tester.enterText(emailFieldFinder, '');
// await tester.enterText(passwordFieldFinder, '123456');
// await tester.pumpAndSettle();
//
// expect(find.byType(BottomPopupBar), findsOneWidget);
// expect(find.text('All fields are required'), findsOneWidget);
});
}
55 changes: 55 additions & 0 deletions frontend/test/signupparent_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:safe_ride_mobile/screens/login/SignUpDriverDoc.dart';
import 'package:safe_ride_mobile/screens/login/SignUpParent.dart';
import 'package:safe_ride_mobile/widgets/PopUp.dart';

void main() {
testWidgets('validateFormFields returns correct validation messages',
(WidgetTester tester) async {

tester.view.devicePixelRatio = 1;
tester.view.physicalSize = const Size(1200, 1500);

// Build the MaterialApp with LoginPage.
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SignUpParentPage(),
),
),
);

await tester.pumpAndSettle();

// final emailFieldFinder = find.byKey(Key('emailField'));
// final passwordFieldFinder = find.byKey(Key('passwordField'));
final signupparentButtonFinder = find.byKey(Key('signupparentButton'));

// Fill in the email and password fields
await tester.tap(signupparentButtonFinder);
await tester.pumpAndSettle();

expect(find.byType(BottomPopupBar), findsOneWidget);
expect(find.text('All fields are required'), findsOneWidget);

expect(find.text('Ok'), findsOneWidget);
await tester.pumpAndSettle();

// await tester.enterText(emailFieldFinder, '[email protected]');
// await tester.pumpAndSettle();
//
// expect(find.byType(BottomPopupBar), findsOneWidget);
// expect(find.text('All fields are required'), findsOneWidget);
//
// expect(find.text('Ok'), findsOneWidget);
// await tester.pumpAndSettle();
//
// await tester.enterText(emailFieldFinder, '');
// await tester.enterText(passwordFieldFinder, '123456');
// await tester.pumpAndSettle();
//
// expect(find.byType(BottomPopupBar), findsOneWidget);
// expect(find.text('All fields are required'), findsOneWidget);
});
}
1 change: 1 addition & 0 deletions safe-ride-admin-web
Submodule safe-ride-admin-web added at a40c84

0 comments on commit dcc4489

Please sign in to comment.