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/delete a Data Connection #3686

Merged
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
61 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
bbaeb03
Initial commit of working test
antowaddle Jan 27, 2025
c46ad8c
Merge branch 'main' into cypress-RHOAIENG-17426
antowaddle Jan 27, 2025
c2391d1
Added testId and made some changes to test
antowaddle Jan 27, 2025
31b53bd
Merge branch 'main' into cypress-RHOAIENG-17426
antowaddle Jan 27, 2025
29746dd
committing testID update this time
antowaddle Jan 27, 2025
0e00c84
Merge branch 'main' into cypress-RHOAIENG-17426
antowaddle Jan 27, 2025
c7cedbc
Made changes to page objects, changed the test to reference correct o…
antowaddle Jan 28, 2025
9bd5b05
Merge branch 'main' into cypress-RHOAIENG-17426
antowaddle Jan 28, 2025
4284d5d
Review comment update
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,2 @@
# testDataConnectionCreation.cy.ts Test Data #
projectDCResourceName: "cypress-dc-test-project"
72 changes: 72 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/connections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TableRow } from './components/table';
import { Modal } from './components/Modal';

class ConnectionsPage {
findTable() {
Expand All @@ -11,9 +12,80 @@ class ConnectionsPage {
);
}

findDataConnectionName() {
return cy.findByTestId('table-row-title');
}

findAddConnectionButton() {
return cy.findByTestId('add-connection-button');
}

findCreateConnectionButton() {
return cy.findByTestId('create-connection-button');
}

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

findDeleteButton() {
return cy.contains('.pf-v6-c-menu__item-text', 'Delete');
}
}
class ConnectionModal extends Modal {
constructor(edit = false) {
super(`${edit ? 'Edit' : 'Add'} connection`);
}

findConnectionTypeDropdown() {
return this.find().findByTestId('connection-type-dropdown');
}

findS3CompatibleStorageOption() {
return cy.findByText('S3 compatible object storage - v1');
}

findSubmitButton() {
return this.findFooter().findByTestId('data-connection-submit-button');
}

findCreateButton() {
return this.find().findByTestId('modal-submit-button');
}

findConnectionNameInput() {
return this.find().findByTestId('connection-name-desc-name');
}

findConnectionDescriptionInput() {
return this.find().findByTestId('connection-name-desc-description');
}

findNameInput() {
return this.find().findByTestId('field Name');
}

findAwsKeyInput() {
return this.find().findByTestId('field AWS_ACCESS_KEY_ID');
}

findAwsSecretKeyInput() {
return this.find().findByTestId('field AWS_SECRET_ACCESS_KEY');
}

findEndpointInput() {
return this.find().findByTestId('field AWS_S3_ENDPOINT');
}

findRegionInput() {
return this.find().findByTestId('field AWS_DEFAULT_REGION');
}

findBucketInput() {
return this.find().findByTestId('field AWS_S3_BUCKET');
}
}

export const connectionsPage = new ConnectionsPage();
export const addConnectionModal = new ConnectionModal(false);
export const editConnectionModal = new ConnectionModal(true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { HTPASSWD_CLUSTER_ADMIN_USER } from '~/__tests__/cypress/cypress/utils/e2eUsers';
import { projectListPage, projectDetails } from '~/__tests__/cypress/cypress/pages/projects';
import { deleteOpenShiftProject } from '~/__tests__/cypress/cypress/utils/oc_commands/project';
import type { DataScienceProjectData, AWSS3BucketDetails } from '~/__tests__/cypress/cypress/types';
import { connectionsPage, addConnectionModal } from '~/__tests__/cypress/cypress/pages/connections';
import { loadDSPFixture } from '~/__tests__/cypress/cypress/utils/dataLoader';
import { createCleanProject } from '~/__tests__/cypress/cypress/utils/projectChecker';
import { deleteModal } from '~/__tests__/cypress/cypress/pages/components/DeleteModal';
import { AWS_BUCKETS } from '~/__tests__/cypress/cypress/utils/s3Buckets';

describe('Verify Data Connections - Creation and Deletion', () => {
let testData: DataScienceProjectData;
let projectName: string;
let s3Config: AWSS3BucketDetails;
let s3AccessKey: string;
let s3SecretKey: string;

// Setup: Load test data and ensure clean state
before(() => {
const bucketKey = 'BUCKET_1' as const;
const bucketConfig = AWS_BUCKETS[bucketKey];

s3Config = bucketConfig;
s3AccessKey = AWS_BUCKETS.AWS_ACCESS_KEY_ID;
s3SecretKey = AWS_BUCKETS.AWS_SECRET_ACCESS_KEY;

cy.log('S3 Configuration:');
cy.log(`Bucket Name: ${s3Config.NAME}`);
cy.log(`Bucket Region: ${s3Config.REGION}`);
cy.log(`Bucket Endpoint: ${s3Config.ENDPOINT}`);
cy.log(`Access Key ID: ${s3AccessKey.substring(0, 5)}...`);
cy.log(`Secret Access Key: ${s3SecretKey.substring(0, 5)}...`);

return loadDSPFixture('e2e/dataScienceProjects/testDataConnectionCreation.yaml')
.then((fixtureData: DataScienceProjectData) => {
testData = fixtureData;
projectName = testData.projectDCResourceName;
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 and Delete a Data Connection in RHOAI',
antowaddle marked this conversation as resolved.
Show resolved Hide resolved
{ tags: ['@Sanity', '@SanitySet1', '@ODS-1826', '@Dashboard', '@Tier1'] },
() => {
// Authentication and navigation
cy.step('Log into the application');
cy.visitWithLogin('/', HTPASSWD_CLUSTER_ADMIN_USER);

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

//Navigate to Data Connections and create Connection
cy.step('Navigate to Connections and click to create Connection');
projectDetails.findSectionTab('connections').click();
connectionsPage.findCreateConnectionButton().click();

// Enter validate Data Connection details into the Data Connection Modal
cy.step('Enter valid Data Connection details and verify creation');
addConnectionModal.findConnectionTypeDropdown().click();
addConnectionModal.findS3CompatibleStorageOption().click();
addConnectionModal.findConnectionNameInput().type(s3Config.NAME);
addConnectionModal.findConnectionDescriptionInput().type('S3 Bucket Connection');
addConnectionModal.findAwsKeyInput().type(s3AccessKey);
addConnectionModal.findAwsSecretKeyInput().type(s3SecretKey);
addConnectionModal.findEndpointInput().type(s3Config.ENDPOINT);
addConnectionModal.findRegionInput().type(s3Config.REGION);
addConnectionModal.findBucketInput().type(s3Config.NAME);
addConnectionModal.findCreateButton().click();
connectionsPage.getConnectionRow(s3Config.NAME).find().should('exist');

// Delete the Data Connection and confirm that the deletion was successful
cy.step('Delete the Data Connection and verify deletion');
connectionsPage.findKebabToggle().click();
connectionsPage.getConnectionRow(s3Config.NAME).findKebabAction('Delete').click();
deleteModal.shouldBeOpen();
deleteModal.findInput().type(s3Config.NAME);
deleteModal.findSubmitButton().should('be.enabled').click();
connectionsPage.findDataConnectionName().should('not.exist');
},
);
});
1 change: 1 addition & 0 deletions frontend/src/__tests__/cypress/cypress/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export type DataScienceProjectData = {
projectMultiModelAdminResourceName: string;
multiModelAdminName: string;
modelOpenVinoExamplePath: string;
projectDCResourceName: string;
};

export type NotebookImageData = {
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/concepts/connectionTypes/ConnectionTypeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ const ConnectionTypeForm: React.FC<Props> = ({

return (
<>
<FormGroup label="Connection type" fieldId="connection-type" isRequired>
<FormGroup
label="Connection type"
fieldId="connection-type"
data-testid="connection-type-dropdown"
isRequired
>
<TypeaheadSelect
id="connection-type"
selectOptions={selectOptions}
Expand Down
Loading