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

#234 - Added an automated Cypress test: configuring endpoint with IP and port number #246

Merged
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
10 changes: 10 additions & 0 deletions functional/cypress-tests/cypress/fixtures/credentialsEndpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ export const testEndpoint = timestamp => {
};
};

export const testEndpointByIp = timestamp => {
return {
label: `TE-${timestamp}`,
url: 'https://123.123.123.13:9082',
publicUrl: 'https://123.123.123.13:9082',
credentials: `TC-${timestamp}`,
id: `TE-${timestamp}`
};
};

export const testLbl = 'test';

export const editedLbl = 'EditedLabel';
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import {
testCredential,
testEndpoint,
testEndpointByIp,
testLbl,
editedLbl
} from '../fixtures/credentialsEndpoints';
Expand Down Expand Up @@ -102,7 +103,9 @@ describe('Credentials and endpoints', () => {

cy.get('[data-cy="endpoint-form-credentials-input"]').click();
cy.get('[role="listbox"]').within(() => {
cy.contains('li', `${testCredential(timestamp).label}`).click();
cy.contains('li', `${testCredential(timestamp).label}`)
.scrollIntoView()
.click();
});
cy.get('[data-cy="endpoint-form-submit-button"]').click();
cy.get('[data-cy="app-dialog-content"]').should(
Expand All @@ -111,10 +114,35 @@ describe('Credentials and endpoints', () => {
);
});

it('User can add new endpoint by IP and with port number. New endpoints label is visible', () => {
cy.get('[data-cy="add-endpoint-add-button"]').click();
cy.get('[data-cy="endpoint-form-label-input"]')
.type(testEndpointByIp(testLbl).label + '2')
.blur();

cy.get('[data-cy="endpoint-form-url-input"]')
.type(testEndpointByIp(testLbl).url)
.blur();

cy.get('[data-cy="endpoint-form-public-url-input"]')
.type(testEndpointByIp(testLbl).publicUrl)
.blur();

cy.get('[data-cy="endpoint-form-credentials-input"]').click();
cy.get('[role="listbox"]').within(() => {
cy.contains('li', `${testCredential(timestamp).label}`).click();
});
cy.get('[data-cy="endpoint-form-submit-button"]').click();
cy.get('[data-cy="app-dialog-content"]').should(
'contain',
testEndpointByIp(testLbl).label + '2'
);
});

it('User cannot add endpoints with existing label', () => {
cy.get('[data-cy="add-endpoint-add-button"]').click();
cy.get('[data-cy="endpoint-form-label-input"]')
.type(testEndpoint(timestamp).label)
.type(testEndpoint(testLbl).label)
.blur();
cy.get('[data-cy="endpoint-form-label-input-error"]')
.should('be.visible')
Expand Down Expand Up @@ -145,6 +173,22 @@ describe('Credentials and endpoints', () => {
'not.contain',
testEndpoint(timestamp).label
);
cy.contains('li.MuiListItem-container', testEndpoint(testLbl).label + '2')
.find('[data-cy="delete-endpoint-delete-button"]')
.click();
cy.get('[data-cy="confirmation-dialog-ok"]').click();
cy.get('[data-cy="app-dialog-content"]').should(
'not.contain',
testEndpoint(testLbl).label + '2'
);
cy.contains('li.MuiListItem-container', testEndpoint('EditedLabel').label)
.find('[data-cy="delete-endpoint-delete-button"]')
.click();
cy.get('[data-cy="confirmation-dialog-ok"]').click();
cy.get('[data-cy="app-dialog-content"]').should(
'not.contain',
testEndpoint('EditedLabel').label
);
});
});

Expand Down Expand Up @@ -240,6 +284,17 @@ describe('Credentials and endpoints', () => {
'not.contain',
testCredential(timestamp).label
);
cy.contains(
'li.MuiListItem-container',
testCredential('EditedLabel').label
)
.find('[data-cy="delete-credential-delete-button"]')
.click();
cy.get('[data-cy="confirmation-dialog-ok"]').click();
cy.get('[data-cy="app-dialog-content"]').should(
'not.contain',
testCredential('EditedLabel').label
);
});
});
});