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

Fix: RHOAIENG-14370 Cypress test - Make it compatible with ODH #3524

Merged
merged 14 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 24 additions & 9 deletions frontend/src/__tests__/cypress/cypress/pages/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,27 @@ class NotebookRow extends TableRow {
}
}

class AttachExistingStorageModal extends Modal {
constructor() {
super('Attach Existing Storage');
}

selectExistingPersistentStorage(name: string) {
cy.findByTestId('persistent-storage-group')
.findByPlaceholderText('Select a persistent storage')
.click();
cy.findByTestId('persistent-storage-group').contains('button.pf-v5-c-menu__item', name).click();
}

findStandardPathInput() {
return cy.findByTestId('mount-path-folder-value');
}

findAttachButton() {
return cy.findByTestId('modal-submit-button');
}
}

class AttachConnectionModal extends Modal {
constructor() {
super('Attach existing connections');
Expand Down Expand Up @@ -263,15 +284,8 @@ class CreateSpawnerPage {
return cy.findByTestId('value-unit-select');
}

findExsistingPersistentStorageRadio() {
return cy.findByTestId('persistent-existing-storage-type-radio');
}

selectExistingPersistentStorage(name: string) {
cy.findByTestId('persistent-storage-group')
.findByRole('button', { name: 'Typeahead menu toggle' })
.click();
cy.get('[id="dashboard-page-main"]').contains('button.pf-v5-c-menu__item', name).click();
findAttachExistingStorageButton() {
return cy.findByTestId('existing-storage-button');
}

selectPVSize(name: string) {
Expand Down Expand Up @@ -451,3 +465,4 @@ export const editSpawnerPage = new EditSpawnerPage();
export const storageModal = new StorageModal();
export const notFoundSpawnerPage = new NotFoundSpawnerPage();
export const attachConnectionModal = new AttachConnectionModal();
export const attachExistingStorageModal = new AttachExistingStorageModal();
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { PVCReplacements } from '~/__tests__/cypress/cypress/types';
import { projectDetails, projectListPage } from '~/__tests__/cypress/cypress/pages/projects';
import { workbenchPage, createSpawnerPage } from '~/__tests__/cypress/cypress/pages/workbench';
import {
workbenchPage,
createSpawnerPage,
attachExistingStorageModal,
} from '~/__tests__/cypress/cypress/pages/workbench';
import { clusterStorage } from '~/__tests__/cypress/cypress/pages/clusterStorage';
import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers';
import { loadPVCFixture } from '~/__tests__/cypress/cypress/utils/dataLoader';
Expand Down Expand Up @@ -69,8 +73,10 @@ describe('Workbench and PVSs tests', () => {
workbenchPage.findCreateButton().click();
createSpawnerPage.getNameInput().fill(workbenchName);
createSpawnerPage.findNotebookImage('s2i-minimal-notebook').click();
createSpawnerPage.findExsistingPersistentStorageRadio().click();
createSpawnerPage.selectExistingPersistentStorage(PVCDisplayName);
createSpawnerPage.findAttachExistingStorageButton().click();
attachExistingStorageModal.selectExistingPersistentStorage(PVCDisplayName);
attachExistingStorageModal.findStandardPathInput().fill(workbenchName);
attachExistingStorageModal.findAttachButton().click();
createSpawnerPage.findSubmitButton().click();

cy.step(`Wait for Workbench ${workbenchName} to display a "Running" status`);
Expand All @@ -81,7 +87,9 @@ describe('Workbench and PVSs tests', () => {

cy.step(`Check the cluster storage ${PVCDisplayName} is now connected to ${workbenchName}`);
projectDetails.findSectionTab('cluster-storages').click();
const csRow = clusterStorage.getClusterStorageRow(PVCDisplayName);
// TODO: Bug RHOAIENG-16239
// const csRow = clusterStorage.getClusterStorageRow(PVCDisplayName);
const csRow = clusterStorage.getClusterStorageRow(PVCName);
csRow.findConnectedWorkbenches().should('have.text', workbenchName);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export const createPersistentVolumeClaim = (
yamlFilePath = 'resources/yaml/persistentVolumeClaim.yaml',
): Cypress.Chainable<CommandLineResult> => {
return cy.fixture(yamlFilePath).then((yamlContent) => {
cy.log(yamlContent);
const modifiedYamlContent = replacePlaceholdersInYaml(
yamlContent,
persistentVolumeClaimReplacements,
);
cy.log(modifiedYamlContent);
return applyOpenShiftYaml(modifiedYamlContent);
});
};
Loading