Skip to content

Commit

Permalink
chore: refactored test ssl-smoketest.spec.js (#1878)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamayushdas authored May 17, 2021
1 parent 7f5d2da commit f1ce606
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions web/cypress/integration/ssl/ssl-smoketest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@
/* eslint-disable no-undef */

context('ssl smoke test', () => {
const selector = {
notificationMessage: '.ant-notification-notice-message',
notificationDesc: '.ant-notification-notice-description',
};

const data = {
deleteSSLSuccess: 'Remove target SSL successfully',
sslErrorAlert: "key and cert don't match",
};

beforeEach(() => {
cy.login();

cy.fixture('certificate.json').as('certificate');
cy.fixture('selector.json').as('domSelector');
cy.fixture('data.json').as('data');
});

it('should set match certificate and key by input', function () {
Expand All @@ -48,7 +55,7 @@ context('ssl smoke test', () => {
const sni = this.certificate.valid.sni;
cy.contains(sni).parents().contains('Delete').click();
cy.contains('button', 'Confirm').click();
cy.get(this.domSelector.notificationMessage).should('contain', this.data.deleteSSLSuccess);
cy.get(selector.notificationMessage).should('contain', data.deleteSSLSuccess);
});

it('should set unmatch certificate and key by input', function () {
Expand All @@ -63,6 +70,6 @@ context('ssl smoke test', () => {
cy.get('#key').type(invalidKey);

cy.contains('Next').click();
cy.get(this.domSelector.notificationDesc).should('contain', this.data.sslErrorAlert);
cy.get(selector.notificationDesc).should('contain', data.sslErrorAlert);
});
});

0 comments on commit f1ce606

Please sign in to comment.