-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2898 from pnaik1/cypress-home
create page objects for cypress home page test
- Loading branch information
Showing
13 changed files
with
424 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { mockDashboardConfig } from '~/__mocks__'; | ||
import { HomeAdminSection } from './homeAdmin'; | ||
import { HomeAIFlow } from './homeAIFlow'; | ||
import { HomeProject } from './homeProject'; | ||
import { HomeResource } from './homeResource'; | ||
|
||
class HomePage { | ||
visit(wait = true) { | ||
cy.visitWithLogin('/'); | ||
if (wait) { | ||
this.wait(); | ||
} | ||
} | ||
|
||
private wait() { | ||
cy.findByTestId('home-page').should('be.visible'); | ||
cy.testA11y(); | ||
} | ||
|
||
findJupyterIcon() { | ||
return cy.findByTestId('jupyter-hint-icon'); | ||
} | ||
|
||
findHint() { | ||
return cy.findByTestId('home-page-hint'); | ||
} | ||
|
||
findHintText() { | ||
return cy.findByTestId('hint-body-text'); | ||
} | ||
|
||
findHintLink() { | ||
return cy.findByTestId('home-page-hint-navigate'); | ||
} | ||
|
||
findHintCloseButton() { | ||
return cy.findByTestId('home-page-hint-close'); | ||
} | ||
|
||
findAppPageTitle() { | ||
return cy.findByTestId('app-page-title'); | ||
} | ||
|
||
initHomeIntercepts(config: Parameters<typeof mockDashboardConfig>[0] = {}) { | ||
cy.interceptOdh('GET /api/config', mockDashboardConfig(config)); | ||
} | ||
|
||
getHomeAdminSection() { | ||
return new HomeAdminSection(() => cy.findByTestId('landing-page-admin')); | ||
} | ||
|
||
getHomeAISection() { | ||
return new HomeAIFlow(() => cy.findByTestId('home-page-ai-flows')); | ||
} | ||
|
||
getHomeProjectSection() { | ||
return new HomeProject(() => cy.findByTestId('landing-page-projects')); | ||
} | ||
|
||
getHomeResourceSection() { | ||
return new HomeResource(() => cy.findByTestId('landing-page-resources')); | ||
} | ||
|
||
returnToHome() { | ||
cy.go('back'); | ||
} | ||
} | ||
|
||
export const homePage = new HomePage(); |
81 changes: 81 additions & 0 deletions
81
frontend/src/__tests__/cypress/cypress/pages/home/homeAIFlow.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Contextual } from '~/__tests__/cypress/cypress/pages/components/Contextual'; | ||
|
||
class AIFlowCard extends Contextual<HTMLElement> {} | ||
|
||
export class HomeAIFlow extends Contextual<HTMLElement> { | ||
getProjectCard(): AIFlowCard { | ||
return new AIFlowCard(() => this.find().findByTestId('ai-flow-projects-card')); | ||
} | ||
|
||
getTrainFlowCard(): AIFlowCard { | ||
return new AIFlowCard(() => this.find().findByTestId('ai-flow-train-card')); | ||
} | ||
|
||
getModelsFlowCard(): AIFlowCard { | ||
return new AIFlowCard(() => this.find().findByTestId('ai-flow-models-card')); | ||
} | ||
|
||
findWorkbenchesAIFlowInfo(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-workbenches-info'); | ||
} | ||
|
||
findProjectsAIFlowInfo(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-projects-info'); | ||
} | ||
|
||
findConnectionsAIFlowInfo(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-connections-info'); | ||
} | ||
|
||
findStorageAIFlowInfo(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-storage-info'); | ||
} | ||
|
||
findPipelinesAIFlowInfo(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-pipelines-info'); | ||
} | ||
|
||
findRunsAIFlowInfo(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-runs-info'); | ||
} | ||
|
||
findModelServerAIFlowInfo(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-model-servers-info'); | ||
} | ||
|
||
findModelDeployAIFlowInfo(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-model-deploy-info'); | ||
} | ||
|
||
findAIFlowClose(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('ai-flows-close-info'); | ||
} | ||
|
||
findModelMeshDescriptionAdditionalText(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('project-workbenches--trailer-model-mesh'); | ||
} | ||
|
||
findNoModelMeshDescriptionAdditionalText(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('project-workbenches--trailer-no-model-mesh'); | ||
} | ||
|
||
findNoModelServingDescriptionAdditionalText(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('project-workbenches--trailer-no-model-serving'); | ||
} | ||
|
||
findNoPipelinesDescriptionAdditionalText(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('project-workbenches--trailer-no-pipelines'); | ||
} | ||
|
||
findPipelinesTrainDescriptionText(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId(`create-and-train-pipelines-trailer`); | ||
} | ||
|
||
findModelMeshEnabledText(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('project-workbenches--trailer-no-model-mesh'); | ||
} | ||
|
||
findModelMeshDisabledText(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('project-workbenches--trailer-no-model-serving'); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
frontend/src/__tests__/cypress/cypress/pages/home/homeAdmin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Contextual } from '~/__tests__/cypress/cypress/pages/components/Contextual'; | ||
|
||
export class HomeAdminSection extends Contextual<HTMLElement> { | ||
findNotebookImageCard(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('landing-page-admin--notebook-images'); | ||
} | ||
|
||
findNotebookImageButton(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('landing-page-admin--notebook-images-button'); | ||
} | ||
|
||
findServingRuntimeButton(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('landing-page-admin--serving-runtimes-button'); | ||
} | ||
|
||
findClusterSettingButton(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('landing-page-admin--cluster-settings-button'); | ||
} | ||
|
||
findUserManagementButton(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('landing-page-admin--user-management-button'); | ||
} | ||
|
||
findServingRuntimeCard(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('landing-page-admin--serving-runtimes'); | ||
} | ||
|
||
findClusterSettingCard(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('landing-page-admin--cluster-settings'); | ||
} | ||
|
||
findUserManagementCard(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return cy.findByTestId('landing-page-admin--user-management'); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
frontend/src/__tests__/cypress/cypress/pages/home/homeProject.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Contextual } from '~/__tests__/cypress/cypress/pages/components/Contextual'; | ||
|
||
export class HomeProject extends Contextual<HTMLElement> { | ||
findEmptyProjectCard(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('landing-page-projects-empty'); | ||
} | ||
|
||
findCreateProjectButton(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('create-project-button'); | ||
} | ||
|
||
findSectionHeaderCreateProjectButton(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('create-project'); | ||
} | ||
|
||
findCreateProjectCard(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('create-project-card'); | ||
} | ||
|
||
findProjectRequestIcon(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('request-project-help'); | ||
} | ||
|
||
findRequestProjectCard(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('request-project-card'); | ||
} | ||
|
||
findProjectLinkButton(projectName: string): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId(`project-link-${projectName}`); | ||
} | ||
|
||
findGoToProjectLink(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('goto-projects-link'); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
frontend/src/__tests__/cypress/cypress/pages/home/homeResource.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Contextual } from '~/__tests__/cypress/cypress/pages/components/Contextual'; | ||
|
||
export class HomeResource extends Contextual<HTMLElement> { | ||
findCard(name: string): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId(`resource-card-${name}`); | ||
} | ||
|
||
findGoToResourceLink(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.find().findByTestId('goto-resources-link'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.