Skip to content

Commit

Permalink
Add switch to honor the next home experience feature (#1011)
Browse files Browse the repository at this point in the history
Signed-off-by: Miki <[email protected]>
  • Loading branch information
AMoo-Miki authored Jan 24, 2024
1 parent ad62d3e commit 6434e8f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
7 changes: 5 additions & 2 deletions cypress/integration/common/dashboard_sample_data_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
);
Expand Down Expand Up @@ -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)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {});
Expand All @@ -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)
);
Expand All @@ -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)
);
Expand Down

0 comments on commit 6434e8f

Please sign in to comment.