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/main.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:patrol/patrol.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 '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:patrol/patrol.dart';
@ -66,7 +66,7 @@ void main() {
AuthenticationTest.signIn();
AuthenticationTest.signUp();
AuthenticationTest.signOut();
AuthenticationTest.recovery();
// AuthenticationTest.recovery();
ModularizationTest.switchLicense();
ModularizationTest.containLicense();
@ -77,4 +77,5 @@ void main() {
LocalsTest.setLocal();
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(

View File

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

View File

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

View File

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

View File

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