From f1ce6064bf785d463fd210ab4c1b6d268b326cef Mon Sep 17 00:00:00 2001 From: Ayush das Date: Mon, 17 May 2021 07:09:05 +0530 Subject: [PATCH] chore: refactored test ssl-smoketest.spec.js (#1878) --- .../integration/ssl/ssl-smoketest.spec.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/web/cypress/integration/ssl/ssl-smoketest.spec.js b/web/cypress/integration/ssl/ssl-smoketest.spec.js index 1e35a804ce..b07bc34179 100644 --- a/web/cypress/integration/ssl/ssl-smoketest.spec.js +++ b/web/cypress/integration/ssl/ssl-smoketest.spec.js @@ -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 () { @@ -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 () { @@ -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); }); });