use super::Result;
shell!(Wtype, "/usr/bin/wtype");
impl Wtype {
pub fn send_keys(&self, keys: Vec<String>) -> Result<()> {
self.inner.exec(keys)?;
Ok(())
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_send_keys() {
let wtype = mock_wtype();
assert_eq!(
Ok(()),
wtype.send_keys(vec![
"me@example.com".into(),
"-k".into(),
"Tab".into(),
"Very Secret Password".into(),
"Return".into()
])
);
}
fn mock_wtype() -> Wtype {
Wtype::new("test/scripts/mock-wtype".into())
}
}