Skip to content

Commit 72e960a

Browse files
authored
skip new home UI test if disabled (#1587)
Signed-off-by: Junqiu Lei <[email protected]>
1 parent fb85e41 commit 72e960a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@ import { CURRENT_TENANT } from '../../../utils/commands';
99

1010
const miscUtils = new MiscUtils(cy);
1111

12-
describe('Add flights dataset saved object', () => {
13-
before(() => {
12+
describe('Add flights dataset saved object', function () {
13+
before(function () {
1414
CURRENT_TENANT.newTenant = 'global';
1515
cy.deleteAllIndices();
1616
miscUtils.addSampleData();
1717
cy.wait(10000);
1818

19-
// Enable the new home UI
19+
// Enable the new home UI if possible
2020
cy.visit(`${BASE_PATH}/app/settings`);
2121
cy.get(
2222
'[data-test-subj="advancedSetting-editField-home:useNewHomePage"]'
2323
).then(($switch) => {
24-
if ($switch.attr('aria-checked') === 'false') {
24+
if ($switch.attr('disabled') === 'disabled') {
25+
cy.log('Switch is disabled and cannot be changed.');
26+
this.skip(); // Skip all tests in this suite
27+
} else if ($switch.attr('aria-checked') === 'false') {
2528
cy.wrap($switch).click();
2629
cy.get('[data-test-subj="advancedSetting-saveButton"]').click();
2730
cy.get('button.euiButton--primary.euiButton--small', {
@@ -35,12 +38,14 @@ describe('Add flights dataset saved object', () => {
3538

3639
after(() => {
3740
miscUtils.removeSampleData();
38-
// Disable the new home UI
41+
// Disable the new home UI if possible
3942
cy.visit(`${BASE_PATH}/app/settings`);
4043
cy.get(
4144
'[data-test-subj="advancedSetting-editField-home:useNewHomePage"]'
4245
).then(($switch) => {
43-
if ($switch.attr('aria-checked') === 'true') {
46+
if ($switch.attr('disabled') === 'disabled') {
47+
cy.log('Switch is disabled and cannot be changed.');
48+
} else if ($switch.attr('aria-checked') === 'true') {
4449
cy.wrap($switch).click();
4550
cy.get('[data-test-subj="advancedSetting-saveButton"]').click();
4651
cy.get('button.euiButton--primary.euiButton--small', {

0 commit comments

Comments
 (0)