thirtyfour 0.36.3

Thirtyfour is a Selenium / WebDriver library for Rust, for automated website UI testing. Tested on Chrome and Firefox, but any webdriver-capable browser should work.
Documentation
use http::Method;
use serde_json::json;

use crate::{RequestData, common::command::FormatRequestData};

/// Extra commands specific to Firefox.
#[derive(Debug)]
pub enum FirefoxCommand {
    /// Install the specified add-on.
    InstallAddon {
        /// Path to the add-on.
        path: String,
        /// True if the add-on is temporary.
        temporary: Option<bool>,
    },
    /// Take a full screenshot.
    FullScreenshot {},
}

impl FormatRequestData for FirefoxCommand {
    fn format_request(&self, session_id: &crate::SessionId) -> RequestData {
        match &self {
            FirefoxCommand::InstallAddon {
                path,
                temporary,
            } => {
                RequestData::new(Method::POST, format!("/session/{}/moz/addon/install", session_id))
                    .add_body(json!({
                        "path": path,
                        "temporary": temporary
                    }))
            }
            FirefoxCommand::FullScreenshot {} => RequestData::new(
                Method::GET,
                format!("/session/{}/moz/screenshot/full", session_id),
            ),
        }
    }
}