From 82109e6b7f566e42c8807eae00bf523d3fb6ee47 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:35:46 -0700 Subject: [PATCH] select checkbox via id instead of class name (#1503) (#1508) * select checkbox via id instead of class name Signed-off-by: Nishant Goel * Re trigger PR workflows Signed-off-by: Nishant Goel * Instead of sorting in asc order on aliases page, search the alias via text Signed-off-by: Nishant Goel --------- Signed-off-by: Nishant Goel (cherry picked from commit 77b4d191e18f08c420a1ff7b3705385240d484ca) Co-authored-by: Nishant Goel <113011736+nisgoel-amazon@users.noreply.github.com> --- .../aliases.js | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js b/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js index bb0b4cf41..72442ee0b 100644 --- a/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/aliases.js @@ -142,9 +142,9 @@ describe('Aliases', () => { describe('can flush an alias', () => { it('successfully flush an index', () => { - let sample_alias = `${SAMPLE_ALIAS_PREFIX}-${1}`; + let sample_alias = `${SAMPLE_ALIAS_PREFIX}-1`; // Sort all aliases in asc order to make it at first page - cy.contains('Alias name').click(); + cy.get('[placeholder="Search..."]').type(`${sample_alias}{enter}`); // Confirm we have our initial alias cy.contains(sample_alias); // index a test doc @@ -170,28 +170,20 @@ describe('Aliases', () => { expect(num).to.equal(1); }); - cy.get('[data-test-subj="moreAction"]').click(); - // Flush btn should be disabled if no items selected - cy.get('[data-test-subj="Flush Action"]').should( - 'have.class', - 'euiContextMenuItem-isDisabled' - ); - - // Select an alias - cy.get(`[data-test-subj="checkboxSelectRow-${sample_alias}"]`).check({ - force: true, - }); - - cy.get('[data-test-subj="moreAction"]').click(); - - // Extra wait required for page data to load, otherwise "Enable" button will be disabled - cy.wait(2000); + cy.get('[data-test-subj="moreAction"] button') + .click() + .get('[data-test-subj="Flush Action"]') + .should('be.disabled') + .end(); - // Flush btn should be enabled - cy.get('[data-test-subj="Flush Action"]') - .should('exist') - .should('not.have.class', 'euiContextMenuItem-isDisabled') - .click(); + cy.get(`#_selection_column_${sample_alias}-checkbox`) + .click() + .get('[data-test-subj="moreAction"] button') + .click() + .get('[data-test-subj="Flush Action"]') + .should('not.be.disabled') + .click() + .end(); // Check for flush index modal cy.contains('Flush alias');