forked from cypherstack/stack_wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_new_wallet_test.dart
134 lines (107 loc) · 4.54 KB
/
create_new_wallet_test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:stackwallet/main.dart' as campfireApp;
import 'package:stackwallet/pages/main_view.dart';
import 'bot_runners/create_wallet_until_pin_confirmation.dart';
import 'bots/onboarding/backup_key_view_bot.dart';
import 'bots/onboarding/backup_key_warning_bot.dart';
import 'bots/onboarding/create_pin_view_bot.dart';
import 'bots/onboarding/name_your_wallet_view_bot.dart';
import 'bots/onboarding/onboarding_view_bot.dart';
import 'bots/onboarding/terms_and_conditions_bot.dart';
import 'bots/onboarding/verify_backup_key_view_bot.dart';
void main() {
group("Campfire app test", () {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets("new wallet creation", (tester) async {
campfireApp.main();
await tester.pumpAndSettle(Duration(seconds: 10));
final onboardingViewBot = OnboardingViewBot(tester);
final termsAndConditionsViewBot = TermsAndConditionsViewBot(tester);
final nameYourWalletViewBot = NameYourWalletViewBot(tester);
final createPinViewBot = CreatePinViewBot(tester);
final backupKeyWarningViewBot = BackupKeyWarningViewBot(tester);
final backupKeyViewBot = BackupKeyViewBot(tester);
final verifyBackUpViewBot = VerifyBackupKeyViewBot(tester);
// tap create new wallet button
await onboardingViewBot.ensureVisible();
await onboardingViewBot.tapCreateNewWallet();
await termsAndConditionsViewBot.ensureVisible();
// test tap back
await termsAndConditionsViewBot.tapBack();
await onboardingViewBot.ensureVisible();
// tap new again
await onboardingViewBot.tapCreateNewWallet();
await createWalletUntilPinConfirmation(
termsAndConditionsViewBot,
nameYourWalletViewBot,
createPinViewBot,
);
// wait for wallet generation
await tester.pumpAndSettle(Duration(seconds: 60));
await backupKeyWarningViewBot.ensureVisible();
// tap back
await backupKeyWarningViewBot.tapBack();
await onboardingViewBot.ensureVisible();
// tap create new wallet button
await onboardingViewBot.ensureVisible();
await onboardingViewBot.tapCreateNewWallet();
await termsAndConditionsViewBot.ensureVisible();
// test tap back
await termsAndConditionsViewBot.tapBack();
await onboardingViewBot.ensureVisible();
// tap new again
await onboardingViewBot.tapCreateNewWallet();
// run through to backup key warning again
await createWalletUntilPinConfirmation(
termsAndConditionsViewBot,
nameYourWalletViewBot,
createPinViewBot,
);
// wait for wallet generation
await tester.pumpAndSettle(Duration(seconds: 60));
await backupKeyWarningViewBot.ensureVisible();
// enable checkbox
await backupKeyWarningViewBot.tapCheckBox();
await backupKeyWarningViewBot.tapViewBackupKey();
// expect to see mnemonic displayed
await backupKeyViewBot.ensureVisible();
// tap back
await backupKeyViewBot.tapBack();
await backupKeyWarningViewBot.ensureVisible();
// advance again
await backupKeyWarningViewBot.tapViewBackupKey();
// expect to see mnemonic displayed again
await backupKeyViewBot.ensureVisible();
// tap qr code
await backupKeyViewBot.tapQrCode();
// tap cancel to pop qr code view
await tester.tap(find.byKey(Key("backUpKeyViewQrCodeCancelButtonKey")));
await tester.pumpAndSettle();
// tap copy
await backupKeyViewBot.tapCopy();
// fetch words to verify on next page
final words = await backupKeyViewBot.displayedMnemonic();
// tap verify to go to next screen
await backupKeyViewBot.tapVerify();
// expect next screen
await verifyBackUpViewBot.ensureVisible();
// ensure overlay from previous copy function has gone away
await tester.pumpAndSettle(Duration(seconds: 2));
// tap back
await verifyBackUpViewBot.tapBack();
await backupKeyViewBot.ensureVisible();
// continue forward again
await backupKeyViewBot.tapVerify();
// expect next screen again
await verifyBackUpViewBot.ensureVisible();
// enter requested word
await verifyBackUpViewBot.enterRequestedWord(words);
// tap confirm to check validity
await verifyBackUpViewBot.tapConfirm();
// expect main wallet view
expect(find.byType(MainView), findsOneWidget);
});
});
}