Lines
100 %
Functions
Branches
//! Saving a commodity twice from one edit page: the second save must not be stale.
use anyhow::{Result, ensure};
use super::harness::{Harness, with_harness};
use super::page::{login, open, set_text, submit};
async fn save_twice(h: &Harness) -> Result<()> {
login(h).await?;
open(h, &format!("/commodity/{}/edit", h.commodity("JPY"))).await?;
for name in ["Yen one", "Yen two"] {
set_text(h, "name", name).await?;
let reply = submit(h).await?;
ensure!(reply.starts_with("Commodity updated with ID"), "{reply}");
}
Ok(())
#[supp_macro::shared_runtime_test]
async fn a_second_save_from_the_same_page_is_not_stale() -> Result<()> {
with_harness(|h| Box::pin(save_twice(h))).await