Continue to test wallets management views
This commit is contained in:
parent
347aff7059
commit
f193f5efac
|
@ -268,13 +268,13 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text("Non"),
|
child: Text("Non", key: Key('cancelDeleting')),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context, false);
|
Navigator.pop(context, false);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text("Oui"),
|
child: Text("Oui", key: Key('confirmDeleting')),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
},
|
},
|
||||||
|
|
|
@ -94,7 +94,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
length: _pinLenght,
|
length: _pinLenght,
|
||||||
obscureText: false,
|
obscureText: true,
|
||||||
obscuringCharacter: '*',
|
obscuringCharacter: '*',
|
||||||
animationType: AnimationType.fade,
|
animationType: AnimationType.fade,
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
|
|
|
@ -205,6 +205,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
InkWell(
|
InkWell(
|
||||||
|
key: Key('displayBalance'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_walletOptions.bluringBalance();
|
_walletOptions.bluringBalance();
|
||||||
},
|
},
|
||||||
|
@ -279,6 +280,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
}),
|
}),
|
||||||
SizedBox(height: 15 * ratio),
|
SizedBox(height: 15 * ratio),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
key: Key('copyPubkey'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Clipboard.setData(
|
Clipboard.setData(
|
||||||
ClipboardData(text: _walletOptions.pubkey.text));
|
ClipboardData(text: _walletOptions.pubkey.text));
|
||||||
|
@ -334,6 +336,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
]))),
|
]))),
|
||||||
SizedBox(height: 10 * ratio),
|
SizedBox(height: 10 * ratio),
|
||||||
InkWell(
|
InkWell(
|
||||||
|
key: Key('displayHistory'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
|
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
|
||||||
goHistory: true);
|
goHistory: true);
|
||||||
|
@ -352,6 +355,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
]))),
|
]))),
|
||||||
SizedBox(height: 12 * ratio),
|
SizedBox(height: 12 * ratio),
|
||||||
InkWell(
|
InkWell(
|
||||||
|
key: Key('setDefaultWallet'),
|
||||||
onTap: !_walletOptions.isDefaultWallet
|
onTap: !_walletOptions.isDefaultWallet
|
||||||
? () {
|
? () {
|
||||||
defaultWallet = wallet;
|
defaultWallet = wallet;
|
||||||
|
@ -381,25 +385,31 @@ class WalletOptions extends StatelessWidget {
|
||||||
: Colors.black)),
|
: Colors.black)),
|
||||||
]))),
|
]))),
|
||||||
SizedBox(height: 17 * ratio),
|
SizedBox(height: 17 * ratio),
|
||||||
InkWell(
|
if (!_walletOptions.isDefaultWallet)
|
||||||
onTap: () async {
|
InkWell(
|
||||||
await _walletOptions.deleteWallet(context, wallet);
|
key: Key('deleteWallet'),
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
onTap: !_walletOptions.isDefaultWallet
|
||||||
_myWalletProvider.listWallets =
|
? () async {
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
await _walletOptions.deleteWallet(
|
||||||
_myWalletProvider.rebuildWidget();
|
context, wallet);
|
||||||
});
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
},
|
_myWalletProvider.listWallets =
|
||||||
child: Row(children: <Widget>[
|
_myWalletProvider
|
||||||
SizedBox(width: 33),
|
.readAllWallets(_currentChest);
|
||||||
Image.asset(
|
_myWalletProvider.rebuildWidget();
|
||||||
'assets/walletOptions/trash.png',
|
});
|
||||||
),
|
}
|
||||||
SizedBox(width: 14),
|
: null,
|
||||||
Text('Supprimer ce portefeuille',
|
child: Row(children: <Widget>[
|
||||||
style: TextStyle(
|
SizedBox(width: 33),
|
||||||
fontSize: 20, color: Color(0xffD80000))),
|
Image.asset(
|
||||||
])),
|
'assets/walletOptions/trash.png',
|
||||||
|
),
|
||||||
|
SizedBox(width: 14),
|
||||||
|
Text('Supprimer ce portefeuille',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, color: Color(0xffD80000))),
|
||||||
|
])),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -84,6 +84,7 @@ class OnboardingStepThirteen extends StatelessWidget {
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 62,
|
height: 62,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
key: Key('changeSecretCode'),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 5,
|
elevation: 5,
|
||||||
primary: Color(0xffFFD58D),
|
primary: Color(0xffFFD58D),
|
||||||
|
|
|
@ -15,6 +15,7 @@ void main() {
|
||||||
// final buttonFinder = find.byValueKey('increment');
|
// final buttonFinder = find.byValueKey('increment');
|
||||||
|
|
||||||
FlutterDriver driver;
|
FlutterDriver driver;
|
||||||
|
String pinCode;
|
||||||
|
|
||||||
// Connect to the Flutter driver before running any tests.
|
// Connect to the Flutter driver before running any tests.
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
|
@ -80,7 +81,7 @@ void main() {
|
||||||
|
|
||||||
while (await getText('word1') == '...') {
|
while (await getText('word1') == '...') {
|
||||||
print('Waiting for Mnemonic generation...');
|
print('Waiting for Mnemonic generation...');
|
||||||
await Future.delayed(const Duration(milliseconds: 100));
|
await sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future selectWord() async {
|
Future selectWord() async {
|
||||||
|
@ -93,15 +94,12 @@ void main() {
|
||||||
await getText('step7'), "C'est le moment de noter votre phrase !");
|
await getText('step7'), "C'est le moment de noter votre phrase !");
|
||||||
|
|
||||||
await tapOn('goStep8');
|
await tapOn('goStep8');
|
||||||
await Future.delayed(const Duration(milliseconds: 200));
|
await sleep(200);
|
||||||
|
|
||||||
String goodWord = words[int.parse(
|
String goodWord = words[int.parse(
|
||||||
await getText('askedWord'),
|
await getText('askedWord'),
|
||||||
)];
|
)];
|
||||||
|
|
||||||
// await tapOn('inputWord');
|
|
||||||
// await Future.delayed(const Duration(milliseconds: 500));
|
|
||||||
|
|
||||||
// Enter the expected word
|
// Enter the expected word
|
||||||
await driver.enterText(goodWord);
|
await driver.enterText(goodWord);
|
||||||
|
|
||||||
|
@ -117,13 +115,13 @@ void main() {
|
||||||
//Go back 2 times to mnemonic generation screen
|
//Go back 2 times to mnemonic generation screen
|
||||||
await goBack();
|
await goBack();
|
||||||
await goBack();
|
await goBack();
|
||||||
await Future.delayed(const Duration(milliseconds: 100));
|
await sleep(100);
|
||||||
|
|
||||||
// Generate 3 times mnemonic
|
// Generate 3 times mnemonic
|
||||||
await tapOn('generateMnemonic');
|
await tapOn('generateMnemonic');
|
||||||
await tapOn('generateMnemonic');
|
await tapOn('generateMnemonic');
|
||||||
await tapOn('generateMnemonic');
|
await tapOn('generateMnemonic');
|
||||||
await Future.delayed(const Duration(milliseconds: 500));
|
await sleep(500);
|
||||||
|
|
||||||
await selectWord();
|
await selectWord();
|
||||||
});
|
});
|
||||||
|
@ -137,18 +135,22 @@ void main() {
|
||||||
|
|
||||||
while (await getText('generatedPin') == '') {
|
while (await getText('generatedPin') == '') {
|
||||||
print('Waiting for pin code generation...');
|
print('Waiting for pin code generation...');
|
||||||
await Future.delayed(const Duration(milliseconds: 100));
|
await sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
final pinCode = await getText('generatedPin');
|
// Change secret code 4 times
|
||||||
|
for (int i = 0; i < 4; i++) await tapOn('changeSecretCode');
|
||||||
|
|
||||||
|
await sleep(500);
|
||||||
|
pinCode = await getText('generatedPin');
|
||||||
|
|
||||||
await tapOn('goStep12');
|
await tapOn('goStep12');
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
await sleep(300);
|
||||||
|
|
||||||
// //Enter bad secret code
|
// //Enter bad secret code
|
||||||
// await driver.enterText('abcde');
|
// await driver.enterText('abcde');
|
||||||
// await tapOn('formKey');
|
// await tapOn('formKey');
|
||||||
// await Future.delayed(const Duration(milliseconds: 4000));
|
// await sleep(1500);
|
||||||
// await tapOn('formKey2');
|
// await tapOn('formKey2');
|
||||||
|
|
||||||
//Enter good secret code
|
//Enter good secret code
|
||||||
|
@ -163,21 +165,96 @@ void main() {
|
||||||
await tapOn('goWalletHome');
|
await tapOn('goWalletHome');
|
||||||
|
|
||||||
expect(await getText('myWallets'), "Mes portefeuilles");
|
expect(await getText('myWallets'), "Mes portefeuilles");
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
await sleep(300);
|
||||||
|
|
||||||
|
// Create a derivation
|
||||||
|
Future createDerivation(String _name) async {
|
||||||
|
await tapOn('addDerivation');
|
||||||
|
await sleep(100);
|
||||||
|
|
||||||
|
await driver.enterText(_name);
|
||||||
|
|
||||||
|
await tapOn('validDerivation');
|
||||||
|
await sleep(300);
|
||||||
|
}
|
||||||
|
|
||||||
// Add a second derivation
|
// Add a second derivation
|
||||||
await tapOn('addDerivation');
|
await createDerivation('Derivation 2');
|
||||||
await Future.delayed(const Duration(milliseconds: 50));
|
|
||||||
|
|
||||||
await driver.enterText('Derivation 2');
|
|
||||||
|
|
||||||
await tapOn('validDerivation');
|
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
|
||||||
|
|
||||||
|
// Go to second derivation options
|
||||||
await driver.tap(find.text('Derivation 2'));
|
await driver.tap(find.text('Derivation 2'));
|
||||||
|
await sleep(100);
|
||||||
|
|
||||||
|
// Test options
|
||||||
|
await tapOn('displayBalance');
|
||||||
|
await tapOn('displayHistory');
|
||||||
|
await sleep(300);
|
||||||
|
await goBack();
|
||||||
|
await tapOn('displayBalance');
|
||||||
|
await sleep(100);
|
||||||
|
await tapOn('displayBalance');
|
||||||
|
await sleep(100);
|
||||||
|
await tapOn('displayBalance');
|
||||||
|
await tapOn('setDefaultWallet');
|
||||||
|
await sleep(50);
|
||||||
|
await tapOn('copyPubkey');
|
||||||
|
await driver.waitFor(find
|
||||||
|
.text('Cette clé publique a été copié dans votre presse-papier.'));
|
||||||
|
await goBack();
|
||||||
|
|
||||||
|
// Add a third derivation
|
||||||
|
await createDerivation('Derivation 3');
|
||||||
|
|
||||||
|
// Add a fourth derivation
|
||||||
|
await createDerivation('Derivation 4');
|
||||||
|
await sleep(50);
|
||||||
|
|
||||||
|
// Go to third derivation options
|
||||||
|
await driver.tap(find.text('Derivation 3'));
|
||||||
|
await sleep(100);
|
||||||
|
await tapOn('displayBalance');
|
||||||
|
|
||||||
|
// Delete a derivation
|
||||||
|
Future deleteWallet(bool _confirm) async {
|
||||||
|
await tapOn('deleteWallet');
|
||||||
|
await sleep(100);
|
||||||
|
_confirm
|
||||||
|
? await tapOn('confirmDeleting')
|
||||||
|
: await tapOn('cancelDeleting');
|
||||||
|
await sleep(300);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete third derivation
|
||||||
|
await deleteWallet(true);
|
||||||
|
|
||||||
|
// Add derivation 5,6 and 7
|
||||||
|
await createDerivation('Derivation 5');
|
||||||
|
await createDerivation('Derivation 6');
|
||||||
|
await createDerivation('Derivation 7');
|
||||||
|
|
||||||
|
// Go home and come back to my wallets view
|
||||||
|
await goBack();
|
||||||
|
await sleep(100);
|
||||||
|
await tapOn('manageWallets');
|
||||||
|
await sleep(200);
|
||||||
|
//Enter secret code
|
||||||
|
await driver.enterText(pinCode);
|
||||||
|
await sleep(200);
|
||||||
|
|
||||||
|
// Go to derivation 6 and delete it
|
||||||
|
await driver.tap(find.text('Derivation 6'));
|
||||||
|
await sleep(100);
|
||||||
|
await deleteWallet(true);
|
||||||
|
|
||||||
|
// Go to 2nd derivation and check if it's de default
|
||||||
|
await driver.tap(find.text('Derivation 2'));
|
||||||
|
await driver.waitFor(find.text('Ce portefeuille est celui par defaut'));
|
||||||
|
await tapOn('setDefaultWallet');
|
||||||
|
await sleep(100);
|
||||||
|
await driver.waitFor(find.text('Ce portefeuille est celui par defaut'));
|
||||||
|
|
||||||
// Wait 3 seconds at the end
|
// Wait 3 seconds at the end
|
||||||
await Future.delayed(const Duration(seconds: 3));
|
await sleep(3000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -190,3 +267,7 @@ Future goBack() async {
|
||||||
runInShell: true,
|
runInShell: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future sleep(int _time) async {
|
||||||
|
await Future.delayed(Duration(milliseconds: _time));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue