Test go to restore sentance generation

This commit is contained in:
poka 2021-04-24 20:27:18 +02:00
parent a85229048c
commit e8aaa0e2c0
16 changed files with 106 additions and 58 deletions

View File

@ -25,7 +25,7 @@ class CommonElements {
); );
} }
Widget bubbleSpeakRich(List<TextSpan> text) { Widget bubbleSpeakRich(List<TextSpan> text, {Key textKey}) {
return Bubble( return Bubble(
padding: BubbleEdges.all(18), padding: BubbleEdges.all(18),
elevation: 5, elevation: 5,
@ -33,13 +33,14 @@ class CommonElements {
margin: BubbleEdges.fromLTRB(10, 0, 20, 10), margin: BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop, // nip: BubbleNip.leftTop,
child: RichText( child: RichText(
key: textKey,
text: TextSpan( text: TextSpan(
style: TextStyle( style: TextStyle(
fontSize: 18.0, fontSize: 18.0,
color: Colors.black, color: Colors.black,
), ),
children: text, children: text,
)), )),
); );
} }

View File

@ -31,6 +31,7 @@ class NoKeyChainScreen extends StatelessWidget {
child: Material( child: Material(
color: Color(0xffFFD58D), // button color color: Color(0xffFFD58D), // button color
child: InkWell( child: InkWell(
key: Key('goStep1'),
splashColor: Color(0xffD28928), // inkwell color splashColor: Color(0xffD28928), // inkwell color
child: Padding( child: Padding(
padding: EdgeInsets.all(8), padding: EdgeInsets.all(8),

View File

@ -22,8 +22,8 @@ class OnboardingStepOne extends StatelessWidget {
common.onboardingProgressBar( common.onboardingProgressBar(
context, 'Nouveau portefeuilles', progress), context, 'Nouveau portefeuilles', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Il semblerait que vous nayez pas encore de trousseau.\n\nUn trousseau vous permet de gérer un ou plusieurs portefeuilles.", "Il semblerait que vous nayez pas encore de trousseau.\n\nUn trousseau vous permet de gérer un ou plusieurs portefeuilles.",
), textKey: Key('step1')),
SizedBox(height: 90), SizedBox(height: 90),
Image.asset( Image.asset(
'assets/onBoarding/keys-and-wallets-horizontal.png', 'assets/onBoarding/keys-and-wallets-horizontal.png',
@ -36,6 +36,7 @@ class OnboardingStepOne extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep2'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -21,7 +21,9 @@ class OnboardingStepTwelve extends StatelessWidget {
common.onboardingProgressBar( common.onboardingProgressBar(
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Si un jour vous changez de téléphone, votre code secret sera différent, mais il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau."), "Si un jour vous changez de téléphone, votre code secret sera différent, mais il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.",
textKey: Key('step10'),
),
SizedBox(height: 10), SizedBox(height: 10),
Image.asset( Image.asset(
'assets/onBoarding/plusieurs-codes-secrets-un-trousseau.png', 'assets/onBoarding/plusieurs-codes-secrets-un-trousseau.png',
@ -34,6 +36,7 @@ class OnboardingStepTwelve extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep11'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -35,17 +35,20 @@ class OnboardingStepThirteen extends StatelessWidget {
}), }),
common.onboardingProgressBar( common.onboardingProgressBar(
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeakRich(<TextSpan>[ common.bubbleSpeakRich(
TextSpan( <TextSpan>[
text: TextSpan(
"Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé "), text:
TextSpan( "Et voilà votre code secret !\n\nMémorisez-le ou notez-le, car il vous sera demandé "),
text: 'à chaque fois', TextSpan(
style: TextStyle(fontWeight: FontWeight.bold)), text: 'à chaque fois',
TextSpan( style: TextStyle(fontWeight: FontWeight.bold)),
text: TextSpan(
" que vous voudrez effectuer un paiement sur cet appareil."), text:
]), " que vous voudrez effectuer un paiement sur cet appareil."),
],
textKey: Key('step11'),
),
SizedBox(height: 100), SizedBox(height: 100),
Container( Container(
child: Stack( child: Stack(
@ -97,6 +100,7 @@ class OnboardingStepThirteen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep12'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -42,7 +42,9 @@ class OnboardingStepFourteen extends StatelessWidget {
common.onboardingProgressBar( common.onboardingProgressBar(
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Avez-vous bien mémorisé votre code secret ?\n\nVérifions ça ensemble !\n\nTapez votre code secret dans le champ ci-dessous (après cest fini, promis-juré-gecko)."), "Avez-vous bien mémorisé votre code secret ?\n\nVérifions ça ensemble !\n\nTapez votre code secret dans le champ ci-dessous (après cest fini, promis-juré-gecko).",
textKey: Key('step12'),
),
SizedBox(height: isTall ? 80 : 10), SizedBox(height: isTall ? 80 : 10),
pinForm(context, _walletOptions, _pinLenght, 1, 3) pinForm(context, _walletOptions, _pinLenght, 1, 3)
]), ]),

View File

@ -21,6 +21,7 @@ class OnboardingStepFiveteen extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !", "Top !\n\nVotre trousseau de clef et votre portefeuille ont été créés avec un immense succès.\n\nFélicitations !",
textKey: Key('step13'),
), ),
SizedBox(height: isTall ? 20 : 10), SizedBox(height: isTall ? 20 : 10),
Image.asset( Image.asset(
@ -34,6 +35,7 @@ class OnboardingStepFiveteen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goWalletHome'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -24,6 +24,7 @@ class OnboardingStepTwo extends StatelessWidget {
context, 'Nouveau portefeuilles', progress), context, 'Nouveau portefeuilles', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Un trousseau est créé à partir dune phrase de restauration.", "Un trousseau est créé à partir dune phrase de restauration.",
textKey: Key('step2'),
), ),
SizedBox(height: 70), SizedBox(height: 70),
Image.asset( Image.asset(
@ -35,6 +36,7 @@ class OnboardingStepTwo extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep3'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -22,6 +22,7 @@ class OnboardingStepFor extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Si un jour vous changez de téléphone, il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.", "Si un jour vous changez de téléphone, il vous suffira de me redonner votre phrase de restauration pour recréer votre trousseau.",
textKey: Key('step3'),
), ),
SizedBox(height: isTall ? 15 : 0), SizedBox(height: isTall ? 15 : 0),
// Row(children: <Widget>[ // Row(children: <Widget>[
@ -40,6 +41,7 @@ class OnboardingStepFor extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep4'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -22,6 +22,7 @@ class OnboardingStepFive extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Par contre, attention :\n\nDans une blockchain, il ny a pas de procédure de récupération de trousseau.\n\nSi vous perdez votre phrase de restauration, je ne pourrai pas vous la communiquer, et vous ne pourrez donc plus jamais accéder à votre compte.", "Par contre, attention :\n\nDans une blockchain, il ny a pas de procédure de récupération de trousseau.\n\nSi vous perdez votre phrase de restauration, je ne pourrai pas vous la communiquer, et vous ne pourrez donc plus jamais accéder à votre compte.",
textKey: Key('step4'),
), ),
SizedBox(height: isTall ? 30 : 10), SizedBox(height: isTall ? 30 : 10),
Image.asset( Image.asset(
@ -35,6 +36,7 @@ class OnboardingStepFive extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep5'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -30,6 +30,7 @@ class OnboardingStepSeven extends StatelessWidget {
text: text:
"afin de pouvoir noter votre phrase de restauration."), "afin de pouvoir noter votre phrase de restauration."),
], ],
textKey: Key('step5'),
), ),
Expanded( Expanded(
child: Align( child: Align(
@ -52,6 +53,7 @@ class OnboardingStepSeven extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep6'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -23,6 +23,7 @@ class OnboardingStepEight extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Jai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.", "Jai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.",
textKey: Key('step6'),
), ),
SizedBox(height: isTall ? 61 : 31), SizedBox(height: isTall ? 61 : 31),
// SizedBox(height: 30), // SizedBox(height: 30),
@ -35,6 +36,7 @@ class OnboardingStepEight extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep7'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -29,6 +29,7 @@ class OnboardingStepNine extends StatelessWidget {
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeak( common.bubbleSpeak(
"Cest le moment de noter votre phrase !", "Cest le moment de noter votre phrase !",
textKey: Key('step7'),
long: 60, long: 60,
), ),
SizedBox(height: isTall ? 100 : 70), SizedBox(height: isTall ? 100 : 70),
@ -71,6 +72,7 @@ class OnboardingStepNine extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep8'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -46,19 +46,22 @@ class OnboardingStepTen extends StatelessWidget {
child: Column(children: <Widget>[ child: Column(children: <Widget>[
common.onboardingProgressBar( common.onboardingProgressBar(
context, 'Valider ma phrase de restauration', progress), context, 'Valider ma phrase de restauration', progress),
common.bubbleSpeakRich(<TextSpan>[ common.bubbleSpeakRich(
TextSpan( <TextSpan>[
text: TextSpan(
"Avez-vous bien noté votre phrase de restauration ?\n\nPour en être sûr, veuillez taper dans le champ ci-dessous le ", text:
style: TextStyle(fontSize: 16 * ratio)), "Avez-vous bien noté votre phrase de restauration ?\n\nPour en être sûr, veuillez taper dans le champ ci-dessous le ",
TextSpan( style: TextStyle(fontSize: 16 * ratio)),
text: '${_generateWalletProvider.nbrWord + 1}ème mot', TextSpan(
style: TextStyle( text: '${_generateWalletProvider.nbrWord + 1}ème mot',
fontWeight: FontWeight.bold, fontSize: 16 * ratio)), style: TextStyle(
TextSpan( fontWeight: FontWeight.bold, fontSize: 16 * ratio)),
text: " de votre phrase de restauration :", TextSpan(
style: TextStyle(fontSize: 16 * ratio)), text: " de votre phrase de restauration :",
]), style: TextStyle(fontSize: 16 * ratio)),
],
textKey: Key('step8'),
),
// LayoutBuilder(builder: (builder, constraints) { // LayoutBuilder(builder: (builder, constraints) {
// // 2 // // 2
@ -154,6 +157,7 @@ class OnboardingStepTen extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep9'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -20,15 +20,18 @@ class OnboardingStepEleven extends StatelessWidget {
child: Column(children: <Widget>[ child: Column(children: <Widget>[
common.onboardingProgressBar( common.onboardingProgressBar(
context, 'Ma phrase de restauration', progress), context, 'Ma phrase de restauration', progress),
common.bubbleSpeakRich(<TextSpan>[ common.bubbleSpeakRich(
TextSpan(text: "Super !\n\nJe vais maintenant créer votre "), <TextSpan>[
TextSpan( TextSpan(text: "Super !\n\nJe vais maintenant créer votre "),
text: 'code secret.', TextSpan(
style: TextStyle(fontWeight: FontWeight.bold)), text: 'code secret.',
TextSpan( style: TextStyle(fontWeight: FontWeight.bold)),
text: TextSpan(
" \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole."), text:
]), " \n\nVotre code secret chiffre votre trousseau de clefs, ce qui le rend inutilisable par dautres, par exemple si vous perdez votre téléphone ou si on vous le vole."),
],
textKey: Key('step8'),
),
SizedBox(height: isTall ? 50 : 10), SizedBox(height: isTall ? 50 : 10),
Image.asset( Image.asset(
'assets/onBoarding/treasure-chest-gecko-souligne.png', 'assets/onBoarding/treasure-chest-gecko-souligne.png',
@ -41,6 +44,7 @@ class OnboardingStepEleven extends StatelessWidget {
width: 400, width: 400,
height: 62, height: 62,
child: ElevatedButton( child: ElevatedButton(
key: Key('goStep10'),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
elevation: 5, elevation: 5,
primary: Color(0xffD28928), primary: Color(0xffD28928),

View File

@ -26,23 +26,37 @@ void main() {
} }
}); });
test('Open wallets management - OnBoarding', () async { test('OnBoarding - Open wallets management', (
await driver.runUnsynchronized(() async { {timeout: const Duration(seconds: 2)}) async {
// First, tap the button manage wallets // await driver.runUnsynchronized(() async { // Needed if we want to manage async drivers
await driver.tap(manageWalletsFinder); await driver.tap(manageWalletsFinder);
// Get the SerializableFinder for text widget with key 'textOnboarding' // Get the SerializableFinder for text widget with key 'textOnboarding'
SerializableFinder textOnboarding = find.byValueKey( SerializableFinder textOnboarding = find.byValueKey(
'textOnboarding', 'textOnboarding',
); );
print( print(
'####################################################################'); '####################################################################');
// Verify onboarding is starting, with text // Verify onboarding is starting, with text
expect(await driver.getText(textOnboarding), expect(await driver.getText(textOnboarding),
"Je ne connais pour linstant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant."); "Je ne connais pour linstant aucun de vos portefeuilles.\n\nVous pouvez en créer un nouveau, ou bien importer un portefeuille Cesium existant.");
}); });
test('OnBoarding - Go to create restore sentance', (
{timeout: const Duration(seconds: 5)}) async {
await driver.tap(find.byValueKey('goStep1'));
await driver.tap(find.byValueKey('goStep2'));
await driver.tap(find.byValueKey('goStep3'));
await driver.tap(find.byValueKey('goStep4'));
await driver.tap(find.byValueKey('goStep5'));
expect(
await driver.getText(find.byValueKey(
'step5',
)),
"Munissez-vous d'un papier et dun crayon\nafin de pouvoir noter votre phrase de restauration.");
}); });
}); });
} }