This commit is contained in:
J. A. Messias 2025-01-29 15:37:06 -03:00
parent f3c83938e9
commit 1b06c57ef2
8 changed files with 107 additions and 166 deletions

View File

@ -29,6 +29,7 @@ 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: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 'app_test.dart'; import 'app_test.dart';
import 'fuzzer/fuzzer.dart'; import 'fuzzer/fuzzer.dart';
@ -50,7 +51,7 @@ part 'storage_test.dart';
part 'utils_test.dart'; part 'utils_test.dart';
part 'welcome_test.dart'; part 'welcome_test.dart';
late PatrolIntegrationTester $; late PatrolTester $;
void main() { void main() {
//init integration test //init integration test

View File

@ -2,9 +2,9 @@ part of 'app_test.dart';
class AuthenticationTest { class AuthenticationTest {
static Future<void> signIn() async { static Future<void> signIn() async {
patrol( patrolWidgetTest(
'Sign-In with fuzzed emails', 'Sign-In with fuzzed emails',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Authentication Test - Sign-In with fuzzed emails'); $.tester.printToConsole('Authentication Test - Sign-In with fuzzed emails');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
@ -57,9 +57,9 @@ class AuthenticationTest {
}, },
); );
patrol( patrolWidgetTest(
'Sign-In with email_app@exemplo.com', 'Sign-In with email_app@exemplo.com',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Authentication Test - Sign-In with email_app@exemplo.com'); $.tester.printToConsole('Authentication Test - Sign-In with email_app@exemplo.com');
@ -78,9 +78,9 @@ class AuthenticationTest {
} }
static Future<void> signUp() async { static Future<void> signUp() async {
patrol( patrolWidgetTest(
'Sign Up - credenciais já registradas', 'Sign Up - credenciais já registradas',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Authentication Test - Sign-Up: credenciais já registradas'); $.tester.printToConsole('Authentication Test - Sign-Up: credenciais já registradas');
@ -98,9 +98,9 @@ class AuthenticationTest {
}, },
); );
patrol( patrolWidgetTest(
'Sign Up - credenciais novas', 'Sign Up - credenciais novas',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Authentication Test - Sign-Up: credenciais novas'); $.tester.printToConsole('Authentication Test - Sign-Up: credenciais novas');
@ -164,9 +164,9 @@ class AuthenticationTest {
} }
static Future<void> signOut() async { static Future<void> signOut() async {
patrol( patrolWidgetTest(
'Deslogar da Conta', 'Deslogar da Conta',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Authentication Test - Sign-Out: Deslogar da Conta'); $.tester.printToConsole('Authentication Test - Sign-Out: Deslogar da Conta');
@ -187,31 +187,31 @@ class AuthenticationTest {
} }
static void recovery() async { static void recovery() async {
patrol('Open url in the app', ($) async { // patrolWidgetTest('Open url in the app', ($) async {
await _loggedWithMultiLocalsAccount($); // await _loggedWithMultiLocalsAccount($);
await $.pumpWidget(const App()); // await $.pumpWidget(const App());
await $.waitUntilVisible($(MenuStaggeredView)); // await $.waitUntilVisible($(MenuStaggeredView));
// await $.native.pressHome(); // // await $.native.pressHome();
// final String browserId = 'com.android.chrome'; // // final String browserId = 'com.android.chrome';
// await $.native.openApp(appId: browserId); // // await $.native.openApp(appId: browserId);
await $.native.openUrl(// // await $.native.openUrl(//
'https://freaccess.com.br/freaccess/alterarSenha.php?email=freaccesshub@gmail.com&token=67939240e12c31.10412525'); // 'https://freaccess.com.br/freaccess/alterarSenha.php?email=freaccesshub@gmail.com&token=67939240e12c31.10412525');
await $.pumpAndSettle(); // await $.pumpAndSettle();
Future.delayed(Duration(seconds: 3)); // Future.delayed(Duration(seconds: 3));
await $.pump(Duration(seconds: 3)); // await $.pump(Duration(seconds: 3));
await $.pumpAndSettle(); // await $.pumpAndSettle();
final PatrolFinder forgotPassword = await $(#ForgotPasswordScreen).waitUntilVisible(); // final PatrolFinder forgotPassword = await $(#ForgotPasswordScreen).waitUntilVisible();
expect(forgotPassword, findsOneWidget); // expect(forgotPassword, findsOneWidget);
}); // });
} }
} }
Future<void> _auth( Future<void> _auth(
Map<String, String> credentials, Map<String, String> credentials,
PatrolIntegrationTester $, PatrolTester $,
PatrolFinder throwsException, PatrolFinder throwsException,
) async { ) async {
await _enterCredentials(credentials, $); await _enterCredentials(credentials, $);
@ -220,7 +220,7 @@ Future<void> _auth(
Future<void> _enterCredentials( Future<void> _enterCredentials(
Map<String, String> credentials, Map<String, String> credentials,
PatrolIntegrationTester $, PatrolTester $,
) async { ) async {
for (var entry in credentials.entries) { for (var entry in credentials.entries) {
await $(ValueKey(entry.key)) // await $(ValueKey(entry.key)) //
@ -230,7 +230,7 @@ Future<void> _enterCredentials(
} }
} }
Future<void> _submit(String key, PatrolIntegrationTester $, PatrolFinder throwsException) async { Future<void> _submit(String key, PatrolTester $, PatrolFinder throwsException) async {
await $(ValueKey(key)) // await $(ValueKey(key)) //
.waitUntilVisible() .waitUntilVisible()
.tap(); .tap();

View File

@ -16,8 +16,7 @@ void patrol(
bool? skip, bool? skip,
List<String> tags = const [], List<String> tags = const [],
NativeAutomatorConfig? nativeAutomatorConfig, NativeAutomatorConfig? nativeAutomatorConfig,
LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fadePointers,
LiveTestWidgetsFlutterBindingFramePolicy.fadePointers,
}) { }) {
patrolTest( patrolTest(
description, description,

View File

@ -46,9 +46,9 @@ class LocalsTest {
// } // }
// }, // },
// ); // );
patrol( patrolWidgetTest(
'Selecionar um local disponível com somente um local disponivel', // 'Selecionar um local disponível com somente um local disponivel', //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Locals Test - Selecionar um local disponível'); $.tester.printToConsole('Locals Test - Selecionar um local disponível');
@ -57,8 +57,7 @@ class LocalsTest {
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
await $.waitUntilVisible($(LocalProfileComponentWidget)); await $.waitUntilVisible($(LocalProfileComponentWidget));
final PatrolFinder profileFinder = final PatrolFinder profileFinder = $(#AsyncLocalProfileComponentWidget_InkWell);
$(#AsyncLocalProfileComponentWidget_InkWell);
expect(profileFinder, findsOneWidget); expect(profileFinder, findsOneWidget);
await $(profileFinder) // await $(profileFinder) //
@ -184,12 +183,10 @@ class LocalsTest {
// // } // // }
// }, // },
// ); // );
patrol( patrolWidgetTest('Desvincular do local selecionado com somente um local disponivel', //
'Desvincular do local selecionado com somente um local disponivel', // (PatrolTester tester) async {
(PatrolIntegrationTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole( $.tester.printToConsole('Locals Test - Desvincular do local selecionado com multiplos locais disponiveis');
'Locals Test - Desvincular do local selecionado com multiplos locais disponiveis');
await _loggedWithSomeoneLocalAccount($); await _loggedWithSomeoneLocalAccount($);
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
@ -228,9 +225,8 @@ class LocalsTest {
await $.pump(const Duration(seconds: 1)); await $.pump(const Duration(seconds: 1));
await $.pump(); await $.pump();
final PatrolFinder bottomSheetFinder = final PatrolFinder bottomSheetFinder = await $(BottomArrowLinkedLocalsComponentWidget) //
await $(BottomArrowLinkedLocalsComponentWidget) // .waitUntilVisible();
.waitUntilVisible();
expect(bottomSheetFinder, findsOneWidget); expect(bottomSheetFinder, findsOneWidget);
@ -240,25 +236,22 @@ class LocalsTest {
expect(listViewFinder, findsOneWidget); expect(listViewFinder, findsOneWidget);
final PatrolFinder entriesFinder = await $(listViewFinder) final PatrolFinder entriesFinder = await $(listViewFinder).$(CardItemTemplateComponentWidget).waitUntilVisible();
.$(CardItemTemplateComponentWidget)
.waitUntilVisible();
expect(entriesFinder, findsWidgets); expect(entriesFinder, findsWidgets);
}); });
patrol( patrolWidgetTest(
'Vincular um local desvinculado com somente um local disponivel', // 'Vincular um local desvinculado com somente um local disponivel', //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Locals Test - Vincular um local desvinculado'); $.tester.printToConsole('Locals Test - Vincular um local desvinculado');
await _loggedWithSomeoneLocalAccount($, false); await _loggedWithSomeoneLocalAccount($, false);
await $.pumpWidget(const App()); await $.pumpWidget(const App());
final PatrolFinder bottomSheetFinder = final PatrolFinder bottomSheetFinder = await $(BottomArrowLinkedLocalsComponentWidget) //
await $(BottomArrowLinkedLocalsComponentWidget) // .waitUntilVisible();
.waitUntilVisible();
expect(bottomSheetFinder, findsOneWidget); expect(bottomSheetFinder, findsOneWidget);
await $.pump(const Duration(milliseconds: 500)); await $.pump(const Duration(milliseconds: 500));
@ -302,9 +295,9 @@ class LocalsTest {
} }
static Future attachLocal() async { static Future attachLocal() async {
patrol( patrolWidgetTest(
'Selecionar um local disponível com multíplos locais disponíveis', // 'Selecionar um local disponível com multíplos locais disponíveis', //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
await _loggedWithMultiLocalsAccount($); await _loggedWithMultiLocalsAccount($);
await $.pumpWidget(const App()); await $.pumpWidget(const App());
@ -314,19 +307,12 @@ class LocalsTest {
var name = ff.randomString(7, 7, true, true, true); var name = ff.randomString(7, 7, true, true, true);
var email = '$name@example.com'; var email = '$name@example.com';
var password = '12345678'; var password = '12345678';
credentials = { credentials = {'nameTextFormField': name, 'emailTextFormField': email, 'passwordTextFormField': password};
'nameTextFormField': name,
'emailTextFormField': email,
'passwordTextFormField': password
};
await $.pumpWidget(const App()); await $.pumpWidget(const App());
await _navigateToSignUp($); await _navigateToSignUp($);
await _auth(credentials, $, throwsException); await _auth(credentials, $, throwsException);
credentials = { credentials = {'emailTextFormField': email, 'passwordTextFormField': password};
'emailTextFormField': email,
'passwordTextFormField': password
};
await _auth(credentials, $, throwsException); await _auth(credentials, $, throwsException);
await $.pumpAndSettle(); await $.pumpAndSettle();
@ -337,9 +323,9 @@ class LocalsTest {
return; return;
}, },
); );
patrol( patrolWidgetTest(
'Selecionar um local disponível com somente um local disponível', // 'Selecionar um local disponível com somente um local disponível', //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
await _loggedWithSomeoneLocalAccount($); await _loggedWithSomeoneLocalAccount($);
await $.pumpWidget(const App()); await $.pumpWidget(const App());
@ -349,19 +335,12 @@ class LocalsTest {
var name = ff.randomString(7, 7, true, true, true); var name = ff.randomString(7, 7, true, true, true);
var email = '$name@example.com'; var email = '$name@example.com';
var password = '12345678'; var password = '12345678';
credentials = { credentials = {'nameTextFormField': name, 'emailTextFormField': email, 'passwordTextFormField': password};
'nameTextFormField': name,
'emailTextFormField': email,
'passwordTextFormField': password
};
await $.pumpWidget(const App()); await $.pumpWidget(const App());
await _navigateToSignUp($); await _navigateToSignUp($);
await _auth(credentials, $, throwsException); await _auth(credentials, $, throwsException);
credentials = { credentials = {'emailTextFormField': email, 'passwordTextFormField': password};
'emailTextFormField': email,
'passwordTextFormField': password
};
await _auth(credentials, $, throwsException); await _auth(credentials, $, throwsException);
await $.pumpAndSettle(); await $.pumpAndSettle();

View File

@ -2,13 +2,12 @@ part of 'app_test.dart';
class MenuTest { class MenuTest {
static Future labels2AppbarConsistency() async { static Future labels2AppbarConsistency() async {
patrol( patrolWidgetTest(
'As labels dos menuItems correspondem aos títulos das AppBars? (MultiLocais)', 'As labels dos menuItems correspondem aos títulos das AppBars? (MultiLocais)',
// //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole( $.tester.printToConsole('Menu Test - As labels dos menuItems correspondem aos títulos das AppBars?');
'Menu Test - As labels dos menuItems correspondem aos títulos das AppBars?');
await _loggedWithMultiLocalsAccount($); await _loggedWithMultiLocalsAccount($);
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
@ -16,18 +15,15 @@ class MenuTest {
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
await $.waitUntilVisible($(LocalProfileComponentWidget)); await $.waitUntilVisible($(LocalProfileComponentWidget));
final PatrolFinder profileFinder = final PatrolFinder profileFinder = await $(#AsyncLocalProfileComponentWidget_InkWell).waitUntilVisible();
await $(#AsyncLocalProfileComponentWidget_InkWell)
.waitUntilVisible();
expect(profileFinder, findsOneWidget); expect(profileFinder, findsOneWidget);
await $(profileFinder) // await $(profileFinder) //
.waitUntilVisible() .waitUntilVisible()
.tap(); .tap();
final PatrolFinder bottomSheetFinder = final PatrolFinder bottomSheetFinder = await $(BottomArrowLinkedLocalsComponentWidget) //
await $(BottomArrowLinkedLocalsComponentWidget) // .waitUntilVisible();
.waitUntilVisible();
expect(bottomSheetFinder, findsOneWidget); expect(bottomSheetFinder, findsOneWidget);
final PatrolFinder listViewFinder = await $(bottomSheetFinder) // final PatrolFinder listViewFinder = await $(bottomSheetFinder) //
@ -49,14 +45,10 @@ class MenuTest {
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
await $.waitUntilVisible($(LocalProfileComponentWidget)); await $.waitUntilVisible($(LocalProfileComponentWidget));
final List<String> routes = MenuEntry.entries final List<String> routes =
.where((entry) => entry.key != 'FRE-HUB-LOGOUT') MenuEntry.entries.where((entry) => entry.key != 'FRE-HUB-LOGOUT').map((entry) => entry.route).toList();
.map((entry) => entry.route) final List<String> titles =
.toList(); MenuEntry.entries.where((entry) => entry.key != 'FRE-HUB-LOGOUT').map((entry) => entry.name).toList();
final List<String> titles = MenuEntry.entries
.where((entry) => entry.key != 'FRE-HUB-LOGOUT')
.map((entry) => entry.name)
.toList();
final LinkedHashMap<String, String> routesTitles = LinkedHashMap // final LinkedHashMap<String, String> routesTitles = LinkedHashMap //
.fromIterables(routes, titles); .fromIterables(routes, titles);
@ -96,9 +88,9 @@ class MenuTest {
} }
static Future containEntries() async { static Future containEntries() async {
patrol( patrolWidgetTest(
'HomeMenu contém seus itens? (MultiLocais)', // 'HomeMenu contém seus itens? (MultiLocais)', //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Menu Test - HomeMenu contém seus itens?'); $.tester.printToConsole('Menu Test - HomeMenu contém seus itens?');
@ -127,17 +119,15 @@ class MenuTest {
await $.pumpAndSettle(); await $.pumpAndSettle();
final List<MenuEntry> entries = MenuEntry.entries; final List<MenuEntry> entries = MenuEntry.entries;
await $.pumpAndSettle(); await $.pumpAndSettle();
final List<String> entriesKey = entries final List<String> entriesKey =
.where((entry) => entry.types.contains(MenuEntryType.Home)) entries.where((entry) => entry.types.contains(MenuEntryType.Home)).map((entry) => entry.key).toList();
.map((entry) => entry.key)
.toList();
await $.pumpAndSettle(); await $.pumpAndSettle();
expect(entriesKey, containsAll(menuKeys)); expect(entriesKey, containsAll(menuKeys));
}, },
); );
patrol( patrolWidgetTest(
'HomeMenu contém seus itens? (MonoLocal)', // 'HomeMenu contém seus itens? (MonoLocal)', //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Menu Test - HomeMenu contém seus itens?'); $.tester.printToConsole('Menu Test - HomeMenu contém seus itens?');
@ -166,18 +156,16 @@ class MenuTest {
await $.pumpAndSettle(); await $.pumpAndSettle();
final List<MenuEntry> entries = MenuEntry.entries; final List<MenuEntry> entries = MenuEntry.entries;
await $.pumpAndSettle(); await $.pumpAndSettle();
final List<String> entriesKey = entries final List<String> entriesKey =
.where((entry) => entry.types.contains(MenuEntryType.Home)) entries.where((entry) => entry.types.contains(MenuEntryType.Home)).map((entry) => entry.key).toList();
.map((entry) => entry.key)
.toList();
await $.pumpAndSettle(); await $.pumpAndSettle();
expect(entriesKey, containsAll(menuKeys)); expect(entriesKey, containsAll(menuKeys));
}, },
); );
patrol( patrolWidgetTest(
'DrawerMenu contém seus itens? (MultiLocais)', // 'DrawerMenu contém seus itens? (MultiLocais)', //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Menu Test - DrawerMenu contém seus itens?'); $.tester.printToConsole('Menu Test - DrawerMenu contém seus itens?');
@ -213,18 +201,16 @@ class MenuTest {
await $.pumpAndSettle(); await $.pumpAndSettle();
final List<MenuEntry> entries = MenuEntry.entries; final List<MenuEntry> entries = MenuEntry.entries;
await $.pumpAndSettle(); await $.pumpAndSettle();
final List<String> entriesKey = entries final List<String> entriesKey =
.where((entry) => entry.types.contains(MenuEntryType.Drawer)) entries.where((entry) => entry.types.contains(MenuEntryType.Drawer)).map((entry) => entry.key).toList();
.map((entry) => entry.key)
.toList();
await $.pumpAndSettle(); await $.pumpAndSettle();
expect(entriesKey, containsAll(menuKeys)); expect(entriesKey, containsAll(menuKeys));
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
}, },
); );
patrol( patrolWidgetTest(
'DrawerMenu contém seus itens? (MonoLocal)', // 'DrawerMenu contém seus itens? (MonoLocal)', //
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Menu Test - DrawerMenu contém seus itens?'); $.tester.printToConsole('Menu Test - DrawerMenu contém seus itens?');
@ -260,10 +246,8 @@ class MenuTest {
await $.pumpAndSettle(); await $.pumpAndSettle();
final List<MenuEntry> entries = MenuEntry.entries; final List<MenuEntry> entries = MenuEntry.entries;
await $.pumpAndSettle(); await $.pumpAndSettle();
final List<String> entriesKey = entries final List<String> entriesKey =
.where((entry) => entry.types.contains(MenuEntryType.Drawer)) entries.where((entry) => entry.types.contains(MenuEntryType.Drawer)).map((entry) => entry.key).toList();
.map((entry) => entry.key)
.toList();
await $.pumpAndSettle(); await $.pumpAndSettle();
expect(entriesKey, containsAll(menuKeys)); expect(entriesKey, containsAll(menuKeys));
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
@ -272,9 +256,9 @@ class MenuTest {
} }
static Future navToEntries() async { static Future navToEntries() async {
patrol( patrolWidgetTest(
'Navegação entre items do Menu (MultiLocais)', 'Navegação entre items do Menu (MultiLocais)',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Menu Test - Navegação entre items do Menu'); $.tester.printToConsole('Menu Test - Navegação entre items do Menu');
@ -282,17 +266,12 @@ class MenuTest {
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
final PatrolFinder profile = final PatrolFinder profile = $(const Key('AsyncLocalProfileComponentWidget_InkWell'));
$(const Key('AsyncLocalProfileComponentWidget_InkWell')); await $(profile).waitUntilVisible().tap(settlePolicy: SettlePolicy.noSettle);
await $(profile)
.waitUntilVisible()
.tap(settlePolicy: SettlePolicy.noSettle);
await $.waitUntilVisible($(BottomArrowLinkedLocalsComponentWidget)); await $.waitUntilVisible($(BottomArrowLinkedLocalsComponentWidget));
final PatrolFinder local = $('FRE ACCESS DEMO'); final PatrolFinder local = $('FRE ACCESS DEMO');
await $(local) await $(local).waitUntilVisible().tap(settlePolicy: SettlePolicy.noSettle);
.waitUntilVisible()
.tap(settlePolicy: SettlePolicy.noSettle);
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
@ -321,8 +300,7 @@ class MenuTest {
timeout: Duration(seconds: 1), timeout: Duration(seconds: 1),
); );
final ButtonMenuItem entry = final ButtonMenuItem entry = $.tester.widget<ButtonMenuItem>(gridEntries.at(i));
$.tester.widget<ButtonMenuItem>(gridEntries.at(i));
final Key? widgetKey = entry.key; final Key? widgetKey = entry.key;
expect(widgetKey, isNotNull); expect(widgetKey, isNotNull);
@ -332,18 +310,14 @@ class MenuTest {
if (widgetKey == ValueKey<String>('FRE-HUB-RESERVATIONS')) continue; if (widgetKey == ValueKey<String>('FRE-HUB-RESERVATIONS')) continue;
if (widgetKey == ValueKey<String>('FRE-HUB-SETTINGS')) continue; if (widgetKey == ValueKey<String>('FRE-HUB-SETTINGS')) continue;
await $(gridEntries.at(i)) await $(gridEntries.at(i)).waitUntilVisible(timeout: const Duration(seconds: 1)).tap(
.waitUntilVisible(timeout: const Duration(seconds: 1))
.tap(
settleTimeout: const Duration(seconds: 1), settleTimeout: const Duration(seconds: 1),
settlePolicy: SettlePolicy.noSettle, settlePolicy: SettlePolicy.noSettle,
); );
await $.pumpAndSettle(duration: Duration(milliseconds: 500)); await $.pumpAndSettle(duration: Duration(milliseconds: 500));
await $(Icons.keyboard_arrow_left) await $(Icons.keyboard_arrow_left).waitUntilVisible(timeout: const Duration(seconds: 1)).tap(
.waitUntilVisible(timeout: const Duration(seconds: 1))
.tap(
settleTimeout: const Duration(seconds: 1), settleTimeout: const Duration(seconds: 1),
settlePolicy: SettlePolicy.noSettle, settlePolicy: SettlePolicy.noSettle,
); );

View File

@ -2,11 +2,9 @@ part of 'app_test.dart';
class ModularizationTest { class ModularizationTest {
static Future containLicense() async { static Future containLicense() async {
patrol('Os modulos de licença está sendo processados? (MultiLocais)', patrolWidgetTest('Os modulos de licença está sendo processados? (MultiLocais)', (PatrolTester tester) async {
(PatrolIntegrationTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole( $.tester.printToConsole('Modularization Test - Os modulos de licença está sendo processados?');
'Modularization Test - Os modulos de licença está sendo processados?');
await _loggedWithMultiLocalsAccount($); await _loggedWithMultiLocalsAccount($);
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
@ -27,11 +25,9 @@ class ModularizationTest {
return; return;
}); });
patrol('Os modulos de licença está sendo processados? (MonoLocal)', patrolWidgetTest('Os modulos de licença está sendo processados? (MonoLocal)', (PatrolTester tester) async {
(PatrolIntegrationTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole( $.tester.printToConsole('Modularization Test - Os modulos de licença está sendo processados?');
'Modularization Test - Os modulos de licença está sendo processados?');
await _loggedWithSomeoneLocalAccount($); await _loggedWithSomeoneLocalAccount($);
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
@ -55,9 +51,9 @@ class ModularizationTest {
} }
static Future switchLicense() async { static Future switchLicense() async {
patrol( patrolWidgetTest(
'Licença está sendo atualizada?', 'Licença está sendo atualizada?',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Licença está sendo atualizada?'); $.tester.printToConsole('Licença está sendo atualizada?');
@ -66,17 +62,12 @@ class ModularizationTest {
await $.pumpWidgetAndSettle(const App()); await $.pumpWidgetAndSettle(const App());
await $.waitUntilVisible($(MenuStaggeredView)); await $.waitUntilVisible($(MenuStaggeredView));
final PatrolFinder profile = final PatrolFinder profile = $(const Key('AsyncLocalProfileComponentWidget_InkWell'));
$(const Key('AsyncLocalProfileComponentWidget_InkWell')); await $(profile).waitUntilVisible().tap(settlePolicy: SettlePolicy.noSettle);
await $(profile)
.waitUntilVisible()
.tap(settlePolicy: SettlePolicy.noSettle);
await $.waitUntilVisible($(BottomArrowLinkedLocalsComponentWidget)); await $.waitUntilVisible($(BottomArrowLinkedLocalsComponentWidget));
final PatrolFinder local = $('FRE ACCESS DEMO'); final PatrolFinder local = $('FRE ACCESS DEMO');
await $(local) await $(local).waitUntilVisible().tap(settlePolicy: SettlePolicy.trySettle);
.waitUntilVisible()
.tap(settlePolicy: SettlePolicy.trySettle);
}, },
); );
} }

View File

@ -1,7 +1,6 @@
part of 'app_test.dart'; part of 'app_test.dart';
Future<void> _loggedWithMultiLocalsAccount(PatrolIntegrationTester $, Future<void> _loggedWithMultiLocalsAccount(PatrolTester $, [bool forceLinkedLocal = true]) async {
[bool forceLinkedLocal = true]) async {
await _init($); await _init($);
await StorageHelper() // await StorageHelper() //
.set(SecureStorageKey.isLogged.value, 'true'); .set(SecureStorageKey.isLogged.value, 'true');
@ -29,8 +28,7 @@ Future<void> _loggedWithMultiLocalsAccount(PatrolIntegrationTester $,
} }
} }
Future<void> _loggedWithSomeoneLocalAccount(PatrolIntegrationTester $, Future<void> _loggedWithSomeoneLocalAccount(PatrolTester $, [bool forceLinkedLocal = true]) async {
[bool forceLinkedLocal = true]) async {
await _init($); await _init($);
await StorageHelper() // await StorageHelper() //
.set(SecureStorageKey.isLogged.value, 'true'); .set(SecureStorageKey.isLogged.value, 'true');
@ -58,7 +56,7 @@ Future<void> _loggedWithSomeoneLocalAccount(PatrolIntegrationTester $,
} }
} }
Future<void> _unlogged(PatrolIntegrationTester $) async { Future<void> _unlogged(PatrolTester $) async {
await _init($); await _init($);
await StorageHelper() // await StorageHelper() //
.set(SecureStorageKey.isLogged.value, 'false'); .set(SecureStorageKey.isLogged.value, 'false');
@ -78,7 +76,7 @@ Future<void> _unlogged(PatrolIntegrationTester $) async {
.set(LocalsStorageKey.isNewVersion.key, true); .set(LocalsStorageKey.isNewVersion.key, true);
} }
Future<void> _init(PatrolIntegrationTester $) async { Future<void> _init(PatrolTester $) async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await _initializeTracking(); await _initializeTracking();
await _initializeStorage(); await _initializeStorage();
@ -90,19 +88,18 @@ Future<void> _init(PatrolIntegrationTester $) async {
await _initializeNav(); await _initializeNav();
} }
Future<void> _navigateToSignIn(PatrolIntegrationTester $) async { Future<void> _navigateToSignIn(PatrolTester $) async {
final signInButton = $(#toggleSignInPage).waitUntilVisible(); final signInButton = $(#toggleSignInPage).waitUntilVisible();
await signInButton.tap(); await signInButton.tap();
} }
Future<void> _navigateToSignUp(PatrolIntegrationTester $) async { Future<void> _navigateToSignUp(PatrolTester $) async {
final signUpButton = $(#toggleSignUpPage).waitUntilVisible(); final signUpButton = $(#toggleSignUpPage).waitUntilVisible();
await signUpButton.tap(); await signUpButton.tap();
} }
Future<void> _navigateBackUsingSystemGesture() async => Future<void> _navigateBackUsingSystemGesture() async =>
IntegrationTestWidgetsFlutterBinding.instance.keyboard IntegrationTestWidgetsFlutterBinding.instance.keyboard.isLogicalKeyPressed(LogicalKeyboardKey.escape);
.isLogicalKeyPressed(LogicalKeyboardKey.escape);
Future<void> _initializeTracking() async { Future<void> _initializeTracking() async {
print('Requesting tracking authorization...'); print('Requesting tracking authorization...');

View File

@ -2,9 +2,9 @@ part of 'app_test.dart';
class WelcomeTest { class WelcomeTest {
static Future signInToSignUp() async { static Future signInToSignUp() async {
patrol( patrolWidgetTest(
'Sign-In to Sign-Up', 'Sign-In to Sign-Up',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Welcome Test - Sign-In to Sign-Up'); $.tester.printToConsole('Welcome Test - Sign-In to Sign-Up');
await _unlogged($); await _unlogged($);
@ -17,9 +17,9 @@ class WelcomeTest {
} }
static Future signUpToSignIn() async { static Future signUpToSignIn() async {
patrol( patrolWidgetTest(
'Sign-Up to Sign-In', 'Sign-Up to Sign-In',
(PatrolIntegrationTester tester) async { (PatrolTester tester) async {
$ = tester; $ = tester;
$.tester.printToConsole('Welcome Test - Sign-Up to Sign-In'); $.tester.printToConsole('Welcome Test - Sign-Up to Sign-In');
await _unlogged($); await _unlogged($);