From c60a8ad48903af1231b0dbc9fe05a6fa30b37a8a Mon Sep 17 00:00:00 2001 From: poka Date: Tue, 28 Feb 2023 17:04:31 +0100 Subject: [PATCH] make integration tests multilang --- integration_test/scenarios/cert_state.dart | 7 +++--- .../scenarios/gecko_complete.dart | 23 ++++++++++--------- .../scenarios/identity_revocation.dart | 22 +++++------------- .../scenarios/migrate_cesium_identity.dart | 7 +++--- integration_test/utility/general_actions.dart | 3 +-- integration_test/utility/tests_utility.dart | 5 ++-- 6 files changed, 30 insertions(+), 37 deletions(-) diff --git a/integration_test/scenarios/cert_state.dart b/integration_test/scenarios/cert_state.dart index 905b302..01cce73 100644 --- a/integration_test/scenarios/cert_state.dart +++ b/integration_test/scenarios/cert_state.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:gecko/models/widgets_keys.dart'; @@ -25,9 +26,9 @@ void main() async { await tapKey(keyConfirmSearch); await waitFor(test5.shortAddress()); await tapKey(keySearchResult(test5.address)); - await waitFor('Certifier'); - await waitFor('Vous devez ', reverse: true); - await waitFor('Vous pourrez renouveler ', reverse: true); + await waitFor('certify'.tr()); + await waitFor('mustWaitXBeforeCertify'.tr().substring(0, 6), reverse: true); + await waitFor('canRenewCertInX'.tr().substring(0, 8), reverse: true); // Background pay 25 await bkPay( diff --git a/integration_test/scenarios/gecko_complete.dart b/integration_test/scenarios/gecko_complete.dart index b4c7934..ebf1fb2 100644 --- a/integration_test/scenarios/gecko_complete.dart +++ b/integration_test/scenarios/gecko_complete.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:gecko/models/widgets_keys.dart'; @@ -35,7 +36,7 @@ void main() async { Future payTest2() async { spawnBlock(until: 13); - await waitFor('Rechercher'); + await waitFor('searchWallet'.tr()); await tapKey(keyOpenSearch); final addressToSearch = await clipPaste(); final endAddress = addressToSearch.substring(addressToSearch.length - 6); @@ -51,7 +52,7 @@ Future payTest2() async { await tapKey(keyConfirmPayment); spawnBlock(duration: 500); - await waitFor('validée !', timeout: const Duration(seconds: 1)); + await waitFor('extrinsicValidated'.tr(), timeout: const Duration(seconds: 1)); await tapKey(keyCloseTransactionScreen, duration: 0); await waitFor('12.14'); spawnBlock(duration: 500); @@ -64,9 +65,9 @@ Future certifyTest5() async { await tapKey(keyCertify); await tapKey(keyConfirm); spawnBlock(duration: 500); - await waitFor('validée !', timeout: const Duration(seconds: 1)); + await waitFor('extrinsicValidated'.tr(), timeout: const Duration(seconds: 1)); await tapKey(keyCloseTransactionScreen); - await waitFor('Identité créée'); + await waitFor('identityCreated'.tr()); // Confirm Identity Test5 await tapKey(keyAppBarChest, duration: 300); @@ -77,15 +78,15 @@ Future certifyTest5() async { await enterText(keyEnterIdentityUsername, test5.name); await tapKey(keyConfirm); spawnBlock(duration: 500); - await waitFor('validée !', timeout: const Duration(seconds: 1)); + await waitFor('extrinsicValidated'.tr(), timeout: const Duration(seconds: 1)); await tapKey(keyCloseTransactionScreen); - await waitFor('Identité confirmée'); + await waitFor('identityConfirmed'.tr()); humanRead(2); // Set wallet 2 as default wallet await goBack(); await tapKey(keyOpenWallet(test2.address)); await tapKey(keySetDefaultWallet); - await waitFor('Ce portefeuille est celui par defaut'); + await waitFor('thisWalletIsDefault'.tr()); // Search Wallet 5 again await tapKey(keyAppBarSearch); @@ -103,7 +104,7 @@ Future certifyTest5() async { await tapKey(keyCertify); await tapKey(keyConfirm); spawnBlock(duration: 500); - await waitFor('validée !', timeout: const Duration(seconds: 1)); + await waitFor('extrinsicValidated'.tr(), timeout: const Duration(seconds: 1)); await tapKey(keyCloseTransactionScreen); await waitFor('2'); @@ -118,14 +119,14 @@ Future certifyTest5() async { await tapKey(keyCertify); await tapKey(keyConfirm); spawnBlock(duration: 500); - await waitFor('validée !', timeout: const Duration(seconds: 1)); + await waitFor('extrinsicValidated'.tr(), timeout: const Duration(seconds: 1)); await tapKey(keyCloseTransactionScreen); - await waitFor('Vous devez attendre'); + await waitFor('mustWaitXBeforeCertify'.substring(0, 12)); // Check if test5 is member await tapKey(keyAppBarChest, duration: 300); await tapKey(keyOpenWallet(test5.address)); - await waitFor('Membre validé !'); + await waitFor('memberValidated'.tr()); // spawn 20 blocs and check if ud is creating await spawnBlock(until: 20); diff --git a/integration_test/scenarios/identity_revocation.dart b/integration_test/scenarios/identity_revocation.dart index 544239b..0d0ddf1 100644 --- a/integration_test/scenarios/identity_revocation.dart +++ b/integration_test/scenarios/identity_revocation.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:gecko/models/widgets_keys.dart'; @@ -32,16 +33,17 @@ void main() async { await bkConfirmIdentity(fromAddress: test5.address, name: test5.name); await bkCertify(fromAddress: test2.address, destAddress: test5.address); await bkCertify(fromAddress: test3.address, destAddress: test5.address); - await waitFor('Membre validé !', exactMatch: true); + await waitFor('memberValidated'.tr(), exactMatch: true); // Revoke test5 await tapKey(keyManageMembership, duration: 1000); await tapKey(keyRevokeIdty); await tapKey(keyConfirm); spawnBlock(duration: 2000); - await waitFor('validée !', timeout: const Duration(seconds: 4)); + await waitFor('extrinsicValidated'.tr().substring(3), + timeout: const Duration(seconds: 4)); await tapKey(keyCloseTransactionScreen, duration: 0); - await waitFor('Aucune identité', exactMatch: true); + await waitFor('noIdentity'.tr(), exactMatch: true); await sleep(); // Check test1 cannot be revoked @@ -49,19 +51,7 @@ void main() async { await tapKey(keyAddDerivation); await tapKey(keyOpenWallet(test1.address), duration: 500); await tapKey(keyManageMembership, duration: 1000); - await waitFor('Vous ne pouvez pas révoquer cette identité'); + await waitFor('youCannotRevokeThisIdentity'.tr().substring(0, 15)); - // // Try migrate test1 identity to test6 address - // await tapKey(keyMigrateIdentity); - // await tapKey(keySelectWallet); - // await tapKey(keySelectThisWallet(test6.address), selectLast: true); - // await spawnBlock(number: 100); - // await waitFor('Vous devez attendre', reverse: true); - // await waitForButtonEnabled(keyConfirm); - // await tapKey(keyConfirm, duration: 500); - // await spawnBlock(duration: 2000); - // await waitFor('validée !'); - // await tapKey(keyCloseTransactionScreen, duration: 0); - // await sleep(5000); }, timeout: testTimeout()); } diff --git a/integration_test/scenarios/migrate_cesium_identity.dart b/integration_test/scenarios/migrate_cesium_identity.dart index 739ff21..e6b436f 100644 --- a/integration_test/scenarios/migrate_cesium_identity.dart +++ b/integration_test/scenarios/migrate_cesium_identity.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -20,7 +21,7 @@ void main() async { // Go to test1 options and check if balance growup with UDs creations await tapKey(keyAddDerivation); - await waitFor('Portefeuille 6'); + await waitFor(' 6'); await scrollUntil(keyImportG1v1); await tapKey(keyImportG1v1); @@ -43,12 +44,12 @@ void main() async { await waitForButtonEnabled(keyConfirm); await tapKey(keyConfirm); spawnBlock(duration: 2000); - await waitFor('validée !'); + await waitFor('extrinsicValidated'.tr()); await tapKey(keyCloseTransactionScreen, duration: 0); await tapKey(keyOpenWallet(test6.address), duration: 300); await waitFor('3', exactMatch: true); - await waitFor('Membre validé !'); + await waitFor('memberValidated'.tr()); await waitFor('99.98', exactMatch: true); }, timeout: testTimeout()); diff --git a/integration_test/utility/general_actions.dart b/integration_test/utility/general_actions.dart index d1f3cea..0dbb612 100644 --- a/integration_test/utility/general_actions.dart +++ b/integration_test/utility/general_actions.dart @@ -152,12 +152,11 @@ Future onboardingNewChest() async { // Check if string "Mon portefeuille co" is present in screen await waitFor('currentWallet'.tr()); await waitFor('0.0', exactMatch: true); - // await waitFor('Scanner un'); } Future addDerivation() async { await tapKey(keyAddDerivation); - await waitFor('Portefeuille 5'); + await waitFor(' 5'); } Future firstOpenChest() async { diff --git a/integration_test/utility/tests_utility.dart b/integration_test/utility/tests_utility.dart index e10d879..753a19d 100644 --- a/integration_test/utility/tests_utility.dart +++ b/integration_test/utility/tests_utility.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -302,14 +303,14 @@ Future bkFastStart([bool restoreChest = true]) async { if (restoreChest) { // Restore the test chest await bkRestoreChest(); - await waitFor("y'a pas de lézard"); + await waitFor("noLizard".tr()); } } Future startWait() async { app.main(); await waitFor('Test starting...', reverse: true); - await tester.pumpAndSettle(const Duration(milliseconds: 300)); + await tester.pumpAndSettle(const Duration(seconds: 2)); await sleep(3000); }