Merge branch 'develop' into fix/crashlytics

This commit is contained in:
jantunesmessias 2025-01-30 08:50:06 -03:00
commit db0560225d
6 changed files with 78 additions and 62 deletions

View File

@ -25,15 +25,15 @@ import 'package:hub/flutter_flow/index.dart';
import 'package:hub/initialization.dart'; import 'package:hub/initialization.dart';
import 'package:hub/main.dart'; import 'package:hub/main.dart';
import 'package:hub/pages/forgot_password_page/forgot_password_screen.dart'; import 'package:hub/pages/forgot_password_page/forgot_password_screen.dart';
import 'package:integration_test/integration_test.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:patrol/patrol.dart';
import 'package:flutter_web_plugins/url_strategy.dart'; import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:patrol_finders/patrol_finders.dart'; import 'package:patrol/patrol.dart';
import 'app_test.dart'; import 'app_test.dart';
import 'fuzzer/fuzzer.dart'; import 'fuzzer/fuzzer.dart';
import 'package:patrol_finders/patrol_finders.dart';
import 'package:integration_test/integration_test.dart';
export 'package:flutter_test/flutter_test.dart'; export 'package:flutter_test/flutter_test.dart';
export 'package:patrol/patrol.dart'; export 'package:patrol/patrol.dart';
@ -66,7 +66,7 @@ void main() {
AuthenticationTest.signIn(); AuthenticationTest.signIn();
AuthenticationTest.signUp(); AuthenticationTest.signUp();
AuthenticationTest.signOut(); AuthenticationTest.signOut();
AuthenticationTest.recovery(); // AuthenticationTest.recovery();
ModularizationTest.switchLicense(); ModularizationTest.switchLicense();
ModularizationTest.containLicense(); ModularizationTest.containLicense();
@ -77,4 +77,5 @@ void main() {
LocalsTest.setLocal(); LocalsTest.setLocal();
LocalsTest.unlinkLocal(); LocalsTest.unlinkLocal();
LocalsTest.attachLocal();
} }

View File

@ -195,7 +195,28 @@ class AuthenticationTest {
); );
} }
static void recovery() async {} static void recovery() async {
patrol('Open url in the app', ($) async {
await _loggedWithMultiLocalsAccount();
await $.pumpWidget(const App());
await $.waitUntilVisible($(MenuStaggeredView));
// await $.native.pressHome();
// final String browserId = 'com.android.chrome';
// await $.native.openApp(appId: browserId);
await $.native.openUrl(//
'https://freaccess.com.br/freaccess/alterarSenha.php?email=freaccesshub@gmail.com&token=67939240e12c31.10412525');
await $.pumpAndSettle();
Future.delayed(Duration(seconds: 3));
await $.pump(Duration(seconds: 3));
await $.pumpAndSettle();
final PatrolFinder forgotPassword =
await $(#ForgotPasswordScreen).waitUntilVisible();
expect(forgotPassword, findsOneWidget);
});
}
} }
Future<void> _auth( Future<void> _auth(

View File

@ -12,7 +12,7 @@ final _nativeAutomatorConfig = NativeAutomatorConfig(
void patrol( void patrol(
String description, String description,
Future<void> Function(PatrolTester) callback, { Future<void> Function(PatrolIntegrationTester) callback, {
bool? skip, bool? skip,
List<String> tags = const [], List<String> tags = const [],
NativeAutomatorConfig? nativeAutomatorConfig, NativeAutomatorConfig? nativeAutomatorConfig,

View File

@ -303,73 +303,61 @@ class LocalsTest {
static Future attachLocal() async { static Future attachLocal() async {
patrolWidgetTest( patrolWidgetTest(
'Selecionar um local disponível com multíplos locais disponíveis', // 'Auto-Validação de Locais com Multiplos Locais', //
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
await _loggedWithMultiLocalsAccount(); $.tester.printToConsole('Locals Test - Vincular um local desvinculado');
await _loggedWithMultiLocalsAccount(false);
await $.pumpWidget(const App()); await $.pumpWidget(const App());
late Map<String, String> credentials;
final PatrolFinder throwsException = $('');
var name = ff.randomString(7, 7, true, true, true); final PatrolFinder bottomSheetFinder =
var email = '$name@example.com'; await $(BottomArrowLinkedLocalsComponentWidget) //
var password = '12345678'; .waitUntilVisible();
credentials = { expect(bottomSheetFinder, findsOneWidget);
'nameTextFormField': name,
'emailTextFormField': email,
'passwordTextFormField': password
};
await $.pumpWidget(const App()); await $.pump(const Duration(milliseconds: 500));
await _navigateToSignUp($);
await _auth(credentials, $, throwsException); final PatrolFinder listViewFinder = $(bottomSheetFinder) //
credentials = { .$(ListView);
'emailTextFormField': email, expect(listViewFinder, findsOneWidget);
'passwordTextFormField': password
}; await $.pump(const Duration(milliseconds: 500));
await _auth(credentials, $, throwsException);
final PatrolFinder entriesFinder = $(listViewFinder) //
.$(CardItemTemplateComponentWidget);
expect(entriesFinder, findsWidgets);
await $.pumpAndSettle();
await StorageHelper() //
.set(ProfileStorageKey.clientUUID.key, '7');
await $.pumpAndSettle();
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
return;
}, },
); );
patrolWidgetTest( patrolWidgetTest(
'Selecionar um local disponível com somente um local disponível', // 'Auto-Validação de Locais com local unico', //
(PatrolTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
await _loggedWithSomeoneLocalAccount(); $.tester.printToConsole('Locals Test - Vincular um local desvinculado');
await _loggedWithSomeoneLocalAccount(false);
await $.pumpWidget(const App()); await $.pumpWidget(const App());
late Map<String, String> credentials;
final PatrolFinder throwsException = $('');
var name = ff.randomString(7, 7, true, true, true); final PatrolFinder bottomSheetFinder =
var email = '$name@example.com'; await $(BottomArrowLinkedLocalsComponentWidget) //
var password = '12345678'; .waitUntilVisible();
credentials = { expect(bottomSheetFinder, findsOneWidget);
'nameTextFormField': name,
'emailTextFormField': email,
'passwordTextFormField': password
};
await $.pumpWidget(const App()); await $.pump(const Duration(milliseconds: 500));
await _navigateToSignUp($);
await _auth(credentials, $, throwsException); final PatrolFinder listViewFinder = $(bottomSheetFinder) //
credentials = { .$(ListView);
'emailTextFormField': email, expect(listViewFinder, findsOneWidget);
'passwordTextFormField': password
}; await $.pump(const Duration(milliseconds: 500));
await _auth(credentials, $, throwsException);
final PatrolFinder entriesFinder = $(listViewFinder) //
.$(CardItemTemplateComponentWidget);
expect(entriesFinder, findsWidgets);
await $.pumpAndSettle();
await StorageHelper() //
.set(ProfileStorageKey.clientUUID.key, '7');
await $.pumpAndSettle();
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
return;
}, },
); );
} }

View File

@ -151,11 +151,13 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
@override @override
Future<bool> checkLocals(BuildContext context) async { Future<bool> checkLocals(BuildContext context) async {
String cliUUID = final String? cliUUID =
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; await StorageHelper().get(ProfileStorageKey.clientUUID.key);
String cliName = final String? cliName =
(await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? ''; await StorageHelper().get(ProfileStorageKey.clientName.key);
return cliUUID.isEmpty && cliName.isEmpty; final haveCli = cliUUID != null && cliUUID.isNotEmpty;
final haveName = cliName != null && cliName.isNotEmpty;
return haveCli && haveName;
} }
@override @override

View File

@ -56,6 +56,7 @@ class LocalsRepositoryImpl implements LocalsRepository {
final bool haveCli = cliUUID != null && cliUUID.isNotEmpty; final bool haveCli = cliUUID != null && cliUUID.isNotEmpty;
final bool haveOwner = ownerUUID != null && ownerUUID.isNotEmpty; final bool haveOwner = ownerUUID != null && ownerUUID.isNotEmpty;
if (!haveCli && !haveOwner) { if (!haveCli && !haveOwner) {
log('No client or owner selected');
await update(context); await update(context);
await FirebaseMessagingService().updateDeviceToken(); await FirebaseMessagingService().updateDeviceToken();
} }
@ -64,7 +65,8 @@ class LocalsRepositoryImpl implements LocalsRepository {
Future<bool> _handleLocal(BuildContext context) async { Future<bool> _handleLocal(BuildContext context) async {
bool response = false; bool response = false;
final bool isUnselected = await remoteDataSource.checkLocals(context); final bool isUnselected = await remoteDataSource.checkLocals(context);
if (isUnselected) { if (!isUnselected) {
log('_handleLocal -> No local selected');
while (!response) { while (!response) {
try { try {
response = await remoteDataSource.processLocals(context); response = await remoteDataSource.processLocals(context);
@ -77,6 +79,8 @@ class LocalsRepositoryImpl implements LocalsRepository {
} }
} }
} else { } else {
log('_handleLocal -> Local selected');
return true; return true;
} }