Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress e2e Test - Verifies users can create, edit and delete a Persistent Volume #3689

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
cacbfe5
Initial WIP version of resource creation test
antowaddle Nov 20, 2024
0fa2201
Experimental changes to poll the UI for updates
antowaddle Nov 21, 2024
af87ad1
Working version if resource is present
antowaddle Nov 21, 2024
0e9868a
increase card timeout and delete active wait
FedeAlonso Nov 21, 2024
429f086
Merge pull request #1 from FedeAlonso/fix/active_wait
antowaddle Nov 21, 2024
443e530
Added changes to find namespace from variables
antowaddle Nov 22, 2024
966917f
Final changes to read variables, cleaned up utils
antowaddle Nov 22, 2024
69db944
Merge branch 'main' into cypress-RHOAIENG-14368
antowaddle Nov 22, 2024
a9ecfa3
Small change to a comment
antowaddle Nov 22, 2024
6cd6a3e
Dummy change to trigger mocks
antowaddle Nov 22, 2024
fcc6d18
Merge branch 'opendatahub-io:main' into main
antowaddle Nov 22, 2024
c7d471a
Merge branch 'main' into cypress-RHOAIENG-14368
antowaddle Nov 22, 2024
7628316
Save changes on cypress-RHOAIENG-12649
antowaddle Nov 25, 2024
847ad11
Changed file directories and names as requested on a PR comment
antowaddle Nov 25, 2024
552a516
Merge branch 'main' into cypress-RHOAIENG-14368
antowaddle Nov 25, 2024
80cc894
Merge branch 'cypress-RHOAIENG-14368' of https://github.com/antowaddl…
antowaddle Nov 25, 2024
163ed94
Merge remote-tracking branch 'origin/main' into cypress-RHOAIENG-12649
antowaddle Nov 25, 2024
0f7eead
Saving changes to current branch
antowaddle Nov 25, 2024
48c7435
Additional directory/file name changes
antowaddle Nov 25, 2024
14a39de
Additional changes to save
antowaddle Nov 25, 2024
6a93ec2
Resolving timeout issue breaking mock tests, also resolved latest PR …
antowaddle Nov 25, 2024
31b9723
Further changes for this test
antowaddle Nov 25, 2024
f2b636d
Changes to revert the exist method appended to getCardView.
antowaddle Nov 25, 2024
a9feb1b
Fixed linting
antowaddle Nov 25, 2024
aa9430e
Linting fixes
antowaddle Nov 25, 2024
eddd7d8
Merge branch 'main' into cypress-RHOAIENG-12649Merge branch 'main' of…
antowaddle Nov 25, 2024
680a0ee
Final comments added
antowaddle Nov 25, 2024
b6bc5b3
Merge branch 'main' into cypress-RHOAIENG-12649
antowaddle Nov 26, 2024
781e952
Fixed merge conflict
antowaddle Nov 26, 2024
b05b676
Small change to page object name
antowaddle Nov 26, 2024
3681244
dummy commit
antowaddle Nov 26, 2024
fb11cc5
Removed RHOAI bug workaround
antowaddle Nov 26, 2024
e0b9cca
Removed comments
antowaddle Nov 26, 2024
06167d8
Last comment change
antowaddle Nov 26, 2024
ae51479
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Dec 9, 2024
dac0574
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Dec 10, 2024
2cd1f7e
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Dec 11, 2024
645dca1
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Dec 13, 2024
f044a29
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Dec 16, 2024
7aa9059
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Dec 16, 2024
ff28a5d
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Dec 18, 2024
bca2ef3
Merge branch 'main' of https://github.com/antowaddle/odh-dashboard
antowaddle Dec 18, 2024
45dd834
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Dec 31, 2024
bd20cdd
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 2, 2025
d7afb9d
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 6, 2025
290d114
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 7, 2025
60d6e41
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 9, 2025
a87272f
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 10, 2025
cf25d91
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 20, 2025
b92780d
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 22, 2025
2036e59
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 22, 2025
69edb21
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 23, 2025
cebd375
Merge branch 'main' of github.com:opendatahub-io/odh-dashboard
antowaddle Jan 28, 2025
6f62a94
Committing completed test
antowaddle Jan 28, 2025
1cec691
Merge branch 'main' into cypress-RHOAIENG-17427
antowaddle Jan 28, 2025
2535e00
Edited requested on pr - added backend check for PVC size, also added…
antowaddle Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# testClusterStorageCreation.cy.ts Test Data #
projectPVStorageResourceName: "cy-pv-storage-test"
pvStorageName: "cy-pv-storage"
pvStorageDescription: "Test Description of PV Storage"
pvStorageNameEdited: "cy-pv-storage-edited"
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class ClusterStorageModal extends Modal {
return this.find().findByTestId('modal-submit-button');
}

findPVStorageSizeValue() {
return this.find().find('[aria-label="Input"]');
}

private findPVSizeSelectButton() {
return this.find().findByTestId('value-unit-select');
}
Expand Down Expand Up @@ -234,6 +238,10 @@ class ClusterStorage {
findCreateButtonFromActions() {
return cy.findByTestId('actions-cluster-storage-button');
}

findKebabToggle() {
return cy.get('button[aria-label="Kebab toggle"]');
}
}

export const clusterStorage = new ClusterStorage();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import type { DataScienceProjectData, DashboardConfig } from '~/__tests__/cypress/cypress/types';
import { projectDetails, projectListPage } from '~/__tests__/cypress/cypress/pages/projects';
import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers';
import { loadDSPFixture } from '~/__tests__/cypress/cypress/utils/dataLoader';
import { createCleanProject } from '~/__tests__/cypress/cypress/utils/projectChecker';
import { deleteOpenShiftProject } from '~/__tests__/cypress/cypress/utils/oc_commands/project';
import {
clusterStorage,
addClusterStorageModal,
updateClusterStorageModal,
} from '~/__tests__/cypress/cypress/pages/clusterStorage';
import { deleteModal } from '~/__tests__/cypress/cypress/pages/components/DeleteModal';

describe('Verify Cluster Storage - Creating, Editing and Deleting', () => {
let testData: DataScienceProjectData;
let dashboardConfig: DashboardConfig;
let projectName: string;
let pvStorageName: string;
let pvStorageDescription: string;
let pvStorageNameEdited: string;

// Setup: Load test data and ensure clean state
before(() => {
// Retrieve the dashboard configuration
cy.getDashboardConfig().then((config) => {
dashboardConfig = config as DashboardConfig;
cy.log('Dashboard Config:', JSON.stringify(dashboardConfig, null, 2));
const { pvcSize } = dashboardConfig.notebookController;
cy.log(`Value of PVC Size: ${String(pvcSize)}`);
});
return loadDSPFixture('e2e/dataScienceProjects/testClusterStorageCreation.yaml')
.then((fixtureData: DataScienceProjectData) => {
testData = fixtureData;
projectName = testData.projectPVStorageResourceName;
pvStorageName = testData.pvStorageName;
pvStorageDescription = testData.pvStorageDescription;
pvStorageNameEdited = testData.pvStorageNameEdited;
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(
'Create, Edit and Delete a Persistent Volume Storage',
{ tags: ['@Sanity', '@SanitySet1', '@ODS-1824', '@Dashboard'] },
() => {
// Authentication and navigation
cy.step('Log into the application');
cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER);

// Project navigation and navigate to the Cluster Storage tab
cy.step(
`Navigate to the Project list tab and search for ${testData.projectPVStorageResourceName}`,
);
projectListPage.navigate();
projectListPage.filterProjectByName(testData.projectPVStorageResourceName);
projectListPage.findProjectLink(testData.projectPVStorageResourceName).click();

//Navigate to Cluster Storage and click to Add Storage
cy.step('Navigate to Cluster Storage and click to create Cluster Storage');
projectDetails.findSectionTab('cluster-storages').click();
clusterStorage.findCreateButton().click();

// Enter validate Cluster Storage details into the Cluster Storage Modal
cy.step('Enter valid Cluster Storage details and verify creation');
addClusterStorageModal.findNameInput().type(pvStorageName);
addClusterStorageModal.findDescriptionInput().type(pvStorageDescription);
antowaddle marked this conversation as resolved.
Show resolved Hide resolved
const numericPvcSize = dashboardConfig.notebookController.pvcSize.replace(/\D/g, '');
addClusterStorageModal.findPVStorageSizeValue().should('have.value', numericPvcSize);
addClusterStorageModal.findSubmitButton().click();
clusterStorage.getClusterStorageRow(pvStorageName);

// Edit the Cluster Storage, amend the name and update
cy.step('Edit the Cluster Storage and verify edits are successful');
clusterStorage.findKebabToggle().click();
clusterStorage.getClusterStorageRow(pvStorageName).findKebabAction('Edit storage').click();
updateClusterStorageModal.findNameInput().clear();
updateClusterStorageModal.findNameInput().type(pvStorageNameEdited);
updateClusterStorageModal.findSubmitButton().click();
clusterStorage.getClusterStorageRow(pvStorageNameEdited);

// Delete the Cluster Storage and confirm that the deletion was successful
cy.step('Delete the Cluster Storage and verify deletion');
clusterStorage.findKebabToggle().click();
clusterStorage.getClusterStorageRow(pvStorageName).findKebabAction('Delete storage').click();
deleteModal.shouldBeOpen();
deleteModal.findInput().type(pvStorageName);
deleteModal.findSubmitButton().should('be.enabled').click();
clusterStorage.findEmptyState().should('exist');
},
);
});
4 changes: 4 additions & 0 deletions frontend/src/__tests__/cypress/cypress/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ export type DataScienceProjectData = {
multiModelAdminName: string;
modelOpenVinoExamplePath: string;
projectDCResourceName: string;
projectPVStorageResourceName: string;
pvStorageName: string;
pvStorageDescription: string;
pvStorageNameEdited: string;
};

export type NotebookImageData = {
Expand Down
Loading