From e0836a02f620d1f6e8fe9e930a561a9130b9bb22 Mon Sep 17 00:00:00 2001 From: Scott Lepper Date: Fri, 16 May 2025 12:33:13 -0400 Subject: [PATCH] Dashboards - E2E test - New layout - textbox variable (#105493) Dashboards - E2E - new layout - textbox variable --- .../dashboards-edit-variables.spec.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/e2e/dashboard-new-layouts/dashboards-edit-variables.spec.ts b/e2e/dashboard-new-layouts/dashboards-edit-variables.spec.ts index e6c9fb2609d..303f8143f95 100644 --- a/e2e/dashboard-new-layouts/dashboards-edit-variables.spec.ts +++ b/e2e/dashboard-new-layouts/dashboards-edit-variables.spec.ts @@ -67,4 +67,40 @@ describe('Dashboard edit - variables', () => { cy.get('.markdown-html').should('include.text', `VariableUnderTest: ${variable.value}`); }); }); + + it('can add a new textbox variable', () => { + e2e.pages.Dashboards.visit(); + + e2e.flows.openDashboard({ uid: `${PAGE_UNDER_TEST}?orgId=1` }); + cy.contains(DASHBOARD_NAME).should('be.visible'); + + const variable: Variable = { + type: 'textbox', + name: 'VariableUnderTest', + value: 'foo', + label: 'VariableUnderTest', + }; + + // common steps to add a new variable + flows.newEditPaneVariableClick(); + flows.newEditPanelCommonVariableInputs(variable); + + // set the textbox variable value + const type = 'variable-type Value'; + const field = e2e.components.PanelEditor.OptionsPane.fieldLabel(type); + field.should('be.visible'); + field.find('input').should('be.visible').clear().type(variable.value).blur(); + + // select the variable in the dashboard and confirm the variable value is set + e2e.pages.Dashboard.SubMenu.submenuItem().should('be.visible').click(); + e2e.pages.Dashboard.SubMenu.submenuItemLabels(variable.label).should('be.visible').contains(variable.label); + + // assert the panel is visible and has the correct value + e2e.components.Panels.Panel.content() + .should('be.visible') + .first() + .within(() => { + cy.get('.markdown-html').should('include.text', `VariableUnderTest: ${variable.value}`); + }); + }); });