Skip to content

Commit

Permalink
[RHOAIENG-5497] Enable the landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-phillips-18 committed May 1, 2024
1 parent 95fb721 commit c0a45ba
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 98 deletions.
2 changes: 1 addition & 1 deletion backend/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const blankDashboardCR: DashboardConfig = {
disableISVBadges: false,
disableAppLauncher: false,
disableUserManagement: false,
disableHome: true,
disableHome: false,
disableProjects: false,
disableModelServing: false,
disableProjectSharing: false,
Expand Down
4 changes: 2 additions & 2 deletions docs/dashboard-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down Expand Up @@ -51,7 +51,7 @@ spec:
disableISVBadges: false
disableAppLauncher: false
disableUserManagement: false
disableHome: true
disableHome: false
disableProjects: false
disablePipelines: false
disableModelServing: false
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/__mocks__/mockDashboardConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const mockDashboardConfig = ({
disableISVBadges = false,
disableAppLauncher = false,
disableUserManagement = false,
disableHome = true,
disableHome = false,
disableProjects = false,
disableModelServing = false,
disableCustomServingRuntimes = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down
30 changes: 11 additions & 19 deletions frontend/src/__tests__/cypress/cypress/e2e/home/home.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');

Expand Down
61 changes: 11 additions & 50 deletions frontend/src/__tests__/cypress/cypress/e2e/home/homeAIFlows.cy.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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();
Expand All @@ -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();
Expand Down
15 changes: 7 additions & 8 deletions frontend/src/__tests__/cypress/cypress/e2e/home/homeAdmin.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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,
Expand All @@ -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();

Expand Down
20 changes: 10 additions & 10 deletions frontend/src/__tests__/cypress/cypress/e2e/home/homeProjects.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -43,15 +43,15 @@ 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();

cy.findByTestId('landing-page-projects-empty').should('be.visible');
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);
Expand All @@ -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();

Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Loading

0 comments on commit c0a45ba

Please sign in to comment.