Skip to content

Commit

Permalink
Update wallet e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karbyshev committed Jan 25, 2024
1 parent f5c9257 commit 28c9af2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 11 additions & 10 deletions crates/tests/src/e2e/wallet_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions crates/tests/src/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:";

0 comments on commit 28c9af2

Please sign in to comment.