From 6434e8f48d617506607afa7250c528709c8a8d79 Mon Sep 17 00:00:00 2001 From: Miki Date: Wed, 24 Jan 2024 11:18:23 -0800 Subject: [PATCH] Add switch to honor the next home experience feature (#1011) Signed-off-by: Miki --- cypress.json | 3 ++- cypress/integration/common/dashboard_sample_data_spec.js | 7 +++++-- .../opensearch-dashboards/apps/home/section.spec.js | 4 +++- .../dashboard_sample_data_with_datasource_spec.js | 7 +++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/cypress.json b/cypress.json index 9de868129..a5bf3eadd 100644 --- a/cypress.json +++ b/cypress.json @@ -20,6 +20,7 @@ "VISBUILDER_ENABLED": true, "DATASOURCE_MANAGEMENT_ENABLED": false, "ML_COMMONS_DASHBOARDS_ENABLED": true, - "WAIT_FOR_LOADER_BUFFER_MS": 0 + "WAIT_FOR_LOADER_BUFFER_MS": 0, + "NEXT_HOME_ENABLED": false } } diff --git a/cypress/integration/common/dashboard_sample_data_spec.js b/cypress/integration/common/dashboard_sample_data_spec.js index 666afa553..7e86536d4 100644 --- a/cypress/integration/common/dashboard_sample_data_spec.js +++ b/cypress/integration/common/dashboard_sample_data_spec.js @@ -8,6 +8,9 @@ import { MiscUtils, } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; +const nextHomeSuffix = Cypress.env('NEXT_HOME_ENABLED') ? '' : '/next-home'; +const legacyHomeSuffix = Cypress.env('NEXT_HOME_ENABLED') ? '/legacy-home' : ''; + /** * dashboard_sample_data test suite description: * 1) Visit the home page of opensearchdashboard, check key UI elements display @@ -29,7 +32,7 @@ export function dashboardSanityTests() { describe('checking home page', () => { before(() => { // Go to the home page - miscUtils.visitPage('app/home#'); + miscUtils.visitPage(`app/home#${nextHomeSuffix}`); cy.window().then((win) => win.localStorage.setItem('home:welcome:show', false) ); @@ -101,7 +104,7 @@ export function dashboardSanityTests() { describe('checking legacy home page', () => { before(() => { // Go to the home page - miscUtils.visitPage('app/home#/legacy'); + miscUtils.visitPage(`app/home#${legacyHomeSuffix}`); cy.window().then((win) => win.localStorage.setItem('home:welcome:show', false) ); diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/home/section.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/home/section.spec.js index 093da7d4c..a6743aa9c 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/home/section.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/home/section.spec.js @@ -7,10 +7,12 @@ import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-tes const miscUtils = new MiscUtils(cy); +const nextHomeSuffix = Cypress.env('NEXT_HOME_ENABLED') ? '' : '/next-home'; + describe('home sections', { scrollBehavior: false }, () => { before(() => { // Go to the home page - miscUtils.visitPage('app/home#'); + miscUtils.visitPage(`app/home#${nextHomeSuffix}`); }); it('should all appear expanded', function () { diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_sample_data_with_datasource_spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_sample_data_with_datasource_spec.js index 8e4ac9d4f..f847dbc53 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_sample_data_with_datasource_spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/dashboard_sample_data_with_datasource_spec.js @@ -14,6 +14,9 @@ const baseURL = new URL(Cypress.config().baseUrl); // remove trailing slash const path = baseURL.pathname.replace(/\/$/, ''); +const nextHomeSuffix = Cypress.env('NEXT_HOME_ENABLED') ? '' : '/next-home'; +const legacyHomeSuffix = Cypress.env('NEXT_HOME_ENABLED') ? '/legacy-home' : ''; + if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { describe('dashboard local cluster sample data validation', () => { before(() => {}); @@ -23,7 +26,7 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { describe('checking home page', () => { before(() => { // Go to the home page - miscUtils.visitPage('app/home#'); + miscUtils.visitPage(`app/home#${nextHomeSuffix}`); cy.window().then((win) => win.localStorage.setItem('home:welcome:show', false) ); @@ -48,7 +51,7 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { describe('checking legacy home page', () => { before(() => { // Go to the home page - miscUtils.visitPage('app/home#/legacy'); + miscUtils.visitPage(`app/home#${legacyHomeSuffix}`); cy.window().then((win) => win.localStorage.setItem('home:welcome:show', false) );