-
Notifications
You must be signed in to change notification settings - Fork 179
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 - Workbench Status Tests (#3726)
* 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 * Committing working test --------- Co-authored-by: Fede Alonso <[email protected]>
- Loading branch information
1 parent
d4b9a46
commit 2760f93
Showing
7 changed files
with
162 additions
and
3 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...d/src/__tests__/cypress/cypress/fixtures/e2e/dataScienceProjects/testWorkbenchStatus.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 @@ | ||
# testWorkbenchStatus.cy.ts Test Data # | ||
wbStatusTestNamespace: 'dsp-wb-status-test' | ||
wbStatusTestDescription: '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
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
102 changes: 102 additions & 0 deletions
102
...sts__/cypress/cypress/tests/e2e/dataScienceProjects/workbenches/testWorkbenchStatus.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,102 @@ | ||
import type { WBStatusTestData } from '~/__tests__/cypress/cypress/types'; | ||
import { projectDetails, projectListPage } from '~/__tests__/cypress/cypress/pages/projects'; | ||
import { | ||
workbenchPage, | ||
createSpawnerPage, | ||
workbenchStatusModal, | ||
} from '~/__tests__/cypress/cypress/pages/workbench'; | ||
import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers'; | ||
import { loadWBStatusFixture } 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('Workbenches - status tests', () => { | ||
let projectName: string; | ||
let projectDescription: string; | ||
|
||
// Setup: Load test data and ensure clean state | ||
before(() => { | ||
return loadWBStatusFixture('e2e/dataScienceProjects/testWorkbenchStatus.yaml') | ||
.then((fixtureData: WBStatusTestData) => { | ||
projectName = fixtureData.wbStatusTestNamespace; | ||
projectDescription = fixtureData.wbStatusTestDescription; | ||
|
||
if (!projectName) { | ||
throw new Error('Project name is undefined or empty in the loaded fixture'); | ||
} | ||
cy.log(`Loaded project name: ${projectName}`); | ||
return createCleanProject(projectName); | ||
}) | ||
.then(() => { | ||
cy.log(`Project ${projectName} confirmed to be created and verified successfully`); | ||
}); | ||
}); | ||
|
||
after(() => { | ||
// Delete provisioned Project | ||
if (projectName) { | ||
cy.log(`Deleting Project ${projectName} after the test has finished.`); | ||
deleteOpenShiftProject(projectName); | ||
} | ||
}); | ||
|
||
it( | ||
'Verify user can access progress and event log - validate status and successful workbench creation', | ||
{ tags: ['@Sanity', '@SanitySet2', '@ODS-1970', '@Dashboard'] }, | ||
() => { | ||
const workbenchName = projectName.replace('dsp-', ''); | ||
|
||
// Authentication and navigation | ||
cy.step('Log into the application'); | ||
cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER); | ||
|
||
// Project navigation and select workbenches | ||
cy.step(`Navigate to workbenches tab of Project ${projectName}`); | ||
projectListPage.navigate(); | ||
projectListPage.filterProjectByName(projectName); | ||
projectListPage.findProjectLink(projectName).click(); | ||
projectDetails.findSectionTab('workbenches').click(); | ||
|
||
// Create workbench | ||
cy.step(`Create workbench ${workbenchName}`); | ||
workbenchPage.findCreateButton().click(); | ||
createSpawnerPage.getNameInput().fill(workbenchName); | ||
createSpawnerPage.getDescriptionInput().type(projectDescription); | ||
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(projectDescription); | ||
notebookRow.expectStatusLabelToBe('Running', 120000); | ||
notebookRow.shouldHaveNotebookImageName('code-server'); | ||
notebookRow.shouldHaveContainerSize('Small'); | ||
|
||
// Click on 'Running' status and validate the Progress steps | ||
cy.step( | ||
'Click on Running status, validate the Running status and navigate to the Progress tab', | ||
); | ||
notebookRow.findHaveNotebookStatusText().click(); | ||
workbenchStatusModal.getNotebookStatus('Running'); | ||
|
||
cy.step('Verify that each Progress Step in the list displays with a Success icon'); | ||
workbenchStatusModal.findProgressTab().click(); | ||
workbenchStatusModal.findProgressTab().click(); | ||
workbenchStatusModal.findProgressSteps().each(($step) => { | ||
workbenchStatusModal.assertStepSuccess($step).then(() => { | ||
workbenchStatusModal.getStepTitle($step).then((stepTitle) => { | ||
cy.log(`✅ Step "${stepTitle}" is successful`); | ||
}); | ||
}); | ||
}); | ||
|
||
// Click on the Events log and validate that successful list messages display | ||
cy.step('Verify that each Events log in the list displays with a Successful Message'); | ||
workbenchStatusModal.findEventlogTab().click(); | ||
workbenchStatusModal.findLogEntry('Created container oauth-proxy'); | ||
workbenchStatusModal.findLogEntry('Started container oauth-proxy'); | ||
workbenchStatusModal.findLogEntry('Successfully pulled image'); | ||
}, | ||
); | ||
}); |
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