From 736172ace10fc6f81e57005b4ff8fc52c32b04e9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 3 May 2021 18:33:05 +0100 Subject: [PATCH] bundles: Add wdt test to see that things show up in the UI Signed-off-by: Ian Jackson --- wdriver/wdriver.rs | 1 + wdriver/wdt-bundles.rs | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 wdriver/wdt-bundles.rs diff --git a/wdriver/wdriver.rs b/wdriver/wdriver.rs index 04cf6c3d..e6f25f77 100644 --- a/wdriver/wdriver.rs +++ b/wdriver/wdriver.rs @@ -936,3 +936,4 @@ fn main(){ portmanteau_has!("wdt-altergame.rs", wdt_altergame); portmanteau_has!("wdt-hand.rs", wdt_hand); portmanteau_has!("wdt-simple.rs", wdt_simple); +portmanteau_has!("wdt-bundles.rs", wdt_bundles); diff --git a/wdriver/wdt-bundles.rs b/wdriver/wdt-bundles.rs new file mode 100644 index 00000000..4dce0ae4 --- /dev/null +++ b/wdriver/wdt-bundles.rs @@ -0,0 +1,48 @@ +// Copyright 2020-2021 Ian Jackson and contributors to Otter +// SPDX-License-Identifier: AGPL-3.0-or-later +// There is NO WARRANTY. + +use crate::*; + +struct Ctx { + su: Setup, + alice: Window, +} +usual_wanted_tests!{Ctx, su} + +impl Ctx { + #[throws(Explode)] + fn otter(&mut self, verb: &[&str], args: &[&str]) { + self.su.w(&self.alice)?.otter(verb, args)? + } +} + +#[throws(AE)] +fn tests(UsualSetup { su, alice, ..}: UsualSetup) { + let mut c = Ctx { su, alice }; + + test!(c, "bundle", { + let test_bundle = c.su.ds.example_bundle(); + c.otter(&["upload-bundle"],&[&test_bundle])?; + let mut w = c.su.w(&c.alice)?; + + let check = |w: &mut WindowGuard<'_>| Ok::<_,Explode>({ + w.synch()?; + let bundle_id = w.find_element(By::ClassName("b_id"))?; + let html = bundle_id.inner_html()?; + assert_eq!(&html, "00000.zip"); + }); + + check(&mut w)?; + + let url = w.current_url()?; + w.get(url)?; + check(&mut w)?; + + }); + + debug!("finishing"); +} + +#[throws(AE)] +pub fn main() { as_usual(tests, module_path!())?; } -- 2.30.2