diff --git a/cypress/e2e/live-tracking/property-detail-drawer.cy.js b/cypress/e2e/live-tracking/property-detail-drawer.cy.js new file mode 100644 index 00000000..4e379088 --- /dev/null +++ b/cypress/e2e/live-tracking/property-detail-drawer.cy.js @@ -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"); + }); + }); +});