forked from axiom-team/gecko
improve test speed
This commit is contained in:
parent
c060c85df8
commit
05f41e16a9
|
@ -72,7 +72,6 @@ Future restoreChest(WidgetTester tester) async {
|
||||||
|
|
||||||
// Tap on button to paste mnemonic
|
// Tap on button to paste mnemonic
|
||||||
await goKey(tester, keyPastMnemonic);
|
await goKey(tester, keyPastMnemonic);
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
// Tap on next button 4 times to skip 3 screen
|
// Tap on next button 4 times to skip 3 screen
|
||||||
await goKey(tester, keyGoNext);
|
await goKey(tester, keyGoNext);
|
||||||
|
@ -84,16 +83,16 @@ Future restoreChest(WidgetTester tester) async {
|
||||||
final isCached = await isIconPresent(tester, Icons.check_box);
|
final isCached = await isIconPresent(tester, Icons.check_box);
|
||||||
|
|
||||||
// If not, tap on to cache password
|
// If not, tap on to cache password
|
||||||
if (!isCached) await goKey(tester, keyCachePassword);
|
if (!isCached) await goKey(tester, keyCachePassword, duration: 0);
|
||||||
|
|
||||||
// Enter password
|
// Enter password
|
||||||
await enterText(tester, keyPinForm, 'AAAAA');
|
await enterText(tester, keyPinForm, 'AAAAA', 0);
|
||||||
|
|
||||||
// Check if string "Accéder à mon coffre" is present in screen
|
// Check if string "Accéder à mon coffre" is present in screen
|
||||||
await waitFor(tester, 'Accéder à mon coffre');
|
await waitFor(tester, 'Accéder à mon coffre');
|
||||||
|
|
||||||
// Go to wallets home
|
// Go to wallets home
|
||||||
await goKey(tester, keyGoWalletsHome);
|
await goKey(tester, keyGoWalletsHome, duration: 0);
|
||||||
|
|
||||||
// Check if string "ĞD" is present in screen
|
// Check if string "ĞD" is present in screen
|
||||||
await waitFor(tester, 'ĞD');
|
await waitFor(tester, 'ĞD');
|
||||||
|
@ -138,7 +137,7 @@ Future payTest2(WidgetTester tester) async {
|
||||||
await spawnBlock(tester, keyCloseTransactionScreen);
|
await spawnBlock(tester, keyCloseTransactionScreen);
|
||||||
|
|
||||||
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
||||||
await goKey(tester, keyCloseTransactionScreen);
|
await goKey(tester, keyCloseTransactionScreen, duration: 0);
|
||||||
await waitFor(tester, '12.14');
|
await waitFor(tester, '12.14');
|
||||||
await spawnBlock(tester, keyViewActivity);
|
await spawnBlock(tester, keyViewActivity);
|
||||||
await waitFor(tester, '9.14');
|
await waitFor(tester, '9.14');
|
||||||
|
@ -155,7 +154,7 @@ Future certifyTest5(WidgetTester tester) async {
|
||||||
// await sleep(tester);
|
// await sleep(tester);
|
||||||
await goKey(tester, keyCertify);
|
await goKey(tester, keyCertify);
|
||||||
await goKey(tester, keyConfirm);
|
await goKey(tester, keyConfirm);
|
||||||
await spawnBlock(tester, keyViewActivity);
|
await spawnBlock(tester, keyViewActivity, duration: 500);
|
||||||
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
||||||
await goKey(tester, keyCloseTransactionScreen);
|
await goKey(tester, keyCloseTransactionScreen);
|
||||||
await waitFor(tester, 'Identité créée');
|
await waitFor(tester, 'Identité créée');
|
||||||
|
@ -168,7 +167,7 @@ Future certifyTest5(WidgetTester tester) async {
|
||||||
await goKey(tester, keyConfirmIdentity);
|
await goKey(tester, keyConfirmIdentity);
|
||||||
await enterText(tester, keyEnterIdentityUsername, 'test5');
|
await enterText(tester, keyEnterIdentityUsername, 'test5');
|
||||||
await goKey(tester, keyConfirm);
|
await goKey(tester, keyConfirm);
|
||||||
await spawnBlock(tester, keyCloseTransactionScreen);
|
await spawnBlock(tester, keyCloseTransactionScreen, duration: 500);
|
||||||
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
||||||
await goKey(tester, keyCloseTransactionScreen);
|
await goKey(tester, keyCloseTransactionScreen);
|
||||||
await waitFor(tester, 'Identité confirmée');
|
await waitFor(tester, 'Identité confirmée');
|
||||||
|
@ -192,7 +191,7 @@ Future certifyTest5(WidgetTester tester) async {
|
||||||
// Certify with test2 account
|
// Certify with test2 account
|
||||||
await goKey(tester, keyCertify);
|
await goKey(tester, keyCertify);
|
||||||
await goKey(tester, keyConfirm);
|
await goKey(tester, keyConfirm);
|
||||||
await spawnBlock(tester, keyViewActivity);
|
await spawnBlock(tester, keyViewActivity, duration: 500);
|
||||||
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
||||||
await goKey(tester, keyCloseTransactionScreen);
|
await goKey(tester, keyCloseTransactionScreen);
|
||||||
await waitFor(tester, '2');
|
await waitFor(tester, '2');
|
||||||
|
@ -208,7 +207,7 @@ Future certifyTest5(WidgetTester tester) async {
|
||||||
// Certify with test3 account
|
// Certify with test3 account
|
||||||
await goKey(tester, keyCertify);
|
await goKey(tester, keyCertify);
|
||||||
await goKey(tester, keyConfirm);
|
await goKey(tester, keyConfirm);
|
||||||
await spawnBlock(tester, keyViewActivity);
|
await spawnBlock(tester, keyViewActivity, duration: 500);
|
||||||
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
await waitFor(tester, 'validé !', timeout: const Duration(seconds: 1));
|
||||||
await goKey(tester, keyCloseTransactionScreen);
|
await goKey(tester, keyCloseTransactionScreen);
|
||||||
await waitFor(tester, 'Vous devez attendre');
|
await waitFor(tester, 'Vous devez attendre');
|
||||||
|
|
|
@ -12,7 +12,9 @@ Future sleep(WidgetTester tester, [int time = 1000]) async {
|
||||||
|
|
||||||
Future goKey(WidgetTester tester, Key buttonKey,
|
Future goKey(WidgetTester tester, Key buttonKey,
|
||||||
{Finder? customFinder, int duration = 100, bool selectLast = false}) async {
|
{Finder? customFinder, int duration = 100, bool selectLast = false}) async {
|
||||||
await tester.pumpAndSettle(Duration(milliseconds: duration));
|
if (duration != 0) {
|
||||||
|
await tester.pumpAndSettle(Duration(milliseconds: duration));
|
||||||
|
}
|
||||||
final Finder finder = customFinder ?? find.byKey(buttonKey);
|
final Finder finder = customFinder ?? find.byKey(buttonKey);
|
||||||
log.d('INTEGRATION TEST: Tap on ${finder.description}}');
|
log.d('INTEGRATION TEST: Tap on ${finder.description}}');
|
||||||
await tester.tap(selectLast ? finder.last : finder);
|
await tester.tap(selectLast ? finder.last : finder);
|
||||||
|
@ -28,7 +30,9 @@ Future goBack(WidgetTester tester) async {
|
||||||
|
|
||||||
Future enterText(WidgetTester tester, Key fieldKey, String textIn,
|
Future enterText(WidgetTester tester, Key fieldKey, String textIn,
|
||||||
[int duration = 200]) async {
|
[int duration = 200]) async {
|
||||||
await tester.pumpAndSettle(Duration(milliseconds: duration));
|
if (duration != 0) {
|
||||||
|
await tester.pumpAndSettle(Duration(milliseconds: duration));
|
||||||
|
}
|
||||||
log.d('INTEGRATION TEST: Enter text: $textIn');
|
log.d('INTEGRATION TEST: Enter text: $textIn');
|
||||||
await tester.enterText(find.byKey(fieldKey), textIn);
|
await tester.enterText(find.byKey(fieldKey), textIn);
|
||||||
}
|
}
|
||||||
|
@ -73,8 +77,11 @@ Future<bool> isIconPresent(WidgetTester tester, IconData icon,
|
||||||
return finder.evaluate().isEmpty ? false : true;
|
return finder.evaluate().isEmpty ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future spawnBlock(WidgetTester tester, Key customKey, [int number = 1]) async {
|
Future spawnBlock(WidgetTester tester, Key customKey,
|
||||||
await sleep(tester, 1000);
|
{int number = 1, int duration = 200}) async {
|
||||||
|
if (duration != 0) {
|
||||||
|
await sleep(tester, duration);
|
||||||
|
}
|
||||||
final BuildContext context = tester.element(find.byKey(customKey));
|
final BuildContext context = tester.element(find.byKey(customKey));
|
||||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
sub.spawnBlock(number);
|
sub.spawnBlock(number);
|
||||||
|
|
|
@ -133,23 +133,23 @@ class HomeScreen extends StatelessWidget {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// TODO: fix random bad network status on startup
|
// TODO: fix random bad network status on startup
|
||||||
// HomeProvider homeProvider =
|
HomeProvider homeProvider =
|
||||||
// Provider.of<HomeProvider>(ctx, listen: false);
|
Provider.of<HomeProvider>(ctx, listen: false);
|
||||||
// Connectivity()
|
Connectivity()
|
||||||
// .onConnectivityChanged
|
.onConnectivityChanged
|
||||||
// .listen((ConnectivityResult result) async {
|
.listen((ConnectivityResult result) async {
|
||||||
// log.d('Network changed: $result');
|
log.d('Network changed: $result');
|
||||||
// if (result == ConnectivityResult.none) {
|
if (result == ConnectivityResult.none) {
|
||||||
// sub.nodeConnected = false;
|
sub.nodeConnected = false;
|
||||||
// await sub.sdk.api.setting.unsubscribeBestNumber();
|
await sub.sdk.api.setting.unsubscribeBestNumber();
|
||||||
// homeProvider.changeMessage(
|
homeProvider.changeMessage(
|
||||||
// "notConnectedToInternet".tr(), 0);
|
"notConnectedToInternet".tr(), 0);
|
||||||
// sub.reload();
|
sub.reload();
|
||||||
// } else {
|
} else {
|
||||||
// await sub.connectNode(ctx);
|
await sub.connectNode(ctx);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
await sub.connectNode(ctx);
|
// await sub.connectNode(ctx);
|
||||||
}
|
}
|
||||||
// _duniterIndexer.checkIndexerEndpointBackground();
|
// _duniterIndexer.checkIndexerEndpointBackground();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue