-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cypress e2e Test - Verifies users can start, stop, launch and delete …
…a running workbench from project details page (#3637) * Initial WIP version of resource creation test * Experimental changes to poll the UI for updates * Working version if resource is present * increase card timeout and delete active wait * Added changes to find namespace from variables * Final changes to read variables, cleaned up utils * Small change to a comment * Dummy change to trigger mocks * Save changes on cypress-RHOAIENG-12649 * Changed file directories and names as requested on a PR comment * Saving changes to current branch * Additional directory/file name changes * Additional changes to save * Resolving timeout issue breaking mock tests, also resolved latest PR comments * Further changes for this test * Changes to revert the exist method appended to getCardView. * Fixed linting * Linting fixes * Final comments added * Fixed merge conflict * Small change to page object name * dummy commit * Removed RHOAI bug workaround * Removed comments * Last comment change * Initial commit * WIP Test * Committing running test --------- Co-authored-by: Fede Alonso <fealonso@redhat.com>
- Loading branch information
1 parent
ebc2c66
commit 95d2b64
Showing
5 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...__tests__/cypress/cypress/fixtures/e2e/dataScienceProjects/testWorkbenchControlSuite.yaml
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,3 @@ | ||
# testWorkbenchControlSuite.cy.ts Test Data # | ||
controlSuiteTestNamespace: 'dsp-wb-controls-test' | ||
controlSuiteTestDescription: 'This is a test description.' |
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
99 changes: 99 additions & 0 deletions
99
...cypress/cypress/tests/e2e/dataScienceProjects/workbenches/testWorkbenchControlSuite.cy.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,99 @@ | ||
import type { WBControlSuiteTestData } from '~/__tests__/cypress/cypress/types'; | ||
import { projectDetails, projectListPage } from '~/__tests__/cypress/cypress/pages/projects'; | ||
import { | ||
workbenchPage, | ||
createSpawnerPage, | ||
notebookConfirmModal, | ||
notebookDeleteModal, | ||
} from '~/__tests__/cypress/cypress/pages/workbench'; | ||
import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; | ||
import { loadWBControlSuiteFixture } from '~/__tests__/cypress/cypress/utils/dataLoader'; | ||
import { createCleanProject } from '~/__tests__/cypress/cypress/utils/projectChecker'; | ||
import { deleteOpenShiftProject } from '~/__tests__/cypress/cypress/utils/oc_commands/project'; | ||
|
||
describe('Start, Stop, Launch and Delete a Workbench in RHOAI', () => { | ||
let controlSuiteTestNamespace: string; | ||
let controlSuiteTestDescription: string; | ||
|
||
// Setup: Load test data and ensure clean state | ||
before(() => { | ||
return loadWBControlSuiteFixture('e2e/dataScienceProjects/testWorkbenchControlSuite.yaml') | ||
.then((fixtureData: WBControlSuiteTestData) => { | ||
controlSuiteTestNamespace = fixtureData.controlSuiteTestNamespace; | ||
controlSuiteTestDescription = fixtureData.controlSuiteTestDescription; | ||
|
||
if (!controlSuiteTestNamespace) { | ||
throw new Error('Project name is undefined or empty in the loaded fixture'); | ||
} | ||
cy.log(`Loaded project name: ${controlSuiteTestNamespace}`); | ||
return createCleanProject(controlSuiteTestNamespace); | ||
}) | ||
.then(() => { | ||
cy.log( | ||
`Project ${controlSuiteTestNamespace} confirmed to be created and verified successfully`, | ||
); | ||
}); | ||
}); | ||
after(() => { | ||
// Delete provisioned Project | ||
if (controlSuiteTestNamespace) { | ||
cy.log(`Deleting Project ${controlSuiteTestNamespace} after the test has finished.`); | ||
deleteOpenShiftProject(controlSuiteTestNamespace); | ||
} | ||
}); | ||
|
||
it( | ||
'Starting, Stopping, Launching and Deleting a Workbench', | ||
{ tags: ['@Sanity', '@SanitySet1', '@ODS-1818', '@ODS-1823', '@Dashboard'] }, | ||
() => { | ||
const workbenchName = controlSuiteTestNamespace.replace('dsp-', ''); | ||
|
||
// Authentication and navigation | ||
cy.step('Log into the application'); | ||
cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); | ||
|
||
// Project navigation and select workbences | ||
cy.step(`Navigate to workbenches tab of Project ${controlSuiteTestNamespace}`); | ||
projectListPage.navigate(); | ||
projectListPage.filterProjectByName(controlSuiteTestNamespace); | ||
projectListPage.findProjectLink(controlSuiteTestNamespace).click(); | ||
projectDetails.findSectionTab('workbenches').click(); | ||
|
||
// Create workbench | ||
cy.step(`Create workbench ${controlSuiteTestNamespace}`); | ||
workbenchPage.findCreateButton().click(); | ||
createSpawnerPage.getNameInput().fill(workbenchName); | ||
createSpawnerPage.getDescriptionInput().type(controlSuiteTestDescription); | ||
createSpawnerPage.findNotebookImage('code-server-notebook').click(); | ||
createSpawnerPage.findSubmitButton().click(); | ||
|
||
// Wait for workbench to run | ||
cy.step(`Wait for workbench ${workbenchName} to display a "Running" status`); | ||
const notebookRow = workbenchPage.getNotebookRow(workbenchName); | ||
notebookRow.findNotebookDescription(controlSuiteTestDescription); | ||
notebookRow.expectStatusLabelToBe('Running', 120000); | ||
notebookRow.shouldHaveNotebookImageName('code-server'); | ||
notebookRow.shouldHaveContainerSize('Small'); | ||
|
||
// Stop workbench | ||
cy.step('Stop workbench and validate it has been stopped'); | ||
notebookRow.findNotebookStop().click(); | ||
notebookConfirmModal.findStopWorkbenchButton().click(); | ||
notebookRow.expectStatusLabelToBe('Stopped', 120000); | ||
|
||
// Restart workbench and confirm initiation | ||
cy.step('Restart workbench and validate it starts successfully'); | ||
notebookRow.findNotebookStart().click(); | ||
notebookRow.expectStatusLabelToBe('Running', 120000); | ||
|
||
// Delete workbench | ||
cy.step('Delete workbench and confirm deleteion'); | ||
notebookRow.findKebab().click(); | ||
notebookRow.findKebabAction('Delete workbench').click(); | ||
notebookDeleteModal.findDeleteModal().click(); | ||
notebookDeleteModal.findDeleteModal().type(workbenchName); | ||
notebookDeleteModal.findDeleteWorkbenchButton().click(); | ||
workbenchPage.findEmptyState().should('exist'); | ||
}, | ||
); | ||
}); |
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