WIP
This commit is contained in:
parent
8700b54b0e
commit
a6dafe8b1e
|
@ -8,6 +8,7 @@ import 'package:hub/components/molecular_components/throw_exception/throw_except
|
|||
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';
|
||||
import 'package:hub/features/backend/api_requests/index.dart';
|
||||
import 'package:hub/features/local/index.dart';
|
||||
import 'package:hub/features/menu/index.dart';
|
||||
import 'package:hub/features/module/data/index.dart';
|
||||
import 'package:hub/features/module/domain/index.dart';
|
||||
|
@ -49,10 +50,10 @@ void main() {
|
|||
// ModularizationTest.switchLicense();
|
||||
// ModularizationTest.containLicense();
|
||||
//
|
||||
MenuTest.navToEntries();
|
||||
// MenuTest.navToEntries();
|
||||
// MenuTest.containEntries();
|
||||
// MenuTest.labels2AppbarConsistency();
|
||||
//
|
||||
// LocalsTest.setLocal();
|
||||
// LocalsTest.unlinkLocal();
|
||||
LocalsTest.unlinkLocal();
|
||||
}
|
||||
|
|
|
@ -7,34 +7,30 @@ class LocalsTest {
|
|||
(PatrolTester tester) async {
|
||||
$ = tester;
|
||||
await _logged();
|
||||
await $.pumpWidget(const App());
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
await $.waitUntilVisible($(MenuStaggeredView));
|
||||
await $.waitUntilVisible($(LocalProfileComponentWidget));
|
||||
|
||||
final Finder profileFinder =
|
||||
find.byKey(const Key('AsyncLocalProfileComponentWidget_InkWell'));
|
||||
final PatrolFinder profileFinder =
|
||||
$(#AsyncLocalProfileComponentWidget_InkWell);
|
||||
expect(profileFinder, findsOneWidget);
|
||||
|
||||
await $.tap(profileFinder);
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
await $(profileFinder).tap();
|
||||
await $.pump(const Duration(milliseconds: 500));
|
||||
|
||||
final Finder bottomSheetFinder =
|
||||
find.byType(BottomArrowLinkedLocalsComponentWidget);
|
||||
final PatrolFinder bottomSheetFinder =
|
||||
$(BottomArrowLinkedLocalsComponentWidget);
|
||||
expect(bottomSheetFinder, findsOneWidget);
|
||||
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
await $.pump(const Duration(milliseconds: 500));
|
||||
|
||||
final Finder listViewFinder = find.descendant(
|
||||
of: bottomSheetFinder,
|
||||
matching: find.byType(ListView),
|
||||
);
|
||||
final PatrolFinder listViewFinder = $(bottomSheetFinder).$(ListView);
|
||||
expect(listViewFinder, findsOneWidget);
|
||||
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
await $.pump(const Duration(milliseconds: 500));
|
||||
|
||||
final Finder entriesFinder = find.descendant(
|
||||
of: listViewFinder,
|
||||
matching: find.byType(CardItemTemplateComponentWidget),
|
||||
);
|
||||
final PatrolFinder entriesFinder =
|
||||
$(listViewFinder).$(CardItemTemplateComponentWidget);
|
||||
expect(entriesFinder, findsWidgets);
|
||||
|
||||
if (entriesFinder.evaluate().isNotEmpty) {
|
||||
|
@ -43,86 +39,130 @@ class LocalsTest {
|
|||
}
|
||||
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static Future unlinkLocal() async {
|
||||
patrolWidgetTest('Desvincular do local selecionado', //
|
||||
(PatrolTester tester) async {
|
||||
$ = tester;
|
||||
await _logged();
|
||||
await $.pumpWidget(const App());
|
||||
await $.pumpAndSettle();
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
|
||||
final Finder gridView = find.byType(GridView);
|
||||
final Finder entries = find.descendant(
|
||||
of: gridView,
|
||||
matching: find.byType(ButtonMenuItem),
|
||||
);
|
||||
await $.pumpAndSettle();
|
||||
expect(entries, findsWidgets);
|
||||
final Finder settings = find.descendant(
|
||||
of: gridView,
|
||||
matching: find.byIcon(Icons.settings),
|
||||
);
|
||||
expect(settings, findsOneWidget);
|
||||
|
||||
await $.tap(settings);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
final Finder unlinkButton = find.byIcon(Symbols.digital_out_of_home);
|
||||
expect(unlinkButton, findsOneWidget);
|
||||
await $.tap(unlinkButton);
|
||||
await $.pumpAndSettle();
|
||||
await $.tap(find.text('Sim'));
|
||||
await $.pump();
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
await $.pump();
|
||||
|
||||
final Finder bottomSheetFinder =
|
||||
find.byType(BottomArrowLinkedLocalsComponentWidget);
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
expect(bottomSheetFinder, findsOneWidget);
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
|
||||
final Finder listViewFinder = find.descendant(
|
||||
of: bottomSheetFinder,
|
||||
matching: find.byType(ListView),
|
||||
);
|
||||
expect(listViewFinder, findsOneWidget);
|
||||
|
||||
await $.pump(const Duration(seconds: 1));
|
||||
|
||||
final Finder entriesFinder = find.descendant(
|
||||
of: listViewFinder,
|
||||
matching: find.byType(CardItemTemplateComponentWidget),
|
||||
);
|
||||
expect(entriesFinder, findsWidgets);
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return;
|
||||
});
|
||||
// patrolWidgetTest('Desvincular do local selecionado', //
|
||||
// (PatrolTester tester) async {
|
||||
// $ = tester;
|
||||
// await _logged();
|
||||
// await $.pumpWidgetAndSettle(const App());
|
||||
// await $.waitUntilVisible($(MenuStaggeredView));
|
||||
// Future.delayed(const Duration(milliseconds: 500));
|
||||
//
|
||||
// final PatrolFinder gridView = await $(GridView) //
|
||||
// .waitUntilVisible();
|
||||
// final PatrolFinder entries = await $(gridView)
|
||||
// .$(ButtonMenuItem) //
|
||||
// .waitUntilVisible();
|
||||
//
|
||||
// await $.pumpAndSettle();
|
||||
// expect(entries, findsWidgets);
|
||||
// final PatrolFinder settings = await $(gridView) //
|
||||
// .$(Icons.settings)
|
||||
// .waitUntilVisible();
|
||||
// expect(settings, findsOneWidget);
|
||||
//
|
||||
// await $(settings).tap();
|
||||
//
|
||||
// final PatrolFinder unlinkButton = await $(Symbols.digital_out_of_home) //
|
||||
// .waitUntilVisible();
|
||||
// expect(unlinkButton, findsOneWidget);
|
||||
// await $(unlinkButton).tap();
|
||||
//
|
||||
// await $('Sim') //
|
||||
// .waitUntilVisible()
|
||||
// .tap(settlePolicy: SettlePolicy.noSettle);
|
||||
//
|
||||
// await $.pump();
|
||||
// await $.pump(const Duration(seconds: 1));
|
||||
// await $.pump();
|
||||
//
|
||||
// final PatrolFinder bottomSheetFinder =
|
||||
// await $(BottomArrowLinkedLocalsComponentWidget) //
|
||||
// .waitUntilVisible();
|
||||
//
|
||||
// await $.pump(const Duration(seconds: 1));
|
||||
// expect(bottomSheetFinder, findsOneWidget);
|
||||
// await $.pump(const Duration(seconds: 1));
|
||||
//
|
||||
// await $.pump(const Duration(seconds: 1));
|
||||
// final PatrolFinder listViewFinder = await $(bottomSheetFinder) //
|
||||
// .$(ListView)
|
||||
// .waitUntilVisible();
|
||||
//
|
||||
// expect(listViewFinder, findsOneWidget);
|
||||
//
|
||||
// await $.pump(const Duration(seconds: 1));
|
||||
//
|
||||
// final PatrolFinder entriesFinder = await $(listViewFinder)
|
||||
// .$(CardItemTemplateComponentWidget)
|
||||
// .waitUntilVisible();
|
||||
//
|
||||
// expect(entriesFinder, findsWidgets);
|
||||
// await Future.delayed(const Duration(milliseconds: 500));
|
||||
// return;
|
||||
// });
|
||||
|
||||
patrolWidgetTest(
|
||||
'Desvincular de um local já desvinculado', //
|
||||
'Vincular um local desvinculado', //
|
||||
(PatrolTester tester) async {
|
||||
$ = tester;
|
||||
await _logged(false);
|
||||
await $.pumpWidget(const App());
|
||||
try {
|
||||
await $.pumpAndSettle(
|
||||
// const Duration(seconds: 2),
|
||||
// EnginePhase.sendSemanticsUpdate,
|
||||
// const Duration(seconds: 2),
|
||||
);
|
||||
throw Exception('Local está vinculado');
|
||||
} catch (e) {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return;
|
||||
|
||||
final loc = ff.FFLocalizations.of(navigatorKey.currentContext!);
|
||||
|
||||
//
|
||||
// await $.waitUntilVisible($(MenuStaggeredView));
|
||||
// await $.waitUntilVisible($(LocalProfileComponentWidget));
|
||||
//
|
||||
// final PatrolFinder profileFinder =
|
||||
// $(#AsyncLocalProfileComponentWidget_InkWell);
|
||||
// expect(profileFinder, findsOneWidget);
|
||||
//
|
||||
// await $(profileFinder).tap();
|
||||
// await $.pump(const Duration(milliseconds: 500));
|
||||
|
||||
final PatrolFinder bottomSheetFinder =
|
||||
await $(BottomArrowLinkedLocalsComponentWidget) //
|
||||
.waitUntilVisible();
|
||||
expect(bottomSheetFinder, findsOneWidget);
|
||||
|
||||
await $.pump(const Duration(milliseconds: 500));
|
||||
|
||||
final PatrolFinder listViewFinder = $(bottomSheetFinder) //
|
||||
.$(ListView);
|
||||
expect(listViewFinder, findsOneWidget);
|
||||
|
||||
await $.pump(const Duration(milliseconds: 500));
|
||||
|
||||
final PatrolFinder entriesFinder = $(listViewFinder) //
|
||||
.$(CardItemTemplateComponentWidget);
|
||||
expect(entriesFinder, findsWidgets);
|
||||
|
||||
if (entriesFinder.evaluate().isNotEmpty) {
|
||||
await $(entriesFinder.first).waitUntilVisible().tap();
|
||||
final String accept =
|
||||
loc.getVariableText(enText: 'Yes', ptText: 'Sim');
|
||||
await $(accept).waitUntilVisible().tap();
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
// try {
|
||||
// await $.pumpAndSettle(
|
||||
// duration: const Duration(seconds: 2),
|
||||
// phase: EnginePhase.sendSemanticsUpdate,
|
||||
// timeout: const Duration(seconds: 2),
|
||||
// );
|
||||
// throw Exception('Local está vinculado');
|
||||
// } catch (e) {
|
||||
// await Future.delayed(const Duration(milliseconds: 500));
|
||||
// return;
|
||||
// }
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,9 @@ class MenuTest {
|
|||
(PatrolTester tester) async {
|
||||
$ = tester;
|
||||
await _logged();
|
||||
await $.pumpWidget(const App());
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
await $.waitUntilVisible($(MenuStaggeredView));
|
||||
Future.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
final List<String> routes = MenuEntry.entries
|
||||
.where((entry) => entry.key != 'FRE-HUB-LOGOUT')
|
||||
|
@ -20,30 +21,30 @@ class MenuTest {
|
|||
.toList();
|
||||
|
||||
final LinkedHashMap<String, String> routesTitles =
|
||||
LinkedHashMap.fromIterables(
|
||||
routes,
|
||||
titles,
|
||||
);
|
||||
LinkedHashMap.fromIterables(routes, titles);
|
||||
|
||||
for (final entry in routesTitles.entries) {
|
||||
await $.pumpAndSettle();
|
||||
final String route = entry.key;
|
||||
final String title = entry.value;
|
||||
|
||||
print('route: $route');
|
||||
print('title: $title');
|
||||
|
||||
if (route == '/petsPage') continue;
|
||||
if (route == '/fastPassPage') continue;
|
||||
if (route == '/reservation') continue;
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await $.pumpAndSettle();
|
||||
ff.navigatorKey.currentContext!.go(route);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
Future.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
final Finder appBar = find.text(title);
|
||||
await $.pumpAndSettle();
|
||||
await $.waitUntilExists($(AppBar));
|
||||
final PatrolFinder appBar = $(title);
|
||||
expect(appBar, findsOneWidget);
|
||||
await $.pumpAndSettle();
|
||||
}
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -53,19 +54,15 @@ class MenuTest {
|
|||
'HomeMenu contém seus itens?', //
|
||||
(PatrolTester tester) async {
|
||||
$ = tester;
|
||||
|
||||
await _logged();
|
||||
await $.pumpWidget(const App());
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
await $.waitUntilVisible($(MenuStaggeredView));
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
final Finder gridView = find.byType(GridView);
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpAndSettle();
|
||||
final Finder gridEntries = find.descendant(
|
||||
of: gridView,
|
||||
matching: find.byType(ButtonMenuItem),
|
||||
);
|
||||
await $.pumpAndSettle();
|
||||
await $.waitUntilVisible($(MenuStaggeredView));
|
||||
await $.waitUntilVisible($(GridView));
|
||||
final PatrolFinder gridEntries = $(GridView).$(ButtonMenuItem);
|
||||
expect(gridEntries, findsWidgets);
|
||||
|
||||
final List<String?> menuKeys = gridEntries
|
||||
|
@ -90,7 +87,6 @@ class MenuTest {
|
|||
await $.pumpAndSettle();
|
||||
expect(entriesKey, containsAll(menuKeys));
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return;
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -98,26 +94,23 @@ class MenuTest {
|
|||
'DrawerMenu contém seus itens?', //
|
||||
(PatrolTester tester) async {
|
||||
$ = tester;
|
||||
|
||||
await _logged();
|
||||
await $.pumpWidget(const App());
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpWidgetAndSettle(const App());
|
||||
await $.waitUntilVisible($(MenuStaggeredView));
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
final Finder drawerButton = find.byIcon(Icons.menu_rounded);
|
||||
await $.pumpAndSettle();
|
||||
await $.tap(drawerButton);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
final Finder gridView = find.byType(ListView);
|
||||
await $.pumpAndSettle();
|
||||
final Finder gridEntries = find.descendant(
|
||||
of: gridView,
|
||||
matching: find.byType(CardMenuItem),
|
||||
);
|
||||
await $.pumpAndSettle();
|
||||
await $.waitUntilVisible($(MenuStaggeredView));
|
||||
await $.waitUntilVisible($(GridView));
|
||||
final PatrolFinder gridEntries = $(GridView).$(ButtonMenuItem);
|
||||
expect(gridEntries, findsWidgets);
|
||||
|
||||
final List<String?> menuKeys = gridEntries
|
||||
await $(Icons.menu_rounded).waitUntilVisible().tap();
|
||||
await $.waitUntilVisible($(ListView));
|
||||
final PatrolFinder listEntries = $(ListView).$(CardMenuItem);
|
||||
expect(listEntries, findsWidgets);
|
||||
|
||||
final List<String?> menuKeys = listEntries
|
||||
.evaluate()
|
||||
.map((element) {
|
||||
final key = element.widget.key;
|
||||
|
@ -139,7 +132,6 @@ class MenuTest {
|
|||
await $.pumpAndSettle();
|
||||
expect(entriesKey, containsAll(menuKeys));
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
return;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -179,28 +171,20 @@ class MenuTest {
|
|||
final int gridEntriesCount = gridEntries.evaluate().length;
|
||||
await $.pumpAndSettle();
|
||||
|
||||
// final List<String?> menuKeys = gridEntries
|
||||
// .evaluate()
|
||||
// .map((element) {
|
||||
// final key = element.widget.key;
|
||||
// if (key is ValueKey<String>) {
|
||||
// return key.value;
|
||||
// }
|
||||
// return null;
|
||||
// })
|
||||
// .where((key) => key != null)
|
||||
// .toList();
|
||||
// final List<MenuEntry> entries = MenuEntry.entries;
|
||||
// final List<String> entriesKey = entries
|
||||
// .where((entry) => entry.types.contains(MenuEntryType.Home))
|
||||
// .map((entry) => entry.key)
|
||||
// .toList();
|
||||
// await $.pumpAndSettle();
|
||||
// expect(entriesKey, containsAll(menuKeys));
|
||||
|
||||
///
|
||||
|
||||
for (int i = 0; i < gridEntriesCount; i++) {
|
||||
await $.waitUntilVisible(
|
||||
$(MenuStaggeredView),
|
||||
timeout: Duration(seconds: 1),
|
||||
);
|
||||
await $.waitUntilVisible(
|
||||
gridView,
|
||||
timeout: Duration(seconds: 1),
|
||||
);
|
||||
await $.waitUntilVisible(
|
||||
gridEntries.at(i),
|
||||
timeout: Duration(seconds: 1),
|
||||
);
|
||||
|
||||
final ButtonMenuItem entry =
|
||||
$.tester.widget<ButtonMenuItem>(gridEntries.at(i));
|
||||
final Key? widgetKey = entry.key;
|
||||
|
@ -210,14 +194,25 @@ class MenuTest {
|
|||
if (widgetKey == ValueKey<String>('FRE-HUB-FASTPASS')) continue;
|
||||
if (widgetKey == ValueKey<String>('FRE-HUB-QRCODE')) continue;
|
||||
if (widgetKey == ValueKey<String>('FRE-HUB-RESERVATIONS')) continue;
|
||||
if (widgetKey == ValueKey<String>('FRE-HUB-SETTINGS')) continue;
|
||||
|
||||
await $.waitUntilVisible(gridEntries.at(i));
|
||||
await $(gridEntries.at(i)).waitUntilVisible().tap();
|
||||
await $(Icons.keyboard_arrow_down);
|
||||
Future.delayed(const Duration(milliseconds: 500));
|
||||
// await _navigateBackUsingSystemGesture();
|
||||
await $(#BackNavigationAppBar).waitUntilVisible().tap();
|
||||
// await $(Icons.keyboard_arrow_down).waitUntilVisible().tap();
|
||||
await $(gridEntries.at(i))
|
||||
.waitUntilVisible(timeout: const Duration(seconds: 1))
|
||||
.tap(
|
||||
settleTimeout: const Duration(seconds: 1),
|
||||
settlePolicy: SettlePolicy.noSettle,
|
||||
);
|
||||
|
||||
await $.pumpAndSettle(duration: Duration(milliseconds: 500));
|
||||
|
||||
await $(Icons.keyboard_arrow_left)
|
||||
.waitUntilVisible(timeout: const Duration(seconds: 1))
|
||||
.tap(
|
||||
settleTimeout: const Duration(seconds: 1),
|
||||
settlePolicy: SettlePolicy.noSettle,
|
||||
);
|
||||
|
||||
await $.pumpAndSettle(duration: Duration(milliseconds: 500));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
part of 'app_test.dart';
|
||||
|
||||
Future<void> _logged() async {
|
||||
Future<void> _logged([bool forceLinkedLocal = true]) async {
|
||||
await initializeApp();
|
||||
await StorageHelper() //
|
||||
.set(SecureStorageKey.isLogged.value, 'true');
|
||||
|
@ -10,19 +10,22 @@ Future<void> _logged() async {
|
|||
.set(ProfileStorageKey.devUUID.key, 'b5c3818753e76d85');
|
||||
await StorageHelper() //
|
||||
.set(ProfileStorageKey.userUUID.key, '649c45d7514a28.85876308');
|
||||
await StorageHelper() //
|
||||
.set(ProfileStorageKey.clientUUID.key, '7');
|
||||
|
||||
await StorageHelper() //
|
||||
.set(SecureStorageKey.email.value, 'email_app@exemplo.com');
|
||||
await StorageHelper() //
|
||||
.set(SecureStorageKey.password.value, '123456');
|
||||
await StorageHelper() //
|
||||
.set(LocalsStorageKey.isNewVersion.key, true);
|
||||
await PhpGroup //
|
||||
.resopndeVinculo
|
||||
.call(tarefa: 'A');
|
||||
await LicenseRepositoryImpl() //
|
||||
.resetLicense();
|
||||
if (forceLinkedLocal == true) {
|
||||
await StorageHelper() //
|
||||
.set(ProfileStorageKey.clientUUID.key, '7');
|
||||
await PhpGroup //
|
||||
.resopndeVinculo
|
||||
.call(tarefa: 'A');
|
||||
await LicenseRepositoryImpl() //
|
||||
.resetLicense();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _unlogged() async {
|
||||
|
|
|
@ -7,11 +7,14 @@ import 'sign_in_template_component_widget.dart'
|
|||
class SignInTemplateComponentModel
|
||||
extends FlutterFlowModel<SignInTemplateComponentWidget> {
|
||||
final formKey = GlobalKey<FormState>();
|
||||
|
||||
final unfocusNode = FocusNode();
|
||||
FocusNode? emailAddressFocusNode;
|
||||
TextEditingController? emailAddressTextController;
|
||||
String? Function(BuildContext, String?)? emailAddressTextControllerValidator;
|
||||
|
||||
SignInTemplateComponentModel();
|
||||
|
||||
String? _emailAddressTextControllerValidator(
|
||||
BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
|
@ -32,6 +35,7 @@ class SignInTemplateComponentModel
|
|||
TextEditingController? passwordTextController;
|
||||
late bool passwordVisibility;
|
||||
String? Function(BuildContext, String?)? passwordTextControllerValidator;
|
||||
|
||||
String? _passwordTextControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
|
|
Loading…
Reference in New Issue