Merge branch 'feat/fd-1023' into feat/fd-1035
This commit is contained in:
commit
3c304d660f
|
@ -0,0 +1,45 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||
import 'package:hub/initialization.dart';
|
||||
import 'package:hub/main.dart' as app;
|
||||
import 'package:hub/shared/helpers/storage/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage/storage_helper.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
group('ProvisionalHistoryPage Integration Test', () {
|
||||
setUpAll(() async => await initializeApp().then((_) async {
|
||||
await StorageHelper().set(SecureStorageKey.isLogged.value, 'true');
|
||||
await StorageHelper().set(SecureStorageKey.haveLocal.value, 'true');
|
||||
await StorageHelper().set(KeychainStorageKey.devUUID.value, 'b5c3818753e76d85');
|
||||
await StorageHelper().set(KeychainStorageKey.userUUID.value, '649c45d7514a28.85876308');
|
||||
await StorageHelper().set(KeychainStorageKey.clientUUID.value, '7');
|
||||
}));
|
||||
|
||||
testWidgets('Filter Provisional History', (WidgetTester tester) async {
|
||||
app.main();
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final Finder menuButton = find.byIcon(Icons.person_search_outlined);
|
||||
await tester.tap(menuButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final Finder filterButton = find.byIcon(Icons.filter_list);
|
||||
await tester.tap(filterButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final Finder activeFilterOption = find.text('Active');
|
||||
await tester.tap(activeFilterOption);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final Finder applyFilterButton = find.text('Apply');
|
||||
await tester.tap(applyFilterButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(CardItemTemplateComponentWidget), findsWidgets);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1380,7 +1380,7 @@ class GetDadosCall {
|
|||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
).timeout(const Duration(seconds: 30));
|
||||
}
|
||||
|
||||
bool? errorBolean(dynamic response) => castToType<bool>(getJsonField(
|
||||
|
|
|
@ -11,7 +11,7 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
String cliUUID = '';
|
||||
String devUUID = '';
|
||||
String userUUID = '';
|
||||
String cliName = '';
|
||||
String ownerName = '';
|
||||
String ownerUUID = '';
|
||||
VoidCallback? setState;
|
||||
|
||||
|
@ -140,8 +140,7 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? '';
|
||||
userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? '';
|
||||
cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? '';
|
||||
;
|
||||
cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? '';
|
||||
ownerName = (await StorageHelper().get(KeychainStorageKey.ownerName.value)) ?? '';
|
||||
ownerUUID = (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? '';
|
||||
setState?.call();
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(15.0, 0.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
model.cliName,
|
||||
model.ownerName,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
|
|
|
@ -324,7 +324,7 @@ class ProvisionalHistoryState extends State<ProvisionalHistoryPage> {
|
|||
|
||||
Widget _historyCardMoleculeWidget(BuildContext context, dynamic historyItem) {
|
||||
return CardItemTemplateComponentWidget(
|
||||
imagePath: _imageUrlAtomWidget(historyItem['AGP_NOME'], 'P'),
|
||||
imagePath: null,
|
||||
labelsHashMap: _buildLabelsHashMap(context, historyItem),
|
||||
statusHashMap: _buildStatusHashMap(context, historyItem),
|
||||
onTapCardItemAction: () async {},
|
||||
|
|
|
@ -43,6 +43,11 @@ class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
|||
return DetailsComponentWidget(
|
||||
buttons: [],
|
||||
labelsHashMap: Map<String, String>.from({
|
||||
if (item['VTA_NOME'] != null && item['VTA_NOME'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Nome",
|
||||
enText: "Name",
|
||||
)}:': item['VTA_NOME'].toString().toUpperCase(),
|
||||
if (item['MOT_DESCRICAO'] != null && item['MOT_DESCRICAO'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Motivo",
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:hub/features/history/index.dart';
|
||||
import 'package:hub/initialization.dart';
|
||||
import 'package:hub/shared/helpers/storage/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage/storage_helper.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
|
||||
@GenerateMocks([ProvisionalHistoryPage])
|
||||
void main() {
|
||||
group('ProvisionalHistoryPage Tests', () {
|
||||
late BehaviorSubject<Map<String, String>> selectedTypeSubject;
|
||||
setUpAll(() async => await initializeApp().then((_) async => await StorageHelper().set(SecureStorageKey.isLogged.value, 'true')));
|
||||
|
||||
setUp(() {
|
||||
selectedTypeSubject = BehaviorSubject.seeded({'AGP_STATUS': '.*'});
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
selectedTypeSubject.close();
|
||||
});
|
||||
|
||||
testWidgets('should display the app bar with title', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(home: ProvisionalHistoryPage()));
|
||||
|
||||
expect(find.text('Provisional History'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display the filter button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ProvisionalHistoryPage(),
|
||||
));
|
||||
|
||||
expect(find.byIcon(Icons.filter_list), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display the back button', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ProvisionalHistoryPage(),
|
||||
));
|
||||
|
||||
expect(find.byIcon(Icons.keyboard_arrow_left), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display no history found message when no data', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ProvisionalHistoryPage(),
|
||||
));
|
||||
|
||||
expect(find.text('No history found!'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display loading indicator when fetching data', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ProvisionalHistoryPage(),
|
||||
));
|
||||
|
||||
expect(find.byType(CircularProgressIndicator), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should display history items when data is available', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ProvisionalHistoryPage(),
|
||||
));
|
||||
|
||||
final historyItem = {
|
||||
'AGP_NOME': 'John Doe',
|
||||
'AGP_DT_VISITA': '2023-10-01',
|
||||
'AGP_STATUS': 'AT',
|
||||
};
|
||||
|
||||
final provisionalHistoryState = tester.state(find.byType(ProvisionalHistoryPage)) as ProvisionalHistoryState;
|
||||
provisionalHistoryState.wrap.add(historyItem);
|
||||
provisionalHistoryState.hasData = true;
|
||||
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('John Doe'), findsOneWidget);
|
||||
expect(find.text('2023-10-01'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should update history when filter is applied', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: ProvisionalHistoryPage(),
|
||||
));
|
||||
|
||||
await tester.tap(find.byIcon(Icons.filter_list));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.text('Active'));
|
||||
await tester.tap(find.text('Apply'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final provisionalHistoryState = tester.state(find.byType(ProvisionalHistoryPage)) as ProvisionalHistoryState;
|
||||
expect(provisionalHistoryState.status, 'AT');
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue