This commit is contained in:
J. A. Messias 2025-01-15 16:07:27 -03:00
parent a6dafe8b1e
commit e4915e7c0e
9 changed files with 141 additions and 100 deletions

View File

@ -40,20 +40,20 @@ void main() {
//init integration test //init integration test
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); IntegrationTestWidgetsFlutterBinding.ensureInitialized();
// WelcomeTest.signInToSignUp(); WelcomeTest.signInToSignUp();
// WelcomeTest.signUpToSignIn(); WelcomeTest.signUpToSignIn();
// //
// AuthenticationTest.signIn();
// AuthenticationTest.signUp();
// AuthenticationTest.signOut();
// ModularizationTest.switchLicense(); AuthenticationTest.signIn();
// ModularizationTest.containLicense(); AuthenticationTest.signUp();
// AuthenticationTest.signOut();
// MenuTest.navToEntries();
// MenuTest.containEntries(); ModularizationTest.switchLicense();
// MenuTest.labels2AppbarConsistency(); ModularizationTest.containLicense();
//
// LocalsTest.setLocal(); MenuTest.navToEntries();
MenuTest.containEntries();
MenuTest.labels2AppbarConsistency();
LocalsTest.setLocal();
LocalsTest.unlinkLocal(); LocalsTest.unlinkLocal();
} }

View File

@ -6,6 +6,8 @@ class AuthenticationTest {
'Sign-In with erro@exemplo.com', 'Sign-In with erro@exemplo.com',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole(
'Authentication Test - Sign-In with error@exemplo.com');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
final Map<String, String> credentials = { final Map<String, String> credentials = {
'emailTextFormField': 'erro@exemplo.com', 'emailTextFormField': 'erro@exemplo.com',
@ -24,15 +26,20 @@ class AuthenticationTest {
'Sign-In with email_app@exemplo.com', 'Sign-In with email_app@exemplo.com',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole(
'Authentication Test - Sign-In with email_app@exemplo.com');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
final Map<String, String> credentials = { final Map<String, String> credentials = {
'emailTextFormField': 'email_app@exemplo.com', 'emailTextFormField': 'email_app@exemplo.com',
'passwordTextFormField': '12345678', 'passwordTextFormField': '12345678',
}; };
await _unlogged(); await _unlogged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
await _navigateToSignIn($); await _navigateToSignIn($);
await _auth(credentials, $, throwsException); await _auth(credentials, $, throwsException);
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
}, },
); );
@ -43,6 +50,9 @@ class AuthenticationTest {
'Sign Up - credenciais já registradas', 'Sign Up - credenciais já registradas',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole(
'Authentication Test - Sign-Up: credenciais já registradas');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
final Map<String, String> credentials = { final Map<String, String> credentials = {
'nameTextFormField': 'app', 'nameTextFormField': 'app',
@ -61,6 +71,9 @@ class AuthenticationTest {
'Sign Up - credenciais novas', 'Sign Up - credenciais novas',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester
.printToConsole('Authentication Test - Sign-Up: credenciais novas');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
final name = _generateRandomString(7); final name = _generateRandomString(7);
final email = '$name@example.com'; final email = '$name@example.com';
@ -87,16 +100,25 @@ class AuthenticationTest {
'Deslogar da Conta', 'Deslogar da Conta',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole(
'Authentication Test - Sign-Out: Deslogar da Conta');
await _logged(); await _logged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidget(const App());
await $.waitUntilVisible($(MenuStaggeredView));
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
await $(Icons.menu_rounded).tap(); await $.waitUntilVisible($(MenuStaggeredView));
await $(Icons.menu_rounded) //
.waitUntilVisible()
.tap();
await $.waitUntilVisible($(MenuListView)); await $.waitUntilVisible($(MenuListView));
await $(Icons.exit_to_app) await $(Icons.exit_to_app)
.waitUntilVisible() .waitUntilVisible()
.tap(settlePolicy: SettlePolicy.trySettle); .tap(settlePolicy: SettlePolicy.trySettle);
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
}, },
); );

View File

@ -6,6 +6,8 @@ class LocalsTest {
'Selecionar um local disponível', // 'Selecionar um local disponível', //
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Locals Test - Selecionar um local disponível');
await _logged(); await _logged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
@ -44,88 +46,79 @@ class LocalsTest {
} }
static Future unlinkLocal() async { static Future unlinkLocal() async {
// patrolWidgetTest('Desvincular do local selecionado', // patrolWidgetTest('Desvincular do local selecionado', //
// (PatrolTester tester) async { (PatrolTester tester) async {
// $ = tester; $ = tester;
// await _logged(); $.tester.printToConsole('Locals Test - Desvincular do local selecionado');
// await $.pumpWidgetAndSettle(const App());
// await $.waitUntilVisible($(MenuStaggeredView)); await _logged();
// Future.delayed(const Duration(milliseconds: 500)); await $.pumpWidgetAndSettle(const App());
// await $.waitUntilVisible($(MenuStaggeredView));
// final PatrolFinder gridView = await $(GridView) // Future.delayed(const Duration(milliseconds: 500));
// .waitUntilVisible();
// final PatrolFinder entries = await $(gridView) final PatrolFinder gridView = await $(GridView) //
// .$(ButtonMenuItem) // .waitUntilVisible();
// .waitUntilVisible(); final PatrolFinder entries = await $(gridView)
// .$(ButtonMenuItem) //
// await $.pumpAndSettle(); .waitUntilVisible();
// expect(entries, findsWidgets);
// final PatrolFinder settings = await $(gridView) // await $.pumpAndSettle();
// .$(Icons.settings) expect(entries, findsWidgets);
// .waitUntilVisible(); final PatrolFinder settings = await $(gridView) //
// expect(settings, findsOneWidget); .$(Icons.settings)
// .waitUntilVisible();
// await $(settings).tap(); expect(settings, findsOneWidget);
//
// final PatrolFinder unlinkButton = await $(Symbols.digital_out_of_home) // await $(settings).tap();
// .waitUntilVisible();
// expect(unlinkButton, findsOneWidget); final PatrolFinder unlinkButton = await $(Symbols.digital_out_of_home) //
// await $(unlinkButton).tap(); .waitUntilVisible();
// expect(unlinkButton, findsOneWidget);
// await $('Sim') // await $(unlinkButton).tap();
// .waitUntilVisible()
// .tap(settlePolicy: SettlePolicy.noSettle); await $('Sim') //
// .waitUntilVisible()
// await $.pump(); .tap(settlePolicy: SettlePolicy.noSettle);
// await $.pump(const Duration(seconds: 1));
// await $.pump(); await $.pump();
// await $.pump(const Duration(seconds: 1));
// final PatrolFinder bottomSheetFinder = await $.pump();
// await $(BottomArrowLinkedLocalsComponentWidget) //
// .waitUntilVisible(); final PatrolFinder bottomSheetFinder =
// await $(BottomArrowLinkedLocalsComponentWidget) //
// await $.pump(const Duration(seconds: 1)); .waitUntilVisible();
// expect(bottomSheetFinder, findsOneWidget);
// await $.pump(const Duration(seconds: 1)); 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) await $.pump(const Duration(seconds: 1));
// .waitUntilVisible(); final PatrolFinder listViewFinder = await $(bottomSheetFinder) //
// .$(ListView)
// expect(listViewFinder, findsOneWidget); .waitUntilVisible();
//
// await $.pump(const Duration(seconds: 1)); expect(listViewFinder, findsOneWidget);
//
// final PatrolFinder entriesFinder = await $(listViewFinder) await $.pump(const Duration(seconds: 1));
// .$(CardItemTemplateComponentWidget)
// .waitUntilVisible(); final PatrolFinder entriesFinder = await $(listViewFinder)
// .$(CardItemTemplateComponentWidget)
// expect(entriesFinder, findsWidgets); .waitUntilVisible();
// await Future.delayed(const Duration(milliseconds: 500));
// return; expect(entriesFinder, findsWidgets);
// }); await Future.delayed(const Duration(milliseconds: 500));
return;
});
patrolWidgetTest( patrolWidgetTest(
'Vincular um local desvinculado', // 'Vincular um local desvinculado', //
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Locals Test - Vincular um local desvinculado');
await _logged(false); await _logged(false);
await $.pumpWidget(const App()); await $.pumpWidget(const App());
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 = final PatrolFinder bottomSheetFinder =
await $(BottomArrowLinkedLocalsComponentWidget) // await $(BottomArrowLinkedLocalsComponentWidget) //
.waitUntilVisible(); .waitUntilVisible();
@ -145,9 +138,8 @@ class LocalsTest {
if (entriesFinder.evaluate().isNotEmpty) { if (entriesFinder.evaluate().isNotEmpty) {
await $(entriesFinder.first).waitUntilVisible().tap(); await $(entriesFinder.first).waitUntilVisible().tap();
final String accept =
loc.getVariableText(enText: 'Yes', ptText: 'Sim'); await $(#AcceptOptionKey).waitUntilVisible().tap();
await $(accept).waitUntilVisible().tap();
} }
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));

View File

@ -6,6 +6,9 @@ class MenuTest {
'As labels dos menuItems correspondem aos títulos das AppBars?', // 'As labels dos menuItems correspondem aos títulos das AppBars?', //
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole(
'Menu Test - As labels dos menuItems correspondem aos títulos das AppBars?');
await _logged(); await _logged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
@ -54,6 +57,7 @@ class MenuTest {
'HomeMenu contém seus itens?', // 'HomeMenu contém seus itens?', //
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Menu Test - HomeMenu contém seus itens?');
await _logged(); await _logged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
@ -94,6 +98,7 @@ class MenuTest {
'DrawerMenu contém seus itens?', // 'DrawerMenu contém seus itens?', //
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Menu Test - DrawerMenu contém seus itens?');
await _logged(); await _logged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
@ -141,6 +146,7 @@ class MenuTest {
'Navegação entre items do Menu', 'Navegação entre items do Menu',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Menu Test - Navegação entre items do Menu');
await _logged(); await _logged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());

View File

@ -5,6 +5,9 @@ class ModularizationTest {
patrolWidgetTest('Os modulos de licença está sendo processados?', patrolWidgetTest('Os modulos de licença está sendo processados?',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole(
'Modularization Test - Os modulos de licença está sendo processados?');
await _logged(); await _logged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
@ -31,6 +34,8 @@ class ModularizationTest {
'Licença está sendo atualizada?', 'Licença está sendo atualizada?',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Licença está sendo atualizada?');
await _logged(); await _logged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());

View File

@ -49,12 +49,12 @@ Future<void> _unlogged() async {
} }
Future<void> _navigateToSignIn(PatrolTester $) async { Future<void> _navigateToSignIn(PatrolTester $) async {
final signInButton = $(#toggleSignInPage); final signInButton = $(#toggleSignInPage).waitUntilVisible();
await signInButton.tap(); await signInButton.tap();
} }
Future<void> _navigateToSignUp(PatrolTester $) async { Future<void> _navigateToSignUp(PatrolTester $) async {
final signUpButton = $(#toggleSignUpPage); final signUpButton = $(#toggleSignUpPage).waitUntilVisible();
await signUpButton.tap(); await signUpButton.tap();
} }

View File

@ -6,6 +6,7 @@ class WelcomeTest {
'Sign-In to Sign-Up', 'Sign-In to Sign-Up',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Welcome Test - Sign-In to Sign-Up');
await _unlogged(); await _unlogged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
await _navigateToSignIn($); await _navigateToSignIn($);
@ -19,6 +20,7 @@ class WelcomeTest {
'Sign-Up to Sign-In', 'Sign-Up to Sign-In',
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Welcome Test - Sign-Up to Sign-In');
await _unlogged(); await _unlogged();
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
await _navigateToSignUp($); await _navigateToSignUp($);

View File

@ -1,14 +1,15 @@
import 'package:easy_debounce/easy_debounce.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/utils/limited_text_size.dart'; import 'package:hub/shared/utils/limited_text_size.dart';
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart'; import '/flutter_flow/flutter_flow_widgets.dart';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'qr_code_pass_key_template_component_model.dart'; import 'qr_code_pass_key_template_component_model.dart';
export 'qr_code_pass_key_template_component_model.dart'; export 'qr_code_pass_key_template_component_model.dart';
class QrCodePassKeyTemplateComponentWidget extends StatefulWidget { class QrCodePassKeyTemplateComponentWidget extends StatefulWidget {

View File

@ -390,6 +390,7 @@ String formatNumber(
} }
DateTime get getCurrentTimestamp => DateTime.now(); DateTime get getCurrentTimestamp => DateTime.now();
DateTime dateTimeFromSecondsSinceEpoch(int seconds) { DateTime dateTimeFromSecondsSinceEpoch(int seconds) {
return DateTime.fromMillisecondsSinceEpoch(seconds * 1000); return DateTime.fromMillisecondsSinceEpoch(seconds * 1000);
} }
@ -400,8 +401,11 @@ extension DateTimeConversionExtension on DateTime {
extension DateTimeComparisonOperators on DateTime { extension DateTimeComparisonOperators on DateTime {
bool operator <(DateTime other) => isBefore(other); bool operator <(DateTime other) => isBefore(other);
bool operator >(DateTime other) => isAfter(other); bool operator >(DateTime other) => isAfter(other);
bool operator <=(DateTime other) => this < other || isAtSameMomentAs(other); bool operator <=(DateTime other) => this < other || isAtSameMomentAs(other);
bool operator >=(DateTime other) => this > other || isAtSameMomentAs(other); bool operator >=(DateTime other) => this > other || isAtSameMomentAs(other);
} }
@ -457,14 +461,18 @@ Rect? getWidgetBoundingBox(BuildContext context) {
} }
bool get isAndroid => !kIsWeb && Platform.isAndroid; bool get isAndroid => !kIsWeb && Platform.isAndroid;
bool get isiOS => !kIsWeb && Platform.isIOS; bool get isiOS => !kIsWeb && Platform.isIOS;
bool get isWeb => kIsWeb; bool get isWeb => kIsWeb;
const kBreakpointSmall = 479.0; const kBreakpointSmall = 479.0;
const kBreakpointMedium = 767.0; const kBreakpointMedium = 767.0;
const kBreakpointLarge = 991.0; const kBreakpointLarge = 991.0;
bool isMobileWidth(BuildContext context) => bool isMobileWidth(BuildContext context) =>
MediaQuery.sizeOf(context).width < kBreakpointSmall; MediaQuery.sizeOf(context).width < kBreakpointSmall;
bool responsiveVisibility({ bool responsiveVisibility({
required BuildContext context, required BuildContext context,
bool phone = true, bool phone = true,
@ -493,6 +501,7 @@ const kTextValidatorWebsiteRegex =
extension FFTextEditingControllerExt on TextEditingController? { extension FFTextEditingControllerExt on TextEditingController? {
String get text => this == null ? '' : this!.text; String get text => this == null ? '' : this!.text;
set text(String newText) => this?.text = newText; set text(String newText) => this?.text = newText;
} }
@ -574,6 +583,7 @@ void showAlertDialog(BuildContext context, String title, String content,
context: context, context: context,
builder: (context) { builder: (context) {
return AlertDialog( return AlertDialog(
key: ValueKey<String>('AlertDialogKey'),
backgroundColor: FlutterFlowTheme.of(context).primaryBackground, backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
title: Text(title, title: Text(title,
style: TextStyle( style: TextStyle(
@ -593,6 +603,7 @@ void showAlertDialog(BuildContext context, String title, String content,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
FFButtonWidget( FFButtonWidget(
key: ValueKey<String>('RejectOptionKey'),
onPressed: () => context.pop(), //Navigator.pop(context), onPressed: () => context.pop(), //Navigator.pop(context),
options: FFButtonOptions( options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3, width: MediaQuery.of(context).size.width * 0.3,
@ -615,6 +626,7 @@ void showAlertDialog(BuildContext context, String title, String content,
), ),
), ),
FFButtonWidget( FFButtonWidget(
key: ValueKey<String>('AcceptOptionKey'),
onPressed: () async { onPressed: () async {
action(); action();
}, },
@ -707,6 +719,7 @@ extension StatefulWidgetExtensions on State<StatefulWidget> {
// For iOS 16 and below, set the status bar color to match the app's theme. // For iOS 16 and below, set the status bar color to match the app's theme.
// https://github.com/flutter/flutter/issues/41067 // https://github.com/flutter/flutter/issues/41067
Brightness? _lastBrightness; Brightness? _lastBrightness;
void fixStatusBarOniOS16AndBelow(BuildContext context) { void fixStatusBarOniOS16AndBelow(BuildContext context) {
if (!isiOS) { if (!isiOS) {
return; return;