//! UI tests driving the spreadsheet workspace through Makepad event //! delivery. //! //! **Currently `#[ignore]`d, for the same reason as `pdf-makepad`'s.** The //! fork's `makepad_test` sets `MAKEPAD=headless` for the app it spawns, but //! `platform/src/os/linux/windowing_backend.rs` only knows `X11` and //! `Wayland` — there is no headless backend, so the app selects X11, finds //! no display and dies. The full diagnosis is in //! `REVIEWS/PDF_PARITY_PHASE1_STATUS.md`. //! //! Until this file was reached by `--all-targets` it had **never compiled**: //! `spreadsheet-ui` did not enable `makepad-widgets`' `test` feature, so the //! `makepad_widgets::makepad_test` import failed. `cargo test --lib` never //! built it and nothing reported the breakage. The manifest now enables the //! feature, matching `pdf-makepad`, so the file is compiled on every run and //! cannot rot further while appearing to be coverage. //! //! Ignored rather than deleted or left failing on purpose: a red suite //! everyone knows to disregard stops reporting the next real regression. //! Remove the markers when the fork grows a headless backend. //! //! ```bash //! cargo test -p spreadsheet-ui --test ui -- --ignored --test-threads=1 //! ``` use makepad_widgets::makepad_test::{run_with_config, Selector, TestApp, TestConfig}; fn run_ui_test(test_name: &str, body: impl FnOnce(TestApp)) { let mut config = TestConfig::current_package( env!("CARGO_MANIFEST_DIR"), env!("CARGO_PKG_NAME"), format!("ui::{test_name}"), ) .expect("makepad test configuration"); // StudioHub launches the package through a child shell. Explicitly pass // the isolated Cargo path so the child can find the same toolchain as the // outer `cargo test` process. if let Ok(path) = std::env::var("PATH") { config.env.insert("PATH".into(), path.clone()); for directory in path.split(':') { let cargo = std::path::Path::new(directory).join("cargo"); if cargo.is_file() { config .env .insert("CARGO".into(), cargo.to_string_lossy().into_owned()); break; } } } for key in ["CARGO_HOME", "RUSTUP_HOME", "RUSTC"] { if let Ok(value) = std::env::var(key) { config.env.insert(key.into(), value); } } // The current Makepad Linux branch has an incomplete `MAKEPAD=headless` // cfg path. Let Linux compile its native backend; the Studio hub still // drives the app through the test protocol. config.env.remove("MAKEPAD"); run_with_config(config, body).expect("Makepad app failed to start or test failed"); } #[test] #[ignore = "needs a Makepad headless backend; see REVIEWS/PDF_PARITY_PHASE1_STATUS.md"] fn spreadsheet_workspace_smoke() { run_ui_test("spreadsheet_workspace_smoke", |app: TestApp| { app.locator(Selector::id("formula_input")).wait_visible(); app.locator(Selector::id("grid")).wait_visible(); app.locator(Selector::id("add_sheet_btn")).wait_visible(); }); } #[test] #[ignore = "needs a Makepad headless backend; see REVIEWS/PDF_PARITY_PHASE1_STATUS.md"] fn spreadsheet_workspace_can_add_sheet() { run_ui_test("spreadsheet_workspace_can_add_sheet", |app: TestApp| { app.locator(Selector::id("add_sheet_btn")) .wait_visible() .click(); app.locator(Selector::id("sheet_status")) .wait_text("Active Sheet: Sheet4 | AutoCalc On"); }); }