add cypress spec for measures row drawer flow

This commit is contained in:
Khalim Conn-Kowlessar 2026-05-05 12:10:14 +00:00
parent 0fe8dd0ac9
commit f6aaa89c5b

View file

@ -0,0 +1,55 @@
/**
* Live Tracking Property Detail Drawer (issue #251)
*
* Verifies the row-click flow on the Measures tab: clicking a row in the
* MeasuresTable opens the PropertyDetailDrawer and all six stage-ordered
* sections are visible in the body.
*
* The spec assumes an authenticated session can be reused (or skipped) the
* same way the rest of the suite handles it. Because live tracking is a
* portfolio-scoped page, the test reads the target portfolio slug from the
* `LIVE_PORTFOLIO_SLUG` Cypress env var so it can run against any seeded
* environment without hard-coding an ID.
*/
const PORTFOLIO_SLUG = Cypress.env("LIVE_PORTFOLIO_SLUG");
const EXPECTED_SECTIONS = [
"survey",
"measures",
"pibi",
"domna",
"halted",
"technical",
];
describe("Property detail drawer — measures row click", function () {
before(function () {
if (!PORTFOLIO_SLUG) {
// Skip the suite entirely when the env var is absent. The spec still
// compiles so CI pipelines that lint Cypress files stay green.
cy.log(
"LIVE_PORTFOLIO_SLUG env var not set — skipping live tracking specs",
);
this.skip();
}
});
it("opens the drawer focused on Measures and shows all six sections", () => {
cy.visit(`/portfolio/${PORTFOLIO_SLUG}/your-projects/live`);
// Switch to the Measures tab.
cy.contains("button, [role=tab]", "Measures").click();
// Click the first measures row.
cy.get("[data-testid=measures-row]").first().click();
// Drawer is open.
cy.get("[data-testid=property-detail-drawer]").should("be.visible");
// All six sections rendered inside the drawer.
EXPECTED_SECTIONS.forEach((section) => {
cy.get(`[data-testid=drawer-section-${section}]`).should("exist");
});
});
});