From aee12b0b55db4fbab55e9b8cd929ec611eecb594 Mon Sep 17 00:00:00 2001 From: Miki Date: Wed, 24 Jan 2024 10:37:39 -0800 Subject: [PATCH] Add feature switch for the next home experience Signed-off-by: Miki --- cypress.json | 13 +++++++------ .../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, 20 insertions(+), 11 deletions(-) diff --git a/cypress.json b/cypress.json index 9de868129..79adb5404 100644 --- a/cypress.json +++ b/cypress.json @@ -2,7 +2,7 @@ "defaultCommandTimeout": 60000, "requestTimeout": 60000, "responseTimeout": 60000, - "baseUrl": "http://localhost:5601", + "baseUrl": "http://localhost", "reporter": "cypress-multi-reporters", "reporterOptions": { "configFile": "reporter-config.json" @@ -10,16 +10,17 @@ "viewportWidth": 2000, "viewportHeight": 1320, "env": { - "openSearchUrl": "http://localhost:9200", - "SECURITY_ENABLED": false, + "openSearchUrl": "https://miki-os.aka.corp.amazon.com:9200", + "SECURITY_ENABLED": true, "AGGREGATION_VIEW": false, - "username": "admin", - "password": "myStrongPassword123!", + "username": "miki", + "password": "baharema", "ENDPOINT_WITH_PROXY": false, "MANAGED_SERVICE_ENDPOINT": false, "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": true } } 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) );