wip: test onboarding
This commit is contained in:
parent
e01dea9329
commit
ad9ee382d3
|
@ -134,6 +134,6 @@ Future certifyTest5() async {
|
|||
|
||||
// Check UD reval
|
||||
await spawnBlock(until: 50);
|
||||
await waitFor('509.35');
|
||||
await waitFor('509.36');
|
||||
humanRead(5);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:gecko/providers/generate_wallets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'tests_utility.dart';
|
||||
|
||||
// GENERAL ACTIONS
|
||||
|
@ -83,6 +85,68 @@ Future restoreChest() async {
|
|||
await goBack();
|
||||
}
|
||||
|
||||
Future onboardingNewChest() async {
|
||||
final generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(homeContext, listen: false);
|
||||
// Open screen create new wallet
|
||||
await tapKey(keyOnboardingNewChest);
|
||||
|
||||
// Tap on next button 4 times to skip 3 screen
|
||||
await tapKey(keyGoNext);
|
||||
await tapKey(keyGoNext);
|
||||
await tapKey(keyGoNext);
|
||||
await tapKey(keyGoNext);
|
||||
await waitFor('7', exactMatch: true);
|
||||
|
||||
final word41 = getWidgetText(keyMnemonicWord('4'));
|
||||
|
||||
// Change 2 times mnemonic
|
||||
await tapKey(keyGenerateMnemonic);
|
||||
await tester.pumpAndSettle();
|
||||
final word42 = getWidgetText(keyMnemonicWord('4'));
|
||||
expect(word41, isNot(word42));
|
||||
await tapKey(keyGenerateMnemonic, duration: 500);
|
||||
await tester.pumpAndSettle();
|
||||
final word43 = getWidgetText(keyMnemonicWord('4'));
|
||||
expect(word42, isNot(word43));
|
||||
|
||||
// Go next screen
|
||||
await tapKey(keyGoNext);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Enter asked word
|
||||
final askedWordNumber = int.parse(getWidgetText(keyAskedWord));
|
||||
List mnemonic = generateWalletProvider.generatedMnemonic!.split(' ');
|
||||
|
||||
final askedWord = mnemonic[askedWordNumber - 1];
|
||||
await enterText(keyInputWord, askedWord);
|
||||
await waitFor('Continuer', exactMatch: true);
|
||||
await tapKey(keyGoNext);
|
||||
await tapKey(keyGoNext);
|
||||
await tapKey(keyGoNext);
|
||||
await waitFor('AAAAA', exactMatch: true);
|
||||
await tapKey(keyGoNext);
|
||||
|
||||
// Check if cached password checkbox is checked
|
||||
final isCached = await isIconPresent(Icons.check_box);
|
||||
|
||||
// If not, tap on to cache password
|
||||
if (!isCached) await tapKey(keyCachePassword, duration: 0);
|
||||
|
||||
// Enter password
|
||||
await enterText(keyPinForm, 'AAAAA', 0);
|
||||
|
||||
// Check if string "Accéder à mon coffre" is present in screen
|
||||
await waitFor('Accéder à mon coffre');
|
||||
|
||||
// Go to wallets home
|
||||
await tapKey(keyGoWalletsHome, duration: 0);
|
||||
|
||||
// Check if string "ĞD" is present in screen
|
||||
await waitFor('Mon portefeuille co');
|
||||
await waitFor('0.0 $currencyName');
|
||||
}
|
||||
|
||||
Future addDerivation() async {
|
||||
await tapKey(keyAddDerivation);
|
||||
await waitFor('Portefeuille 5');
|
||||
|
|
|
@ -17,7 +17,7 @@ docker-compose up -d
|
|||
cd ../..
|
||||
|
||||
# Start integration test
|
||||
flutter test integration_test/$testName.dart
|
||||
flutter test integration_test/$testName.dart && echo '0' > /tmp/geckoTestResult || echo '1' > /tmp/geckoTestResult
|
||||
|
||||
# Reset .env
|
||||
echo "ip_address=127.0.0.1" > .env
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:gecko/models/widgets_keys.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
import 'general_actions.dart';
|
||||
import 'tests_utility.dart';
|
||||
|
||||
void main() async {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
await dotenv.load();
|
||||
|
||||
testWidgets('Onboarding and multi chest', (testerLoc) async {
|
||||
tester = testerLoc;
|
||||
await bkFastStart(false);
|
||||
await onboardingNewChest();
|
||||
}, timeout: testTimeout());
|
||||
}
|
|
@ -265,13 +265,19 @@ Future<WalletData> _addImportAccount(
|
|||
Future bkDeleteAllWallets() async {
|
||||
final myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(homeContext, listen: false);
|
||||
if (myWalletProvider.listWallets.isNotEmpty) {
|
||||
await myWalletProvider.deleteAllWallet(homeContext);
|
||||
final isWalletsPresents =
|
||||
await isPresent('Scanner un', timeout: const Duration(milliseconds: 300));
|
||||
if (isWalletsPresents) {
|
||||
await walletBox.clear();
|
||||
await chestBox.clear();
|
||||
await configBox.delete('defaultWallet');
|
||||
await sub.deleteAllAccounts();
|
||||
myWalletProvider.pinCode = '';
|
||||
myWalletProvider.rebuildWidget();
|
||||
}
|
||||
}
|
||||
|
||||
Future bkFastStart() async {
|
||||
Future bkFastStart([bool restoreChest = true]) async {
|
||||
// Start app and wait finish starting
|
||||
await startWait();
|
||||
|
||||
|
@ -282,16 +288,23 @@ Future bkFastStart() async {
|
|||
// Delete all existing chests is exists
|
||||
await bkDeleteAllWallets();
|
||||
|
||||
// Restore the test chest
|
||||
await bkRestoreChest();
|
||||
await waitFor("y'a pas de lézard");
|
||||
if (restoreChest) {
|
||||
// Restore the test chest
|
||||
await bkRestoreChest();
|
||||
await waitFor("y'a pas de lézard");
|
||||
}
|
||||
}
|
||||
|
||||
Future startWait() async {
|
||||
app.main();
|
||||
await waitFor('Test starting...', reverse: true);
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await sleep(2000);
|
||||
await sleep(3000);
|
||||
}
|
||||
|
||||
String getWidgetText(Key key) {
|
||||
final word4Finder = find.byKey(key);
|
||||
return (word4Finder.evaluate().single.widget as Text).data!;
|
||||
}
|
||||
|
||||
class TestWallet {
|
||||
|
|
|
@ -16,6 +16,7 @@ const keyDrawerMenu = Key('keyDrawerMenu');
|
|||
const keyOpenWalletsHomme = Key('keyOpenWalletsHomme');
|
||||
const keyOpenSearch = Key('keyOpenSearch');
|
||||
const keyRestoreChest = Key('keyRestoreChest');
|
||||
const keyOnboardingNewChest = Key('keyOnboardingNewChest');
|
||||
|
||||
// Wallets home
|
||||
const keyImportG1v1 = Key('keyImportG1v1');
|
||||
|
|
|
@ -538,7 +538,7 @@ Widget welcomeHome(context) {
|
|||
SizedBox(
|
||||
width: 410,
|
||||
height: 70,
|
||||
child: ElevatedButton(
|
||||
child: ElevatedButton(key: keyOnboardingNewChest,
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 4,
|
||||
primary: orangeC, // background
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// ignore_for_file: file_names
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -228,6 +229,7 @@ class OnboardingStepTen extends StatelessWidget {
|
|||
|
||||
generateWalletProvider.generatedMnemonic = '';
|
||||
myWalletProvider.resetPinCode();
|
||||
// sleep(const Duration(milliseconds: 500));
|
||||
Navigator.push(
|
||||
context,
|
||||
FaderTransition(
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// ignore_for_file: file_names
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -62,13 +64,12 @@ Widget finishButton(BuildContext context) {
|
|||
onPrimary: Colors.white, // foreground
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const WalletsHome();
|
||||
}),
|
||||
ModalRoute.withName('/'),
|
||||
);
|
||||
// sleep(const Duration(milliseconds: 50));
|
||||
Navigator.popUntil(homeContext, ModalRoute.withName('/'));
|
||||
// sleep(const Duration(milliseconds: 500));
|
||||
Navigator.pushNamed(homeContext, '/mywallets');
|
||||
// Navigator.pushNamedAndRemoveUntil(
|
||||
// homeContext, '/mywallets', ModalRoute.withName('/'));
|
||||
},
|
||||
child: Text("accessMyChest".tr(),
|
||||
style:
|
||||
|
|
|
@ -102,7 +102,8 @@ class _ChooseChestState extends State<OnboardingStepFive> {
|
|||
SizedBox(height: 22 * ratio),
|
||||
nextButton(
|
||||
context, "iNotedMyMnemonic".tr(), false, widget.skipIntro),
|
||||
SizedBox(height: 35 * ratio),
|
||||
const Spacer(),
|
||||
// SizedBox(height: 35 * ratio),
|
||||
]),
|
||||
CommonElements().offlineInfo(context),
|
||||
]),
|
||||
|
@ -231,6 +232,7 @@ Widget nextButton(
|
|||
width: 380 * ratio,
|
||||
height: 60 * ratio,
|
||||
child: ElevatedButton(
|
||||
key: keyGoNext,
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 4,
|
||||
primary: orangeC, // background
|
||||
|
|
|
@ -225,6 +225,7 @@ Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
|
|||
width: 380 * ratio,
|
||||
height: 60 * ratio,
|
||||
child: ElevatedButton(
|
||||
key: keyGoNext,
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 4,
|
||||
primary: orangeC, // background
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
|
Loading…
Reference in New Issue