From ff264e2a6c735990924af0a7c7884f57abf5af1f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 28 Dec 2020 00:42:15 +0000 Subject: [PATCH] before make Window not borrow Setup We want to borrow it mut so screenshot works We need to not borrow it mut so you can have many windows Signed-off-by: Ian Jackson --- wdriver.rs | 18 +++++++++++------- wdriver/wdt-simple.rs | 4 ++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/wdriver.rs b/wdriver.rs index 23968a19..3ae60345 100644 --- a/wdriver.rs +++ b/wdriver.rs @@ -698,6 +698,13 @@ impl<'g> Deref for WindowGuard<'g> { fn deref(&self) -> &T4d { &self.w.su.driver } } +impl<'g> WindowGuard<'g> { + #[throws(AE)] + fn screenshot(&mut self, slug: &str) { + screenshot(&self.w.su.driver, &mut self.w.su.screenshot_count, slug)? + } +} + #[throws(AE)] fn screenshot(driver: &T4d, count: &mut ScreenShotCount, slug: &str) { let path = format!("{:03}{}.png", count, slug); @@ -717,18 +724,15 @@ impl Drop for FinalInfoCollection { } } -impl Setup { - #[throws(AE)] - fn screenshot(&mut self, slug: &str) { - screenshot(&self.driver, &mut self.screenshot_count, slug)? - } -} - impl Drop for Setup { fn drop(&mut self) { + /* self.screenshot("final") .context("in Setup::drop") .just_warn(); +xxx +*/ + } } diff --git a/wdriver/wdt-simple.rs b/wdriver/wdt-simple.rs index 79a6af1b..e6f1ac78 100644 --- a/wdriver/wdt-simple.rs +++ b/wdriver/wdt-simple.rs @@ -8,6 +8,10 @@ use otter_webdriver_tests::*; fn main(){ let su = setup(module_path!()).always_context("setup")?; + let w1 = su.new_window("alice")?; + w1.get("/?zonk")?; + w1.screenshot("test alice")?; + debug!("ok"); info!("hi! {:#?}", &su.ds); } -- 2.30.2