From ad6cd5530108f35f976e5300003b32ef38ffc76f Mon Sep 17 00:00:00 2001 From: oscarkilhed Date: Fri, 13 Sep 2024 16:06:18 +0200 Subject: [PATCH] update tests to include Selected (x) in variable multi select boxes --- .../load-options-from-url.spec.ts | 28 ++++++++++++++----- .../new-query-variable.spec.ts | 5 +++- .../set-options-from-ui.spec.ts | 14 +++++++--- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/e2e/scenes/dashboards-suite/load-options-from-url.spec.ts b/e2e/scenes/dashboards-suite/load-options-from-url.spec.ts index 04740c74e24..d674ae2a385 100644 --- a/e2e/scenes/dashboards-suite/load-options-from-url.spec.ts +++ b/e2e/scenes/dashboards-suite/load-options-from-url.spec.ts @@ -22,7 +22,9 @@ describe('Variables - Load options from Url', () => { cy.get('input').click(); }); - e2e.components.Select.option().parent().should('have.length', 9); + e2e.components.Select.option().parent().should('have.length', 10); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible'); @@ -37,7 +39,9 @@ describe('Variables - Load options from Url', () => { cy.get('input').click(); }); - e2e.components.Select.option().parent().should('have.length', 9); + e2e.components.Select.option().parent().should('have.length', 10); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AA').should('be.visible'); @@ -52,7 +56,9 @@ describe('Variables - Load options from Url', () => { cy.get('input').click(); }); - e2e.components.Select.option().parent().should('have.length', 9); + e2e.components.Select.option().parent().should('have.length', 10); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AAA').should('be.visible'); @@ -75,7 +81,9 @@ describe('Variables - Load options from Url', () => { cy.get('input').click(); }); - e2e.components.Select.option().parent().should('have.length', 9); + e2e.components.Select.option().parent().should('have.length', 10); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible'); @@ -90,7 +98,9 @@ describe('Variables - Load options from Url', () => { cy.get('input').click(); }); - e2e.components.Select.option().parent().should('have.length', 9); + e2e.components.Select.option().parent().should('have.length', 10); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BA').should('be.visible'); @@ -105,7 +115,9 @@ describe('Variables - Load options from Url', () => { cy.get('input').click(); }); - e2e.components.Select.option().parent().should('have.length', 9); + e2e.components.Select.option().parent().should('have.length', 10); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBA').should('be.visible'); @@ -139,7 +151,9 @@ describe('Variables - Load options from Url', () => { cy.get('input').click(); }); - e2e.components.Select.option().parent().should('have.length', 9); + e2e.components.Select.option().parent().should('have.length', 10); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible'); diff --git a/e2e/scenes/dashboards-suite/new-query-variable.spec.ts b/e2e/scenes/dashboards-suite/new-query-variable.spec.ts index 6f63d2ac46e..d6ead2937c4 100644 --- a/e2e/scenes/dashboards-suite/new-query-variable.spec.ts +++ b/e2e/scenes/dashboards-suite/new-query-variable.spec.ts @@ -175,7 +175,10 @@ describe('Variables - Query - Add variable', () => { cy.get('input').click(); }); - e2e.components.Select.option().should('have.length', 2); + e2e.components.Select.option().should('have.length', 3); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); + e2e.components.Select.option().contains('All'); e2e.components.Select.option().contains('C'); }); diff --git a/e2e/scenes/dashboards-suite/set-options-from-ui.spec.ts b/e2e/scenes/dashboards-suite/set-options-from-ui.spec.ts index 7903488314a..bdcc5c6b516 100644 --- a/e2e/scenes/dashboards-suite/set-options-from-ui.spec.ts +++ b/e2e/scenes/dashboards-suite/set-options-from-ui.spec.ts @@ -19,6 +19,7 @@ describe('Variables - Set options from ui', () => { }); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('A').should('be.visible').click(); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('B').should('be.visible').click(); + cy.get('body').click(); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts('B').scrollIntoView().should('be.visible'); @@ -31,7 +32,9 @@ describe('Variables - Set options from ui', () => { cy.get('input').click(); }); - e2e.components.Select.option().parent().should('have.length', 9); + e2e.components.Select.option().parent().should('have.length', 10); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (1)'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BA').should('be.visible'); @@ -72,6 +75,9 @@ describe('Variables - Set options from ui', () => { cy.get('input').click(); }); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('B').should('be.visible').click(); + + e2e.components.Select.toggleAllOptions().should('have.text', 'Selected (2)'); + cy.get('body').click(); cy.wait('@query'); @@ -102,7 +108,7 @@ describe('Variables - Set options from ui', () => { cy.get('input').click(); }); - e2e.components.Select.option().should('have.length', 9); + e2e.components.Select.option().should('have.length', 10); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('AAA').should('be.visible'); @@ -142,7 +148,7 @@ describe('Variables - Set options from ui', () => { cy.get('input').click(); }); - e2e.components.Select.option().should('have.length', 9); + e2e.components.Select.option().should('have.length', 10); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('All').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BA').should('be.visible'); @@ -156,7 +162,7 @@ describe('Variables - Set options from ui', () => { .within(() => { cy.get('input').click(); }); - e2e.components.Select.option().should('have.length', 9); + e2e.components.Select.option().should('have.length', 10); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBA').should('be.visible'); e2e.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts('BBB').should('be.visible');