From c0a45ba83e1eca61eceba2417014644e4682e7e9 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Date: Wed, 1 May 2024 08:17:39 -0400 Subject: [PATCH] [RHOAIENG-5497] Enable the landing page --- backend/src/utils/constants.ts | 2 +- docs/dashboard-config.md | 4 +- frontend/src/__mocks__/mockDashboardConfig.ts | 2 +- .../cypress/e2e/applications/enabled.cy.ts | 2 +- .../cypress/cypress/e2e/home/home.cy.ts | 30 ++++----- .../cypress/e2e/home/homeAIFlows.cy.ts | 61 ++++--------------- .../cypress/cypress/e2e/home/homeAdmin.cy.ts | 15 +++-- .../cypress/e2e/home/homeProjects.cy.ts | 20 +++--- .../cypress/e2e/home/homeResources.cy.ts | 6 +- .../cypress/cypress/pages/enabled.ts | 4 +- .../cypress/cypress/pages/modelRegistry.ts | 2 +- 11 files changed, 50 insertions(+), 98 deletions(-) diff --git a/backend/src/utils/constants.ts b/backend/src/utils/constants.ts index 4d39f675f1..b242b704c3 100644 --- a/backend/src/utils/constants.ts +++ b/backend/src/utils/constants.ts @@ -48,7 +48,7 @@ export const blankDashboardCR: DashboardConfig = { disableISVBadges: false, disableAppLauncher: false, disableUserManagement: false, - disableHome: true, + disableHome: false, disableProjects: false, disableModelServing: false, disableProjectSharing: false, diff --git a/docs/dashboard-config.md b/docs/dashboard-config.md index 7edd859781..14652e2920 100644 --- a/docs/dashboard-config.md +++ b/docs/dashboard-config.md @@ -19,7 +19,7 @@ The following are a list of features that are supported, along with there defaul | disableISVBadges | false | Removes the badge that indicate if a product is ISV or not. | | disableAppLauncher | false | Removes the application launcher that is used in OKD environments | | disableUserManagement | false | Removes the User Management panel in Settings. | -| disableHome | true | Disables Data Science Home page from the dashboard. | +| disableHome | false | Disables Data Science Home page from the dashboard. | | disableProjects | false | Disables Data Science Projects from the dashboard. | | disablePipelines | false | Disables Data Science Pipelines from the dashboard. | | disableModelServing | false | Disables Model Serving from the dashboard and from Data Science Projects. | @@ -51,7 +51,7 @@ spec: disableISVBadges: false disableAppLauncher: false disableUserManagement: false - disableHome: true + disableHome: false disableProjects: false disablePipelines: false disableModelServing: false diff --git a/frontend/src/__mocks__/mockDashboardConfig.ts b/frontend/src/__mocks__/mockDashboardConfig.ts index e66920a0e2..253cd48c05 100644 --- a/frontend/src/__mocks__/mockDashboardConfig.ts +++ b/frontend/src/__mocks__/mockDashboardConfig.ts @@ -35,7 +35,7 @@ export const mockDashboardConfig = ({ disableISVBadges = false, disableAppLauncher = false, disableUserManagement = false, - disableHome = true, + disableHome = false, disableProjects = false, disableModelServing = false, disableCustomServingRuntimes = false, diff --git a/frontend/src/__tests__/cypress/cypress/e2e/applications/enabled.cy.ts b/frontend/src/__tests__/cypress/cypress/e2e/applications/enabled.cy.ts index 20408c6cf8..7a6497dfd1 100644 --- a/frontend/src/__tests__/cypress/cypress/e2e/applications/enabled.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/e2e/applications/enabled.cy.ts @@ -49,7 +49,7 @@ describe('Enabled Page', () => { // Now validate with the home page feature flag enabled cy.interceptOdh('GET /api/config', mockDashboardConfig({ disableHome: false })); - enabledPage.visit(true); + enabledPage.visit(); jupyterCard.findApplicationLink().click(); cy.findByTestId('app-page-title').should('have.text', 'Start a notebook server'); }); diff --git a/frontend/src/__tests__/cypress/cypress/e2e/home/home.cy.ts b/frontend/src/__tests__/cypress/cypress/e2e/home/home.cy.ts index 9f6ed85662..b31f62d749 100644 --- a/frontend/src/__tests__/cypress/cypress/e2e/home/home.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/e2e/home/home.cy.ts @@ -3,24 +3,22 @@ import { mockComponents } from '~/__mocks__/mockComponents'; import { homePage } from '~/__tests__/cypress/cypress/pages/home'; describe('Home page', () => { - it('should not be shown by default', () => { + beforeEach(() => { + cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents()); homePage.initHomeIntercepts(); - - cy.visit('/'); - cy.findByTestId('app-page-title').should('have.text', 'Enabled'); }); - it('should be shown when enabled', () => { - homePage.initHomeIntercepts({ disableHome: false }); + it('should be shown by default', () => { homePage.visit(); // enabled applications page is still navigable - cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents()); - enabledPage.visit(true); + enabledPage.visit(); + }); + it('should be not shown when disabled', () => { + homePage.initHomeIntercepts({ disableHome: true }); + cy.visit('/'); + cy.findByTestId('app-page-title').should('have.text', 'Enabled'); }); it('should show the home page hint', () => { - homePage.initHomeIntercepts({ disableHome: false }); - cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents()); - homePage.visit(); cy.findByTestId('jupyter-hint-icon').should('be.visible'); @@ -32,24 +30,18 @@ describe('Home page', () => { cy.findByTestId('enabled-application').should('be.visible'); }); it('should hide the home page hint when the notebook controller is disabled.', () => { - homePage.initHomeIntercepts({ disableHome: false, disableNotebookController: true }); - cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents()); - + homePage.initHomeIntercepts({ disableNotebookController: true }); cy.visit('/'); cy.findByTestId('home-page-hint').should('not.exist'); }); it('should hide the home page hint when closed', () => { - homePage.initHomeIntercepts({ disableHome: false }); - cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents()); - homePage.visit(); - // enabled applications page is still navigable cy.findByTestId('home-page-hint-close').click(); - cy.findByTestId('home-page-hint').should('not.exist'); + // hint should not reappear when home page is navigated to cy.visit('/enabled'); cy.findByTestId('enabled-application').should('be.visible'); diff --git a/frontend/src/__tests__/cypress/cypress/e2e/home/homeAIFlows.cy.ts b/frontend/src/__tests__/cypress/cypress/e2e/home/homeAIFlows.cy.ts index 7e224dfc4e..8e39150eee 100644 --- a/frontend/src/__tests__/cypress/cypress/e2e/home/homeAIFlows.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/e2e/home/homeAIFlows.cy.ts @@ -1,18 +1,16 @@ import { homePage } from '~/__tests__/cypress/cypress/pages/home'; describe('Home page AI Flows', () => { - it('should show the appropriate AI flow cards', () => { - homePage.initHomeIntercepts({ disableHome: false }); + beforeEach(() => { + homePage.initHomeIntercepts(); homePage.visit(); - + }); + it('should show the appropriate AI flow cards', () => { cy.findByTestId('ai-flow-projects-card').should('be.visible'); cy.findByTestId('ai-flow-train-card').should('be.visible'); cy.findByTestId('ai-flow-models-card').should('be.visible'); }); it('should show the appropriate info cards', () => { - homePage.initHomeIntercepts({ disableHome: false }); - homePage.visit(); - homePage.getProjectsFlowCard().click(); cy.findByTestId('ai-flows-projects-info').should('be.visible'); cy.findByTestId('ai-flows-connections-info').should('be.visible'); @@ -28,9 +26,6 @@ describe('Home page AI Flows', () => { cy.findByTestId('ai-flows-model-deploy-info').should('be.visible'); }); it('should close the info cards on re-click', () => { - homePage.initHomeIntercepts({ disableHome: false }); - homePage.visit(); - homePage.getProjectsFlowCard().click(); cy.findByTestId('ai-flows-projects-info').should('be.visible'); cy.findByTestId('ai-flows-connections-info').should('be.visible'); @@ -42,9 +37,6 @@ describe('Home page AI Flows', () => { cy.findByTestId('ai-flows-storage-info').should('not.exist'); }); it('should close the info cards on close button click', () => { - homePage.initHomeIntercepts({ disableHome: false }); - homePage.visit(); - homePage.getProjectsFlowCard().click(); cy.findByTestId('ai-flows-projects-info').should('be.visible'); cy.findByTestId('ai-flows-connections-info').should('be.visible'); @@ -56,27 +48,18 @@ describe('Home page AI Flows', () => { cy.findByTestId('ai-flows-storage-info').should('not.exist'); }); it('should hide sections that are disabled', () => { - homePage.initHomeIntercepts({ - disableHome: false, - disableProjects: true, - }); + homePage.initHomeIntercepts({ disableProjects: true }); homePage.visit(); homePage.getProjectsFlowCard().should('not.exist'); - homePage.initHomeIntercepts({ - disableHome: false, - disableModelServing: true, - }); + homePage.initHomeIntercepts({ disableModelServing: true }); homePage.visit(); homePage.getModelsFlowCard().should('not.exist'); }); it('should hide info cards that are disabled', () => { - homePage.initHomeIntercepts({ - disableHome: false, - disablePipelines: true, - }); + homePage.initHomeIntercepts({ disablePipelines: true }); homePage.visit(); homePage.getTrainFlowCard().click(); @@ -86,51 +69,29 @@ describe('Home page AI Flows', () => { cy.findByTestId('ai-flows-runs-info').should('not.exist'); }); it('should render projects content specific to feature availability', () => { - homePage.initHomeIntercepts({ - disableHome: false, - }); - homePage.visit(); - homePage.getProjectsFlowCard().click(); cy.findByTestId('project-workbenches--trailer-model-mesh').scrollIntoView(); - homePage.initHomeIntercepts({ - disableHome: false, - disableModelMesh: true, - }); + homePage.initHomeIntercepts({ disableModelMesh: true }); homePage.visit(); homePage.getProjectsFlowCard().click(); cy.findByTestId('project-workbenches--trailer-no-model-mesh').scrollIntoView(); - homePage.initHomeIntercepts({ - disableHome: false, - disableModelServing: true, - }); + homePage.initHomeIntercepts({ disableModelServing: true }); homePage.visit(); homePage.getProjectsFlowCard().click(); cy.findByTestId('project-workbenches--trailer-no-model-serving').scrollIntoView(); - homePage.initHomeIntercepts({ - disableHome: false, - disablePipelines: true, - }); + homePage.initHomeIntercepts({ disablePipelines: true }); homePage.visit(); homePage.getProjectsFlowCard().click(); cy.findByTestId('project-workbenches--trailer-no-pipelines').scrollIntoView(); }); it('should render workbenches content specific to feature availability', () => { - homePage.initHomeIntercepts({ - disableHome: false, - }); - homePage.visit(); - homePage.getTrainFlowCard().click(); cy.findByTestId('create-and-train-pipelines-trailer').scrollIntoView(); - homePage.initHomeIntercepts({ - disableHome: false, - disablePipelines: true, - }); + homePage.initHomeIntercepts({ disablePipelines: true }); homePage.visit(); homePage.getTrainFlowCard().click(); cy.findByTestId('create-and-train-no-pipelines-trailer').scrollIntoView(); diff --git a/frontend/src/__tests__/cypress/cypress/e2e/home/homeAdmin.cy.ts b/frontend/src/__tests__/cypress/cypress/e2e/home/homeAdmin.cy.ts index 3ed4bc2b1a..3eb3fa9a49 100644 --- a/frontend/src/__tests__/cypress/cypress/e2e/home/homeAdmin.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/e2e/home/homeAdmin.cy.ts @@ -14,7 +14,7 @@ describe('Home page Admin section', () => { }); it('should show the admin section for admins', () => { asProductAdminUser(); - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); homePage.visit(); cy.findByTestId('landing-page-admin').scrollIntoView(); @@ -25,14 +25,14 @@ describe('Home page Admin section', () => { }); it('should hide the admin section for non-admin users', () => { asProjectEditUser(); - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); homePage.visit(); cy.findByTestId('landing-page-admin').should('not.exist'); }); it('should hide notebook images card when not available', () => { asProductAdminUser(); - homePage.initHomeIntercepts({ disableHome: false, disableBYONImageStream: true }); + homePage.initHomeIntercepts({ disableBYONImageStream: true }); homePage.visit(); cy.findByTestId('landing-page-admin').scrollIntoView(); @@ -43,7 +43,7 @@ describe('Home page Admin section', () => { }); it('should hide serving runtimes card when not available', () => { asProductAdminUser(); - homePage.initHomeIntercepts({ disableHome: false, disableCustomServingRuntimes: true }); + homePage.initHomeIntercepts({ disableCustomServingRuntimes: true }); homePage.visit(); cy.findByTestId('landing-page-admin').scrollIntoView(); @@ -54,7 +54,7 @@ describe('Home page Admin section', () => { }); it('should hide cluster settings card when not available', () => { asProductAdminUser(); - homePage.initHomeIntercepts({ disableHome: false, disableClusterManager: true }); + homePage.initHomeIntercepts({ disableClusterManager: true }); homePage.visit(); cy.findByTestId('landing-page-admin').scrollIntoView(); @@ -65,7 +65,7 @@ describe('Home page Admin section', () => { }); it('should hide user management card when not available', () => { asProductAdminUser(); - homePage.initHomeIntercepts({ disableHome: false, disableUserManagement: true }); + homePage.initHomeIntercepts({ disableUserManagement: true }); homePage.visit(); cy.findByTestId('landing-page-admin').scrollIntoView(); @@ -77,7 +77,6 @@ describe('Home page Admin section', () => { it('should hide the admin section if all cards are hidden', () => { asProductAdminUser(); homePage.initHomeIntercepts({ - disableHome: false, disableBYONImageStream: true, disableCustomServingRuntimes: true, disableClusterManager: true, @@ -91,7 +90,7 @@ describe('Home page Admin section', () => { }); it('should navigate to the correct section when the title is clicked', () => { asProductAdminUser(); - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); customServingRuntimesIntercept(); homePage.visit(); diff --git a/frontend/src/__tests__/cypress/cypress/e2e/home/homeProjects.cy.ts b/frontend/src/__tests__/cypress/cypress/e2e/home/homeProjects.cy.ts index d765a940a0..4c41c61c0a 100644 --- a/frontend/src/__tests__/cypress/cypress/e2e/home/homeProjects.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/e2e/home/homeProjects.cy.ts @@ -21,19 +21,19 @@ const interceptAccessReview = (allowed: boolean) => { describe('Home page Projects section', () => { it('should hide the projects section when disabled', () => { - homePage.initHomeIntercepts({ disableHome: false, disableProjects: true }); + homePage.initHomeIntercepts({ disableProjects: true }); homePage.visit(); cy.findByTestId('landing-page-projects').should('not.exist'); }); it('should show the empty state w/ create button when privileged', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); homePage.visit(); cy.findByTestId('landing-page-projects-empty').should('be.visible'); }); it('should show allow project creation from the empty state when privileged', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); homePage.visit(); cy.findByTestId('landing-page-projects-empty').should('be.visible'); @@ -43,7 +43,7 @@ describe('Home page Projects section', () => { createProjectModal.shouldBeOpen(false); }); it('should show not allow project creation from the empty state when not privileged', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); interceptAccessReview(false); homePage.visit(); @@ -51,7 +51,7 @@ describe('Home page Projects section', () => { cy.findByTestId('create-project-button').should('not.exist'); }); it('should show create project button when more projects exist', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); const projectsMock = mockProjectsK8sList(); cy.interceptK8sList(ProjectModel, projectsMock); @@ -62,7 +62,7 @@ describe('Home page Projects section', () => { cy.findByTestId('create-project-card').should('not.exist'); }); it('should not show create project button when more projects exist but user is not allowed', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); interceptAccessReview(false); const projectsMock = mockProjectsK8sList(); @@ -76,7 +76,7 @@ describe('Home page Projects section', () => { cy.findByTestId('request-project-card').should('not.exist'); }); it('should show create project card when no more projects exist', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); const projectsMock = mockProjectsK8sList(); const projects = projectsMock.items; projectsMock.items = projects.slice(0, 2); @@ -89,7 +89,7 @@ describe('Home page Projects section', () => { cy.findByTestId('create-project-card').should('be.visible'); }); it('should show a request project card when no more projects exist but user is not allowed', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); interceptAccessReview(false); const projectsMock = mockProjectsK8sList(); const projects = projectsMock.items; @@ -105,7 +105,7 @@ describe('Home page Projects section', () => { cy.findByTestId('request-project-help').should('not.exist'); }); it('should navigate to the project when the name is clicked', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); interceptAccessReview(false); const projectsMock = mockProjectsK8sList(); const projects = projectsMock.items; @@ -120,7 +120,7 @@ describe('Home page Projects section', () => { projectDetails.findComponent('overview').should('be.visible'); }); it('should navigate to the project list', () => { - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); interceptAccessReview(false); const projectsMock = mockProjectsK8sList(); const projects = projectsMock.items; diff --git a/frontend/src/__tests__/cypress/cypress/e2e/home/homeResources.cy.ts b/frontend/src/__tests__/cypress/cypress/e2e/home/homeResources.cy.ts index 8a0211244e..8832d6b001 100644 --- a/frontend/src/__tests__/cypress/cypress/e2e/home/homeResources.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/e2e/home/homeResources.cy.ts @@ -8,7 +8,7 @@ describe('Home page Resources section', () => { cy.interceptOdh('GET /api/docs', mockDocs()); cy.interceptOdh('GET /api/components', null, mockComponents()); cy.interceptOdh('GET /api/quickstarts', mockQuickStarts()); - homePage.initHomeIntercepts({ disableHome: false }); + homePage.initHomeIntercepts(); homePage.visit(); }); it('should show the resources section', () => { @@ -16,14 +16,14 @@ describe('Home page Resources section', () => { cy.findByTestId('resource-card-create-jupyter-notebook').should('be.visible'); }); it('should hide the the resource section if none are available', () => { + cy.interceptOdh('GET /api/docs', []); + cy.interceptOdh('GET /api/components', null, []); cy.interceptOdh('GET /api/quickstarts', []); homePage.visit(); cy.findByTestId('landing-page-resources').should('not.exist'); }); it('should navigate to the resources page', () => { - homePage.visit(); - cy.findByTestId('goto-resources-link').scrollIntoView(); cy.findByTestId('goto-resources-link').click(); cy.findByTestId('app-page-title').should('have.text', 'Resources'); diff --git a/frontend/src/__tests__/cypress/cypress/pages/enabled.ts b/frontend/src/__tests__/cypress/cypress/pages/enabled.ts index a8750a8c4e..6d8051778d 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/enabled.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/enabled.ts @@ -1,6 +1,6 @@ class EnabledPage { - visit(homeEnabled = false) { - cy.visit(homeEnabled ? '/enabled' : '/'); + visit() { + cy.visit('/enabled'); this.wait(); } diff --git a/frontend/src/__tests__/cypress/cypress/pages/modelRegistry.ts b/frontend/src/__tests__/cypress/cypress/pages/modelRegistry.ts index f0ace5cf88..e1acc59930 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/modelRegistry.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/modelRegistry.ts @@ -70,7 +70,7 @@ class ModelRegistry { } private waitLanding() { - cy.findByTestId('enabled-application').should('be.visible'); + cy.findByTestId('home-page').should('be.visible'); } shouldBeEmpty() {