diff --git a/integration_test/duniter/docker-compose.yml b/integration_test/duniter/docker-compose.yml index b1d836f..d828b23 100644 --- a/integration_test/duniter/docker-compose.yml +++ b/integration_test/duniter/docker-compose.yml @@ -5,8 +5,7 @@ services: container_name: duniter-v2s-gecko-tests # image: duniter/duniter-v2s:debug-sha-4d5e08be image: duniter/duniter-v2s:debug-sha-44b09061 - command: --alice - # --sealing=manual + command: --alice --sealing=manual ports: - "127.0.0.1:9615:9615" - "127.0.0.1:9933:9933" diff --git a/integration_test/scenarios/gecko_complete.dart b/integration_test/scenarios/gecko_complete.dart index cb38e20..be9e360 100644 --- a/integration_test/scenarios/gecko_complete.dart +++ b/integration_test/scenarios/gecko_complete.dart @@ -65,10 +65,11 @@ Future payTest2() async { Future certifyTest5() async { // Create identity with Test1 account + await pump(number: 8); await tapKey(keyCertify); await tapKey(keyConfirm); spawnBlock(duration: 1000); - await tester.pump(const Duration(seconds: 2)); + await pump(number: 3); await waitFor('sending'.tr(), reverse: true, settle: false, timeout: const Duration(seconds: 20)); await tapKey(keyCloseTransactionScreen); @@ -83,7 +84,7 @@ Future certifyTest5() async { await enterText(keyEnterIdentityUsername, test5.name); await tapKey(keyConfirm); spawnBlock(duration: 1000); - await tester.pump(const Duration(seconds: 2)); + await pump(number: 3); await waitFor('sending'.tr(), reverse: true, settle: false, timeout: const Duration(seconds: 20)); await tapKey(keyCloseTransactionScreen); @@ -111,7 +112,7 @@ Future certifyTest5() async { await tapKey(keyCertify); await tapKey(keyConfirm); spawnBlock(duration: 1000); - await tester.pump(const Duration(seconds: 2)); + await pump(number: 3); await waitFor('sending'.tr(), reverse: true, settle: false, timeout: const Duration(seconds: 20)); await tapKey(keyCloseTransactionScreen); @@ -119,16 +120,16 @@ Future certifyTest5() async { // Change default wallet to test3 await tapKey(keyPay); - await tapKey(keyChangeChest); + await tapKey(keyDropdownWallets); await tapKey(keySelectThisWallet(test3.address)); - await tapKey(keyConfirm); + await tapKey(keyPopButton); await sleep(); // Certify with test3 account await tapKey(keyCertify); await tapKey(keyConfirm); spawnBlock(duration: 1000); - await tester.pump(const Duration(seconds: 2)); + await pump(number: 3); await waitFor('sending'.tr(), reverse: true, settle: false, timeout: const Duration(seconds: 20)); await tapKey(keyCloseTransactionScreen); diff --git a/integration_test/scenarios/migrate_cesium_identity.dart b/integration_test/scenarios/migrate_cesium_identity.dart index 417439f..adb9a96 100644 --- a/integration_test/scenarios/migrate_cesium_identity.dart +++ b/integration_test/scenarios/migrate_cesium_identity.dart @@ -44,6 +44,7 @@ void main() async { await tapKey(keyConfirm); spawnBlock(duration: 1000); await tester.pump(const Duration(seconds: 2)); + await tester.pump(const Duration(seconds: 1)); await waitFor('sending'.tr(), reverse: true, settle: false, timeout: const Duration(seconds: 20)); await tapKey(keyCloseTransactionScreen, duration: 0); @@ -52,7 +53,7 @@ void main() async { await waitFor('3', exactMatch: true); await waitFor('memberValidated'.tr()); - await waitFor('99.98', exactMatch: true); + await waitFor('110.01', exactMatch: true); }, timeout: testTimeout()); } diff --git a/integration_test/utility/general_actions.dart b/integration_test/utility/general_actions.dart index b5904c0..062586b 100644 --- a/integration_test/utility/general_actions.dart +++ b/integration_test/utility/general_actions.dart @@ -25,7 +25,7 @@ Future changeNode() async { } Future deleteAllWallets() async { - if (await isPresent('Rechercher')) { + if (await isPresent('searchWallet'.tr())) { await tapKey(keyDrawerMenu); await tapKey(keyParameters); @@ -65,15 +65,17 @@ Future restoreChest() async { // Enter password await enterText(keyPinForm, 'AAAAA', 0); + // pump a few frame + await pump(duration: const Duration(milliseconds: 500), number: 10); + // Check if string "Accéder à mon coffre" is present in screen - await waitFor('accessMyChest'.tr(), pumpDuration: 30); + await waitFor('accessMyChest'.tr(), settle: false); // Go to wallets home await tapKey(keyGoWalletsHome, duration: 0); // Skip tutorial - await sleep(500); - await tapKey(keyDragAndDrop).timeout(const Duration(seconds: 3)); + await skipWalletDragTutorial(); // Check if string "ĞD" is present in screen await waitFor('ĞD'); @@ -168,5 +170,15 @@ Future firstOpenChest() async { final isCached = await isIconPresent(Icons.check_box); if (!isCached) await tapKey(keyCachePassword, duration: 0); await enterText(keyPinForm, 'AAAAA', 0); - await waitFor('100.0', exactMatch: true); + await skipWalletDragTutorial(); + await waitFor(test1.name); +} + +Future skipWalletDragTutorial() async { + await pump(duration: const Duration(milliseconds: 500), number: 4); + await pump(duration: const Duration(seconds: 2)); + if (await isPresent('explainDraggableWallet'.tr().substring(0, 13), + timeout: const Duration(seconds: 5), settle: false)) { + await tapKey(keyDragAndDrop, duration: 0); + } } diff --git a/integration_test/utility/tests_utility.dart b/integration_test/utility/tests_utility.dart index 66358d2..e435fc4 100644 --- a/integration_test/utility/tests_utility.dart +++ b/integration_test/utility/tests_utility.dart @@ -53,6 +53,15 @@ Future sleep([int time = 1000]) async { await Future.delayed(Duration(milliseconds: time)); } +Future pump( + {Duration duration = const Duration(milliseconds: 300), + int number = 1}) async { + for (int i = 0; i < number; i++) { + log.d("pump $i"); + await tester.pump(duration = duration); + } +} + Future clipPaste() async => (await Clipboard.getData('text/plain'))?.text ?? ''; @@ -146,7 +155,8 @@ Future waitFor(String text, } if (settle) { - await tester.pumpAndSettle(Duration(milliseconds: pumpDuration)); + await tester.pumpAndSettle(Duration(milliseconds: pumpDuration), + EnginePhase.sendSemanticsUpdate, timeout); } await Future.delayed(const Duration(milliseconds: 100)); } while (reverse ? finder.evaluate().isNotEmpty : finder.evaluate().isEmpty); @@ -155,9 +165,9 @@ Future waitFor(String text, // Test if text is visible on screen, return a boolean Future isPresent(String text, - {Duration timeout = const Duration(seconds: 1)}) async { + {Duration timeout = const Duration(seconds: 1), bool settle = true}) async { try { - await waitFor(text, timeout: timeout); + await waitFor(text, timeout: timeout, settle: settle); humanRead(); return true; } catch (exception) { @@ -278,8 +288,8 @@ Future _addImportAccount( Future bkDeleteAllWallets() async { final myWalletProvider = Provider.of(homeContext, listen: false); - final isWalletsPresents = - await isPresent('Scanner un', timeout: const Duration(milliseconds: 300)); + final isWalletsPresents = await isPresent('scanQRCode'.tr(), + timeout: const Duration(milliseconds: 300)); if (isWalletsPresents) { await walletBox.clear(); await chestBox.clear(); diff --git a/lib/models/widgets_keys.dart b/lib/models/widgets_keys.dart index 731dc53..88883a5 100644 --- a/lib/models/widgets_keys.dart +++ b/lib/models/widgets_keys.dart @@ -98,6 +98,8 @@ const keyCesiumPassword = Key('keyCesiumPassword'); const keySelectWallet = Key('keySelectWallet'); const keyCesiumIdVisible = Key('keyCesiumIdVisible'); +const keyDropdownWallets = Key('keyDropdownKey'); + // Items keys Key keyTransaction(int keyId) => Key('keyTransaction$keyId'); Key keyMnemonicWord(String word) => Key('keyMnemonicWord$word'); diff --git a/lib/screens/myWallets/wallet_options.dart b/lib/screens/myWallets/wallet_options.dart index 776120a..18385a4 100644 --- a/lib/screens/myWallets/wallet_options.dart +++ b/lib/screens/myWallets/wallet_options.dart @@ -343,7 +343,7 @@ class WalletOptions extends StatelessWidget { future: sub.idtyStatus(walletProvider.address.text), initialData: '', builder: (context, snapshot) { - if (snapshot.data == 'Created') { + if (snapshot.data == IdtyStatus.created) { return Column(children: [ SizedBox( width: 320, @@ -542,7 +542,7 @@ class WalletOptions extends StatelessWidget { // WalletData defaultWallet = _myWalletProvider.getDefaultWallet()!; // defaultWallet = wallet; await sub.setCurrentWallet(wallet); - myWalletProvider.readAllWallets(currentChest); + await myWalletProvider.readAllWallets(currentChest); myWalletProvider.reload(); walletOptions.reload(); } @@ -575,9 +575,9 @@ class WalletOptions extends StatelessWidget { onTap: canDelete ? () async { await walletOptions.deleteWallet(context, wallet); - WidgetsBinding.instance.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) async { myWalletProvider.listWallets = - myWalletProvider.readAllWallets(currentChest); + await myWalletProvider.readAllWallets(currentChest); myWalletProvider.reload(); }); } diff --git a/lib/widgets/payment_popup.dart b/lib/widgets/payment_popup.dart index e106b10..af905f8 100644 --- a/lib/widgets/payment_popup.dart +++ b/lib/widgets/payment_popup.dart @@ -28,7 +28,6 @@ void paymentPopup(BuildContext context, String toAddress, String username) { var defaultWallet = myWalletProvider.getDefaultWallet(); bool canValidate = false; final amountFocus = FocusNode(); - final dropdownKey = GlobalKey(); walletViewProvider.payAmount.text = ''; @@ -132,6 +131,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) { fontSize: 26, fontWeight: FontWeight.w700), ), IconButton( + key: keyPopButton, iconSize: 40, icon: const Icon(Icons.cancel_outlined), onPressed: () { @@ -152,7 +152,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) { return DropdownButton( dropdownColor: const Color(0xffffeed1), elevation: 12, - key: dropdownKey, + key: keyDropdownWallets, value: defaultWallet, menuMaxHeight: 300, onTap: () { @@ -197,6 +197,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) { .map((WalletData wallet) { return DropdownMenuItem( value: wallet, + key: keySelectThisWallet(wallet.address), child: Container( color: const Color(0xffffeed1), width: 408, diff --git a/lib/widgets/search_result_list.dart b/lib/widgets/search_result_list.dart index b7a0725..43929e2 100644 --- a/lib/widgets/search_result_list.dart +++ b/lib/widgets/search_result_list.dart @@ -100,8 +100,8 @@ class SearchResult extends StatelessWidget { walletsProfilesClass.address = g1Wallet.address; return WalletViewScreen( address: g1Wallet.address, - username: g1WalletsBox.get(g1Wallet)!.username ?? '', - avatar: g1WalletsBox.get(g1Wallet.address)?.avatar, + username: g1Wallet.username ?? '', + avatar: g1Wallet.avatar, ); }), );