test
This commit is contained in:
parent
f64d65425f
commit
56cb5427a2
|
@ -7,6 +7,7 @@ import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hub/components/atomic_components/shared_components_atoms/submit_button.dart';
|
||||
import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart';
|
||||
import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart';
|
||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||
|
@ -71,26 +72,26 @@ void main() {
|
|||
// setUp(() async {});
|
||||
// tearDown(() async {});
|
||||
|
||||
WelcomeTest.signInToSignUp();
|
||||
WelcomeTest.signUpToSignIn();
|
||||
// WelcomeTest.signInToSignUp();
|
||||
// WelcomeTest.signUpToSignIn();
|
||||
|
||||
// AuthenticationTest.signIn();
|
||||
// AuthenticationTest.signUp();
|
||||
// AuthenticationTest.signOut();
|
||||
// AuthenticationTest.recovery();
|
||||
|
||||
ModularizationTest.switchLicense();
|
||||
ModularizationTest.containLicense();
|
||||
// ModularizationTest.switchLicense();
|
||||
// ModularizationTest.containLicense();
|
||||
|
||||
MenuTest.navToEntries();
|
||||
MenuTest.containEntries();
|
||||
MenuTest.labels2AppbarConsistency();
|
||||
// MenuTest.navToEntries();
|
||||
// MenuTest.containEntries();
|
||||
// MenuTest.labels2AppbarConsistency();
|
||||
|
||||
// LocalsTest.setLocal();
|
||||
// LocalsTest.unlinkLocal();
|
||||
|
||||
VehicleTest.vehiclePage();
|
||||
// VehicleTest.vehiclePage();
|
||||
// VehicleTest.historyScreen();
|
||||
// VehicleTest.registerScreen();
|
||||
VehicleTest.registerScreen();
|
||||
// VehicleTest.updateScreen();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,25 @@
|
|||
part of 'app_test.dart';
|
||||
|
||||
class VehicleTest {
|
||||
static Future<void> _initVehicleModule() async {
|
||||
final vehicleParam = <String, dynamic>{
|
||||
'display': 'VISIVEL',
|
||||
'expirationDate': '',
|
||||
'startDate': '',
|
||||
'quantity': 0,
|
||||
};
|
||||
final vehicleManagerParam = <String, dynamic>{
|
||||
'display': 'VISIVEL',
|
||||
'expirationDate': '',
|
||||
'startDate': '',
|
||||
'quantity': 0,
|
||||
};
|
||||
await LicenseRepositoryImpl()
|
||||
.setModule(LicenseKeys.vehicles.value, vehicleParam);
|
||||
await LicenseRepositoryImpl()
|
||||
.setModule(LicenseKeys.vehiclesManager.value, vehicleManagerParam);
|
||||
}
|
||||
|
||||
static Future<void> vehiclePage() async {
|
||||
patrolWidgetTest(
|
||||
'Vehicle Page',
|
||||
|
@ -10,6 +29,8 @@ class VehicleTest {
|
|||
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
|
||||
|
||||
await _loggedWithMultiLocalsAccount();
|
||||
await _initVehicleModule();
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
|
||||
ff.navigatorKey.currentContext!.go('/vehiclesOnThePropertyPage');
|
||||
|
@ -49,25 +70,26 @@ class VehicleTest {
|
|||
final int entriesCount = entriesFinder.evaluate().length;
|
||||
await $.pumpAndSettle();
|
||||
|
||||
for (int i = 0; i < entriesCount; i++) {
|
||||
await $(entriesFinder.at(i)).scrollTo();
|
||||
if (entriesCount > 0)
|
||||
for (int i = 0; i < entriesCount; i++) {
|
||||
await $(entriesFinder.at(i)).scrollTo();
|
||||
|
||||
await $(entriesFinder.at(i))
|
||||
.waitUntilVisible(timeout: const Duration(seconds: 1))
|
||||
.tap(
|
||||
settleTimeout: const Duration(seconds: 1),
|
||||
settlePolicy: SettlePolicy.noSettle,
|
||||
);
|
||||
await $(entriesFinder.at(i))
|
||||
.waitUntilVisible(timeout: const Duration(seconds: 1))
|
||||
.tap(
|
||||
settleTimeout: const Duration(seconds: 1),
|
||||
settlePolicy: SettlePolicy.noSettle,
|
||||
);
|
||||
|
||||
await $.pumpAndSettle(duration: Duration(milliseconds: 500));
|
||||
final PatrolFinder detailsFinder =
|
||||
await $(DetailsComponentWidget).waitUntilVisible();
|
||||
expect(detailsFinder, findsOneWidget);
|
||||
await $.pumpAndSettle(duration: Duration(milliseconds: 500));
|
||||
final PatrolFinder detailsFinder =
|
||||
await $(DetailsComponentWidget).waitUntilVisible();
|
||||
expect(detailsFinder, findsOneWidget);
|
||||
|
||||
await _navigateBackUsingSystemGesture();
|
||||
await _navigateBackUsingSystemGesture();
|
||||
|
||||
// await $.native.pressBack().then((_) => $.pumpAndSettle());
|
||||
}
|
||||
// await $.native.pressBack().then((_) => $.pumpAndSettle());
|
||||
}
|
||||
},
|
||||
);
|
||||
patrolWidgetTest(
|
||||
|
@ -77,29 +99,9 @@ class VehicleTest {
|
|||
$.tester.printToConsole('Vehicle Page');
|
||||
|
||||
await _loggedWithMultiLocalsAccount();
|
||||
await _initVehicleModule();
|
||||
await $.pumpAndSettle();
|
||||
|
||||
// await StorageHelper().set(
|
||||
// LicenseKeys.vehiclesManager.value,
|
||||
// <String, dynamic>{
|
||||
// 'display': 'VISIVEL',
|
||||
// 'expirationDate': '',
|
||||
// 'startDate': '',
|
||||
// 'quantity': 0,
|
||||
// },
|
||||
// );
|
||||
// // await $.pumpAndSettle();
|
||||
// ff.navigatorKey.currentContext!.go('/vehiclesOnThePropertyPage');
|
||||
// await Future.delayed(const Duration(milliseconds: 1000));
|
||||
|
||||
await StorageHelper().set(
|
||||
LicenseKeys.vehiclesManager.value,
|
||||
<String, dynamic>{
|
||||
'display': 'VISIVEL',
|
||||
'expirationDate': '',
|
||||
'startDate': '',
|
||||
'quantity': 0,
|
||||
},
|
||||
);
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
|
||||
ff.navigatorKey.currentContext!.go('/vehiclesOnThePropertyPage');
|
||||
|
@ -150,6 +152,8 @@ class VehicleTest {
|
|||
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
|
||||
|
||||
await _loggedWithMultiLocalsAccount();
|
||||
await _initVehicleModule();
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
|
||||
ff.navigatorKey.currentContext!.go('/vehiclesOnThePropertyPage');
|
||||
|
@ -166,11 +170,116 @@ class VehicleTest {
|
|||
.waitUntilVisible();
|
||||
expect(titleAppBar, findsOneWidget);
|
||||
|
||||
final PatrolFinder listViewFinder = await $(VehicleHistoryScreen) //
|
||||
.$(ListView)
|
||||
.waitUntilVisible();
|
||||
|
||||
expect(listViewFinder, findsOneWidget);
|
||||
|
||||
final PatrolFinder entriesFinder = await $(listViewFinder)
|
||||
.$(CardItemTemplateComponentWidget)
|
||||
.waitUntilVisible();
|
||||
|
||||
expect(entriesFinder, findsWidgets);
|
||||
await $.pumpAndSettle();
|
||||
await $(entriesFinder.first)
|
||||
.waitUntilVisible(timeout: const Duration(seconds: 1))
|
||||
.tap(
|
||||
settleTimeout: const Duration(seconds: 1),
|
||||
settlePolicy: SettlePolicy.noSettle,
|
||||
);
|
||||
|
||||
await $.pumpAndSettle(duration: Duration(milliseconds: 500));
|
||||
final PatrolFinder detailsFinder =
|
||||
await $(DetailsComponentWidget).waitUntilVisible();
|
||||
expect(detailsFinder, findsOneWidget);
|
||||
|
||||
await _navigateBackUsingSystemGesture();
|
||||
|
||||
/// Iterable Test
|
||||
// final int entriesCount = entriesFinder.evaluate().length;
|
||||
// for (int i = 0; i < entriesCount; i++) {
|
||||
// // await $(entriesFinder.at(i)).scrollTo();
|
||||
|
||||
// await $(entriesFinder.at(i))
|
||||
// .waitUntilVisible(timeout: const Duration(seconds: 1))
|
||||
// .tap(
|
||||
// settleTimeout: const Duration(seconds: 1),
|
||||
// settlePolicy: SettlePolicy.noSettle,
|
||||
// );
|
||||
|
||||
// await $.pumpAndSettle(duration: Duration(milliseconds: 500));
|
||||
// final PatrolFinder detailsFinder =
|
||||
// await $(DetailsComponentWidget).waitUntilVisible();
|
||||
// expect(detailsFinder, findsOneWidget);
|
||||
|
||||
// await _navigateBackUsingSystemGesture();
|
||||
|
||||
// // await $.native.pressBack().then((_) => $.pumpAndSettle());
|
||||
// }
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> registerScreen() async {
|
||||
patrolWidgetTest(
|
||||
'registerScreen',
|
||||
(PatrolTester tester) async {
|
||||
$ = tester;
|
||||
$.tester.printToConsole('Vehicle Register Page');
|
||||
|
||||
await _loggedWithMultiLocalsAccount();
|
||||
await _initVehicleModule();
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
|
||||
ff.navigatorKey.currentContext!.go('/vehiclesOnThePropertyPage');
|
||||
|
||||
final PatrolFinder tab2 = await $(#TabView_Tab2) //
|
||||
.waitUntilExists();
|
||||
|
||||
await tab2.tap();
|
||||
|
||||
final PatrolFinder licensePlateField =
|
||||
await $(TextField).at(0).waitUntilVisible();
|
||||
final PatrolFinder modelField =
|
||||
await $(TextField).at(1).waitUntilVisible();
|
||||
final PatrolFinder colorField =
|
||||
await $(TextField).at(2).waitUntilVisible();
|
||||
final PatrolFinder submitButton =
|
||||
await $(SubmitButtonUtil).waitUntilVisible();
|
||||
|
||||
await licensePlateField.enterText('ABC1234');
|
||||
await modelField.enterText('Voyage');
|
||||
await colorField.enterText('Black');
|
||||
await submitButton.tap();
|
||||
|
||||
await $.pumpAndSettle();
|
||||
final PatrolFinder successDialog = await $(Dialog).waitUntilVisible();
|
||||
expect(successDialog, findsOneWidget);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> updateScreen() async {
|
||||
patrolWidgetTest(
|
||||
'updateScreen',
|
||||
(PatrolTester tester) async {
|
||||
$ = tester;
|
||||
$.tester.printToConsole('Vehicle Update Page');
|
||||
|
||||
await _loggedWithMultiLocalsAccount();
|
||||
await _initVehicleModule();
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
|
||||
ff.navigatorKey.currentContext!.go('/vehiclesOnThePropertyPage');
|
||||
|
||||
final PatrolFinder tab1 = await $(#TabView_Tab1) //
|
||||
.waitUntilExists();
|
||||
|
||||
await tab1.tap();
|
||||
|
||||
final PatrolFinder listViewFinder = await $(VehicleHistoryScreen) //
|
||||
.$(ListView)
|
||||
.waitUntilVisible();
|
||||
|
@ -182,32 +291,30 @@ class VehicleTest {
|
|||
.waitUntilVisible();
|
||||
|
||||
expect(entriesFinder, findsWidgets);
|
||||
final int entriesCount = entriesFinder.evaluate().length;
|
||||
await $(entriesFinder.at(0)).tap();
|
||||
|
||||
final PatrolFinder editButton =
|
||||
await $(FFButtonWidget).$('Edit').waitUntilVisible();
|
||||
await editButton.tap();
|
||||
|
||||
final PatrolFinder licensePlateField =
|
||||
await $(TextField).at(0).waitUntilVisible();
|
||||
final PatrolFinder modelField =
|
||||
await $(TextField).at(1).waitUntilVisible();
|
||||
final PatrolFinder colorField =
|
||||
await $(TextField).at(2).waitUntilVisible();
|
||||
final PatrolFinder submitButton =
|
||||
await $(SubmitButtonUtil).waitUntilVisible();
|
||||
|
||||
await licensePlateField.enterText('XYZ5678');
|
||||
await modelField.enterText('Fiesta');
|
||||
await colorField.enterText('Red');
|
||||
await submitButton.tap();
|
||||
|
||||
await $.pumpAndSettle();
|
||||
|
||||
for (int i = 0; i < entriesCount; i++) {
|
||||
await $(entriesFinder.at(i)).scrollTo();
|
||||
|
||||
await $(entriesFinder.at(i))
|
||||
.waitUntilVisible(timeout: const Duration(seconds: 1))
|
||||
.tap(
|
||||
settleTimeout: const Duration(seconds: 1),
|
||||
settlePolicy: SettlePolicy.noSettle,
|
||||
);
|
||||
|
||||
await $.pumpAndSettle(duration: Duration(milliseconds: 500));
|
||||
final PatrolFinder detailsFinder =
|
||||
await $(DetailsComponentWidget).waitUntilVisible();
|
||||
expect(detailsFinder, findsOneWidget);
|
||||
|
||||
await _navigateBackUsingSystemGesture();
|
||||
|
||||
// await $.native.pressBack().then((_) => $.pumpAndSettle());
|
||||
}
|
||||
final PatrolFinder successDialog = await $(Dialog).waitUntilVisible();
|
||||
expect(successDialog, findsOneWidget);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static Future<void> registerScreen() async {}
|
||||
static Future<void> updateScreen() async {}
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ class RegisterVehicle {
|
|||
|
||||
class UpdateVehicle {
|
||||
Future<ApiCallResponse> call({
|
||||
final String? vehicleId,
|
||||
required final int vehicleId,
|
||||
final String? licensePlate,
|
||||
final String? color,
|
||||
final String? model,
|
||||
|
|
|
@ -82,10 +82,9 @@ class VehicleModel extends FlutterFlowModel<VehiclePage>
|
|||
/// [_BaseVehiclePage] is a mixin that contains the base logic of the vehicle page.
|
||||
mixin class _BaseVehiclePage {
|
||||
int count = 0;
|
||||
late final VehicleModel model;
|
||||
late final TabController tabBarController;
|
||||
// dynamic item;
|
||||
String? vehicleId;
|
||||
late int vehicleId;
|
||||
BuildContext context = navigatorKey.currentContext!;
|
||||
bool isEditing = false;
|
||||
ApiCallResponse? vehicleResponse;
|
||||
|
@ -161,6 +160,7 @@ mixin class _BaseVehiclePage {
|
|||
|
||||
Future<void> setEditForm(dynamic item) async {
|
||||
if (item != null) {
|
||||
log('vehicleId: ${item['vehicleId']}');
|
||||
vehicleId = item['vehicleId'];
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue