Skip to content

Commit

Permalink
[RHOAIENG-6321] Home Page Microcopy Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-phillips-18 committed Apr 30, 2024
1 parent 3aa9f3b commit 5d57671
Show file tree
Hide file tree
Showing 14 changed files with 344 additions and 139 deletions.
23 changes: 10 additions & 13 deletions frontend/src/__tests__/cypress/cypress/e2e/home/home.cy.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import { enabledPage } from '~/__tests__/cypress/cypress/pages/enabled';
import { initHomeIntercepts } from '~/__tests__/cypress/cypress/e2e/home/homeUtils';
import { mockComponents } from '~/__mocks__/mockComponents';
import { homePage } from '~/__tests__/cypress/cypress/pages/home';

describe('Home page', () => {
it('should not be shown by default', () => {
initHomeIntercepts();
homePage.initHomeIntercepts();

cy.visit('/');
cy.findByTestId('app-page-title').should('have.text', 'Enabled');
});
it('should be shown when enabled', () => {
initHomeIntercepts({ disableHome: false });
cy.visit('/');
cy.findByTestId('home-page').should('be.visible');
homePage.initHomeIntercepts({ disableHome: false });
homePage.visit();

// enabled applications page is still navigable
cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents());
enabledPage.visit(true);
});
it('should show the home page hint', () => {
initHomeIntercepts({ disableHome: false });
homePage.initHomeIntercepts({ disableHome: false });
cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents());

cy.visit('/');
cy.findByTestId('home-page-hint').should('be.visible');
homePage.visit();

cy.findByTestId('jupyter-hint-icon').should('be.visible');
cy.findByTestId('hint-body-text').should('contain', 'Jupyter');
Expand All @@ -34,19 +32,18 @@ describe('Home page', () => {
cy.findByTestId('enabled-application').should('be.visible');
});
it('should hide the home page hint when the notebook controller is disabled.', () => {
initHomeIntercepts({ disableHome: false, disableNotebookController: true });
homePage.initHomeIntercepts({ disableHome: false, disableNotebookController: true });
cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents());

cy.visit('/');

cy.findByTestId('home-page-hint').should('not.exist');
});
it('should hide the home page hint when closed', () => {
initHomeIntercepts({ disableHome: false });
homePage.initHomeIntercepts({ disableHome: false });
cy.interceptOdh('GET /api/components', { query: { installed: 'true' } }, mockComponents());

cy.visit('/');
cy.findByTestId('home-page-hint').should('be.visible');
homePage.visit();

// enabled applications page is still navigable
cy.findByTestId('home-page-hint-close').click();
Expand All @@ -56,7 +53,7 @@ describe('Home page', () => {
cy.visit('/enabled');
cy.findByTestId('enabled-application').should('be.visible');

cy.visit('/');
homePage.visit();
cy.findByTestId('home-page-hint').should('not.exist');
});
});
104 changes: 76 additions & 28 deletions frontend/src/__tests__/cypress/cypress/e2e/home/homeAIFlows.cy.ts
Original file line number Diff line number Diff line change
@@ -1,90 +1,138 @@
import { initHomeIntercepts } from '~/__tests__/cypress/cypress/e2e/home/homeUtils';
import { homePage } from '~/__tests__/cypress/cypress/pages/home';

describe('Home page AI Flows', () => {
it('should show the appropriate AI flow cards', () => {
initHomeIntercepts({ disableHome: false });
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false });
homePage.visit();

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', () => {
initHomeIntercepts({ disableHome: false });
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false });
homePage.visit();

cy.findByTestId('ai-flow-projects-card').click();
homePage.getProjectsFlowCard().click();
cy.findByTestId('ai-flows-projects-info').should('be.visible');
cy.findByTestId('ai-flows-connections-info').should('be.visible');
cy.findByTestId('ai-flows-storage-info').should('be.visible');

cy.findByTestId('ai-flow-train-card').click();
homePage.getTrainFlowCard().click();
cy.findByTestId('ai-flows-workbenches-info').should('be.visible');
cy.findByTestId('ai-flows-pipelines-info').should('be.visible');
cy.findByTestId('ai-flows-runs-info').should('be.visible');

cy.findByTestId('ai-flow-models-card').click();
homePage.getModelsFlowCard().click();
cy.findByTestId('ai-flows-model-servers-info').should('be.visible');
cy.findByTestId('ai-flows-model-deploy-info').should('be.visible');
});
it('should close the info cards on re-click', () => {
initHomeIntercepts({ disableHome: false });
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false });
homePage.visit();

cy.findByTestId('ai-flow-projects-card').click();
homePage.getProjectsFlowCard().click();
cy.findByTestId('ai-flows-projects-info').should('be.visible');
cy.findByTestId('ai-flows-connections-info').should('be.visible');
cy.findByTestId('ai-flows-storage-info').should('be.visible');

cy.findByTestId('ai-flow-projects-card').click();
homePage.getProjectsFlowCard().click();
cy.findByTestId('ai-flows-projects-info').should('not.exist');
cy.findByTestId('ai-flows-connections-info').should('not.exist');
cy.findByTestId('ai-flows-storage-info').should('not.exist');
});
it('should close the info cards on close button click', () => {
initHomeIntercepts({ disableHome: false });
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false });
homePage.visit();

cy.findByTestId('ai-flow-projects-card').click();
homePage.getProjectsFlowCard().click();
cy.findByTestId('ai-flows-projects-info').should('be.visible');
cy.findByTestId('ai-flows-connections-info').should('be.visible');
cy.findByTestId('ai-flows-storage-info').should('be.visible');

cy.findByTestId('ai-flows-close-info').click();
homePage.clickAIFlowClose();
cy.findByTestId('ai-flows-projects-info').should('not.exist');
cy.findByTestId('ai-flows-connections-info').should('not.exist');
cy.findByTestId('ai-flows-storage-info').should('not.exist');
});
it('should hide sections that are disabled', () => {
initHomeIntercepts({
homePage.initHomeIntercepts({
disableHome: false,
disableProjects: true,
});
cy.visit('/');
cy.findByTestId('home-page').should('be.visible');
homePage.visit();

cy.findByTestId('ai-flow-projects-card').should('not.exist');
homePage.getProjectsFlowCard().should('not.exist');

initHomeIntercepts({
homePage.initHomeIntercepts({
disableHome: false,
disableModelServing: true,
});
cy.visit('/');
cy.findByTestId('home-page').should('be.visible');
cy.findByTestId('ai-flow-models-card').should('not.exist');
homePage.visit();

homePage.getModelsFlowCard().should('not.exist');
});
it('should hide info cards that are disabled', () => {
initHomeIntercepts({
homePage.initHomeIntercepts({
disableHome: false,
disablePipelines: true,
});
cy.visit('/');
cy.findByTestId('home-page').should('be.visible');
homePage.visit();

cy.findByTestId('ai-flow-train-card').click();
homePage.getTrainFlowCard().click();

cy.findByTestId('ai-flows-workbenches-info').should('be.visible');
cy.findByTestId('ai-flows-pipelines-info').should('not.exist');
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.visit();
homePage.getProjectsFlowCard().click();
cy.findByTestId('project-workbenches--trailer-no-model-mesh').scrollIntoView();

homePage.initHomeIntercepts({
disableHome: false,
disableModelServing: true,
});
homePage.visit();
homePage.getProjectsFlowCard().click();
cy.findByTestId('project-workbenches--trailer-no-model-serving').scrollIntoView();

homePage.initHomeIntercepts({
disableHome: false,
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.visit();
homePage.getTrainFlowCard().click();
cy.findByTestId('create-and-train-no-pipelines-trailer').scrollIntoView();
});
});
41 changes: 20 additions & 21 deletions frontend/src/__tests__/cypress/cypress/e2e/home/homeAdmin.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { initHomeIntercepts } from '~/__tests__/cypress/cypress/e2e/home/homeUtils';
import { mockDocs } from '~/__mocks__/mockDocs';
import { mockComponents } from '~/__mocks__/mockComponents';
import { mockQuickStarts } from '~/__mocks__/mockQuickStarts';
import { customServingRuntimesIntercept } from '~/__tests__/cypress/cypress/e2e/customServingRuntimes/customServingRuntimesUtils';
import { notebookImageSettings } from '~/__tests__/cypress/cypress/pages/notebookImageSettings';
import { asProductAdminUser, asProjectEditUser } from '~/__tests__/cypress/cypress/utils/users';
import { homePage } from '~/__tests__/cypress/cypress/pages/home';

describe('Home page Admin section', () => {
beforeEach(() => {
Expand All @@ -14,9 +14,8 @@ describe('Home page Admin section', () => {
});
it('should show the admin section for admins', () => {
asProductAdminUser();
initHomeIntercepts({ disableHome: false });

cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false });
homePage.visit();

cy.findByTestId('landing-page-admin').scrollIntoView();
cy.findByTestId('landing-page-admin--notebook-images').should('be.visible');
Expand All @@ -25,16 +24,16 @@ describe('Home page Admin section', () => {
cy.findByTestId('landing-page-admin--user-management').should('be.visible');
});
it('should hide the admin section for non-admin users', () => {
initHomeIntercepts({ disableHome: false });
asProjectEditUser();
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false });
homePage.visit();

cy.findByTestId('landing-page-admin').should('not.exist');
});
it('should hide notebook images card when not available', () => {
asProductAdminUser();
initHomeIntercepts({ disableHome: false, disableBYONImageStream: true });
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false, disableBYONImageStream: true });
homePage.visit();

cy.findByTestId('landing-page-admin').scrollIntoView();
cy.findByTestId('landing-page-admin--notebook-images').should('not.exist');
Expand All @@ -44,8 +43,8 @@ describe('Home page Admin section', () => {
});
it('should hide serving runtimes card when not available', () => {
asProductAdminUser();
initHomeIntercepts({ disableHome: false, disableCustomServingRuntimes: true });
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false, disableCustomServingRuntimes: true });
homePage.visit();

cy.findByTestId('landing-page-admin').scrollIntoView();
cy.findByTestId('landing-page-admin--notebook-images').should('be.visible');
Expand All @@ -55,8 +54,8 @@ describe('Home page Admin section', () => {
});
it('should hide cluster settings card when not available', () => {
asProductAdminUser();
initHomeIntercepts({ disableHome: false, disableClusterManager: true });
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false, disableClusterManager: true });
homePage.visit();

cy.findByTestId('landing-page-admin').scrollIntoView();
cy.findByTestId('landing-page-admin--notebook-images').should('be.visible');
Expand All @@ -66,8 +65,8 @@ describe('Home page Admin section', () => {
});
it('should hide user management card when not available', () => {
asProductAdminUser();
initHomeIntercepts({ disableHome: false, disableUserManagement: true });
cy.visit('/');
homePage.initHomeIntercepts({ disableHome: false, disableUserManagement: true });
homePage.visit();

cy.findByTestId('landing-page-admin').scrollIntoView();
cy.findByTestId('landing-page-admin--notebook-images').should('be.visible');
Expand All @@ -77,24 +76,24 @@ describe('Home page Admin section', () => {
});
it('should hide the admin section if all cards are hidden', () => {
asProductAdminUser();
initHomeIntercepts({
homePage.initHomeIntercepts({
disableHome: false,
disableBYONImageStream: true,
disableCustomServingRuntimes: true,
disableClusterManager: true,
disableUserManagement: true,
});

cy.visit('/');
homePage.visit();

cy.get('#dashboard-page-main').find('[class="pf-v5-c-drawer__content"]').scrollTo('bottom');
cy.findByTestId('landing-page-admin').should('not.exist');
});
it('should navigate to the correct section when the title is clicked', () => {
asProductAdminUser();
initHomeIntercepts({ disableHome: false });
homePage.initHomeIntercepts({ disableHome: false });
customServingRuntimesIntercept();
cy.visit('/');
homePage.visit();

cy.findByTestId('landing-page-admin').scrollIntoView();

Expand All @@ -104,15 +103,15 @@ describe('Home page Admin section', () => {
// Verify the Settings nav menu is now expanded
notebookImageSettings.findNavItem().should('be.visible');

cy.visit('/');
homePage.visit();
cy.findByTestId('landing-page-admin--serving-runtimes-button').click();
cy.findByTestId('app-page-title').should('have.text', 'Serving runtimes');

cy.visit('/');
homePage.visit();
cy.findByTestId('landing-page-admin--cluster-settings-button').click();
cy.findByTestId('app-page-title').should('have.text', 'Cluster settings');

cy.visit('/');
homePage.visit();
cy.findByTestId('landing-page-admin--user-management-button').click();
cy.findByTestId('app-page-title').should('have.text', 'User management');
});
Expand Down
Loading

0 comments on commit 5d57671

Please sign in to comment.