From 28c9af279e116ab988238f349b8bd083964730b4 Mon Sep 17 00:00:00 2001 From: Aleksandr Karbyshev Date: Thu, 25 Jan 2024 13:22:46 +0100 Subject: [PATCH] Update wallet e2e tests --- crates/tests/src/e2e/wallet_tests.rs | 21 +++++++++++---------- crates/tests/src/strings.rs | 3 +++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/crates/tests/src/e2e/wallet_tests.rs b/crates/tests/src/e2e/wallet_tests.rs index 68cb663b98..9ac110008b 100644 --- a/crates/tests/src/e2e/wallet_tests.rs +++ b/crates/tests/src/e2e/wallet_tests.rs @@ -17,7 +17,8 @@ use super::setup; use crate::e2e::setup::Bin; use crate::run; use crate::strings::{ - WALLET_FOUND_TRANSPARENT_KEYS, WALLET_HD_PASSPHRASE_PROMPT, + WALLET_FOUND_TRANSPARENT_KEYS, WALLET_HD_PASSPHRASE_CONFIRMATION_PROMPT, + WALLET_HD_PASSPHRASE_PROMPT, }; /// Test wallet key commands with an encrypted key: @@ -31,15 +32,21 @@ fn wallet_encrypted_key_cmds() -> Result<()> { let password = "VeRySeCuR3"; // 1. key gen - let mut cmd = - run!(test, Bin::Wallet, &["gen", "--alias", key_alias], Some(20),)?; + let mut cmd = run!( + test, + Bin::Wallet, + &["gen", "--alias", key_alias, "--bip39-passphrase"], + Some(20), + )?; cmd.exp_string("Enter your encryption password:")?; cmd.send_line(password)?; cmd.exp_string("Enter same passphrase again: ")?; cmd.send_line(password)?; cmd.exp_string(WALLET_HD_PASSPHRASE_PROMPT)?; - cmd.send_line("")?; + cmd.send_line("test")?; + cmd.exp_string(WALLET_HD_PASSPHRASE_CONFIRMATION_PROMPT)?; + cmd.send_line("test")?; cmd.exp_string(&format!( "Successfully added a key and an address with alias: \"{}\"", key_alias.to_lowercase() @@ -89,9 +96,6 @@ fn wallet_encrypted_key_cmds_env_var() -> Result<()> { let mut cmd = run!(test, Bin::Wallet, &["gen", "--alias", key_alias], Some(20),)?; - cmd.exp_string(WALLET_HD_PASSPHRASE_PROMPT)?; - cmd.send_line("")?; - cmd.exp_string(&format!( "Successfully added a key and an address with alias: \"{}\"", key_alias.to_lowercase() @@ -140,9 +144,6 @@ fn wallet_unencrypted_key_cmds() -> Result<()> { Some(20), )?; - cmd.exp_string(WALLET_HD_PASSPHRASE_PROMPT)?; - cmd.send_line("")?; - cmd.exp_string(&format!( "Successfully added a key and an address with alias: \"{}\"", key_alias.to_lowercase() diff --git a/crates/tests/src/strings.rs b/crates/tests/src/strings.rs index 4def362e75..f0b1f8ea82 100644 --- a/crates/tests/src/strings.rs +++ b/crates/tests/src/strings.rs @@ -27,4 +27,7 @@ pub const TX_ACCEPTED: &str = "Wrapper transaction accepted"; pub const WALLET_HD_PASSPHRASE_PROMPT: &str = "Enter BIP39 passphrase (empty for none): "; +pub const WALLET_HD_PASSPHRASE_CONFIRMATION_PROMPT: &str = + "Enter same passphrase again: "; + pub const WALLET_FOUND_TRANSPARENT_KEYS: &str = "Found transparent keys:";