forked from axiom-team/gecko
wip: test onboarding
This commit is contained in:
parent
e01dea9329
commit
ad9ee382d3
|
@ -134,6 +134,6 @@ Future certifyTest5() async {
|
||||||
|
|
||||||
// Check UD reval
|
// Check UD reval
|
||||||
await spawnBlock(until: 50);
|
await spawnBlock(until: 50);
|
||||||
await waitFor('509.35');
|
await waitFor('509.36');
|
||||||
humanRead(5);
|
humanRead(5);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
|
import 'package:gecko/providers/generate_wallets.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'tests_utility.dart';
|
import 'tests_utility.dart';
|
||||||
|
|
||||||
// GENERAL ACTIONS
|
// GENERAL ACTIONS
|
||||||
|
@ -83,6 +85,68 @@ Future restoreChest() async {
|
||||||
await goBack();
|
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 {
|
Future addDerivation() async {
|
||||||
await tapKey(keyAddDerivation);
|
await tapKey(keyAddDerivation);
|
||||||
await waitFor('Portefeuille 5');
|
await waitFor('Portefeuille 5');
|
||||||
|
|
|
@ -17,7 +17,7 @@ docker-compose up -d
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
# Start integration test
|
# 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
|
# Reset .env
|
||||||
echo "ip_address=127.0.0.1" > .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 {
|
Future bkDeleteAllWallets() async {
|
||||||
final myWalletProvider =
|
final myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(homeContext, listen: false);
|
Provider.of<MyWalletsProvider>(homeContext, listen: false);
|
||||||
if (myWalletProvider.listWallets.isNotEmpty) {
|
final isWalletsPresents =
|
||||||
await myWalletProvider.deleteAllWallet(homeContext);
|
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();
|
myWalletProvider.rebuildWidget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future bkFastStart() async {
|
Future bkFastStart([bool restoreChest = true]) async {
|
||||||
// Start app and wait finish starting
|
// Start app and wait finish starting
|
||||||
await startWait();
|
await startWait();
|
||||||
|
|
||||||
|
@ -282,16 +288,23 @@ Future bkFastStart() async {
|
||||||
// Delete all existing chests is exists
|
// Delete all existing chests is exists
|
||||||
await bkDeleteAllWallets();
|
await bkDeleteAllWallets();
|
||||||
|
|
||||||
// Restore the test chest
|
if (restoreChest) {
|
||||||
await bkRestoreChest();
|
// Restore the test chest
|
||||||
await waitFor("y'a pas de lézard");
|
await bkRestoreChest();
|
||||||
|
await waitFor("y'a pas de lézard");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future startWait() async {
|
Future startWait() async {
|
||||||
app.main();
|
app.main();
|
||||||
await waitFor('Test starting...', reverse: true);
|
await waitFor('Test starting...', reverse: true);
|
||||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
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 {
|
class TestWallet {
|
||||||
|
|
|
@ -16,6 +16,7 @@ const keyDrawerMenu = Key('keyDrawerMenu');
|
||||||
const keyOpenWalletsHomme = Key('keyOpenWalletsHomme');
|
const keyOpenWalletsHomme = Key('keyOpenWalletsHomme');
|
||||||
const keyOpenSearch = Key('keyOpenSearch');
|
const keyOpenSearch = Key('keyOpenSearch');
|
||||||
const keyRestoreChest = Key('keyRestoreChest');
|
const keyRestoreChest = Key('keyRestoreChest');
|
||||||
|
const keyOnboardingNewChest = Key('keyOnboardingNewChest');
|
||||||
|
|
||||||
// Wallets home
|
// Wallets home
|
||||||
const keyImportG1v1 = Key('keyImportG1v1');
|
const keyImportG1v1 = Key('keyImportG1v1');
|
||||||
|
|
|
@ -538,7 +538,7 @@ Widget welcomeHome(context) {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 410,
|
width: 410,
|
||||||
height: 70,
|
height: 70,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(key: keyOnboardingNewChest,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
primary: orangeC, // background
|
primary: orangeC, // background
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// ignore_for_file: file_names
|
// ignore_for_file: file_names
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -228,6 +229,7 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
|
|
||||||
generateWalletProvider.generatedMnemonic = '';
|
generateWalletProvider.generatedMnemonic = '';
|
||||||
myWalletProvider.resetPinCode();
|
myWalletProvider.resetPinCode();
|
||||||
|
// sleep(const Duration(milliseconds: 500));
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
FaderTransition(
|
FaderTransition(
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// ignore_for_file: file_names
|
// ignore_for_file: file_names
|
||||||
|
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -62,13 +64,12 @@ Widget finishButton(BuildContext context) {
|
||||||
onPrimary: Colors.white, // foreground
|
onPrimary: Colors.white, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushAndRemoveUntil(
|
// sleep(const Duration(milliseconds: 50));
|
||||||
context,
|
Navigator.popUntil(homeContext, ModalRoute.withName('/'));
|
||||||
MaterialPageRoute(builder: (context) {
|
// sleep(const Duration(milliseconds: 500));
|
||||||
return const WalletsHome();
|
Navigator.pushNamed(homeContext, '/mywallets');
|
||||||
}),
|
// Navigator.pushNamedAndRemoveUntil(
|
||||||
ModalRoute.withName('/'),
|
// homeContext, '/mywallets', ModalRoute.withName('/'));
|
||||||
);
|
|
||||||
},
|
},
|
||||||
child: Text("accessMyChest".tr(),
|
child: Text("accessMyChest".tr(),
|
||||||
style:
|
style:
|
||||||
|
|
|
@ -102,7 +102,8 @@ class _ChooseChestState extends State<OnboardingStepFive> {
|
||||||
SizedBox(height: 22 * ratio),
|
SizedBox(height: 22 * ratio),
|
||||||
nextButton(
|
nextButton(
|
||||||
context, "iNotedMyMnemonic".tr(), false, widget.skipIntro),
|
context, "iNotedMyMnemonic".tr(), false, widget.skipIntro),
|
||||||
SizedBox(height: 35 * ratio),
|
const Spacer(),
|
||||||
|
// SizedBox(height: 35 * ratio),
|
||||||
]),
|
]),
|
||||||
CommonElements().offlineInfo(context),
|
CommonElements().offlineInfo(context),
|
||||||
]),
|
]),
|
||||||
|
@ -231,6 +232,7 @@ Widget nextButton(
|
||||||
width: 380 * ratio,
|
width: 380 * ratio,
|
||||||
height: 60 * ratio,
|
height: 60 * ratio,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
key: keyGoNext,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
primary: orangeC, // background
|
primary: orangeC, // background
|
||||||
|
|
|
@ -225,6 +225,7 @@ Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
|
||||||
width: 380 * ratio,
|
width: 380 * ratio,
|
||||||
height: 60 * ratio,
|
height: 60 * ratio,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
key: keyGoNext,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
primary: orangeC, // background
|
primary: orangeC, // background
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
|
Loading…
Reference in New Issue