chiark / gitweb /
before make Window not borrow Setup
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 28 Dec 2020 00:42:15 +0000 (00:42 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 28 Dec 2020 00:42:15 +0000 (00:42 +0000)
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 <ijackson@chiark.greenend.org.uk>
wdriver.rs
wdriver/wdt-simple.rs

index 23968a1931c5e56594eee96350d131b3dec81ce3..3ae60345ef48e84a45a27e8a33f666e6b1f0dd9c 100644 (file)
@@ -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
+*/
+
   }
 }
 
index 79a6af1b13e11688eddbb38758f64b4d70be7262..e6f1ac782fb6d79c1467b4ec8bf091a103a8291e 100644 (file)
@@ -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);
 }