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 1fa1d8741a..20408c6cf8 100644 --- a/frontend/src/__tests__/cypress/cypress/e2e/applications/enabled.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/e2e/applications/enabled.cy.ts @@ -1,6 +1,9 @@ +import { RoleBindingSubject } from '~/types'; import { mockComponents } from '~/__mocks__/mockComponents'; import { enabledPage } from '~/__tests__/cypress/cypress/pages/enabled'; import { jupyterCard } from '~/__tests__/cypress/cypress/pages/components/JupyterCard'; +import { mockDashboardConfig, mockK8sResourceList } from '~/__mocks__'; +import { mockRoleBindingK8sResource } from '~/__mocks__/mockRoleBindingK8sResource'; describe('Enabled Page', () => { beforeEach(() => { @@ -20,4 +23,34 @@ describe('Enabled Page', () => { 'A multi-user version of the notebook designed for companies, classrooms and research labs.', ); }); + it('should navigate to the notebook controller spawner page', () => { + const groupSubjects: RoleBindingSubject[] = [ + { + kind: 'Group', + apiGroup: 'rbac.authorization.k8s.io', + name: 'group-1', + }, + ]; + cy.interceptOdh( + 'GET /api/rolebindings/opendatahub/openshift-ai-notebooks-image-pullers', + mockK8sResourceList([ + mockRoleBindingK8sResource({ + name: 'group-1', + subjects: groupSubjects, + roleRefName: 'edit', + }), + ]), + ); + + enabledPage.visit(); + jupyterCard.findApplicationLink().click(); + cy.findByTestId('app-page-title').should('have.text', 'Start a notebook server'); + + // Now validate with the home page feature flag enabled + cy.interceptOdh('GET /api/config', mockDashboardConfig({ disableHome: false })); + + enabledPage.visit(true); + jupyterCard.findApplicationLink().click(); + cy.findByTestId('app-page-title').should('have.text', 'Start a notebook server'); + }); }); diff --git a/frontend/src/__tests__/cypress/cypress/pages/components/Card.ts b/frontend/src/__tests__/cypress/cypress/pages/components/Card.ts index a6f776658a..96197f4340 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/components/Card.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/components/Card.ts @@ -33,6 +33,10 @@ export class Card { return this.find().findByTestId('cardbody'); } + findApplicationLink(): Cypress.Chainable> { + return this.find().findByTestId('jupyter-app-link'); + } + findExploreCard(metadataName: string): Cypress.Chainable> { return cy.findByTestId(['card', metadataName]); } diff --git a/frontend/src/components/OdhAppCard.tsx b/frontend/src/components/OdhAppCard.tsx index cbd863e826..83bf28c4d6 100644 --- a/frontend/src/components/OdhAppCard.tsx +++ b/frontend/src/components/OdhAppCard.tsx @@ -105,7 +105,11 @@ const OdhAppCard: React.FC = ({ odhApp }) => { {odhApp.metadata.name === 'jupyter' ? ( odhApp.spec.internalRoute ? ( - + Launch application ) : null