From 8df86503193f1d23452fefe84206977dae720c1f Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:46:56 -0400 Subject: [PATCH] skip new home UI test if disabled (#1587) (#1589) Signed-off-by: Junqiu Lei (cherry picked from commit 72e960aa09fce06c44584401483ccda65d3db791) Co-authored-by: Junqiu Lei --- .../7_enable_new_home_ui.spec.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js b/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js index ec1d1d5ff..75015bbdd 100644 --- a/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js +++ b/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js @@ -9,19 +9,22 @@ import { CURRENT_TENANT } from '../../../utils/commands'; const miscUtils = new MiscUtils(cy); -describe('Add flights dataset saved object', () => { - before(() => { +describe('Add flights dataset saved object', function () { + before(function () { CURRENT_TENANT.newTenant = 'global'; cy.deleteAllIndices(); miscUtils.addSampleData(); cy.wait(10000); - // Enable the new home UI + // Enable the new home UI if possible cy.visit(`${BASE_PATH}/app/settings`); cy.get( '[data-test-subj="advancedSetting-editField-home:useNewHomePage"]' ).then(($switch) => { - if ($switch.attr('aria-checked') === 'false') { + if ($switch.attr('disabled') === 'disabled') { + cy.log('Switch is disabled and cannot be changed.'); + this.skip(); // Skip all tests in this suite + } else if ($switch.attr('aria-checked') === 'false') { cy.wrap($switch).click(); cy.get('[data-test-subj="advancedSetting-saveButton"]').click(); cy.get('button.euiButton--primary.euiButton--small', { @@ -35,12 +38,14 @@ describe('Add flights dataset saved object', () => { after(() => { miscUtils.removeSampleData(); - // Disable the new home UI + // Disable the new home UI if possible cy.visit(`${BASE_PATH}/app/settings`); cy.get( '[data-test-subj="advancedSetting-editField-home:useNewHomePage"]' ).then(($switch) => { - if ($switch.attr('aria-checked') === 'true') { + if ($switch.attr('disabled') === 'disabled') { + cy.log('Switch is disabled and cannot be changed.'); + } else if ($switch.attr('aria-checked') === 'true') { cy.wrap($switch).click(); cy.get('[data-test-subj="advancedSetting-saveButton"]').click(); cy.get('button.euiButton--primary.euiButton--small', {