-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MHV-62502] VA.gov Secure Messaging | Silent failure: No send on bad …
…attachments (#33155) * [MHV-62502] Update attachment scan failure alert content * cleanup * update alert text * [MHV-62502] Fix, only allow one malicious alert to display on reply form screen * add reply with virus attachment scenarios * [MHV-62502] Improved code, handled alert display in action sendReply --------- Co-authored-by: fazilqa <[email protected]>
- Loading branch information
Showing
8 changed files
with
140 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
...cure-messaging/tests/e2e/secure-messaging-attachment-virus-alert-on-reply.cypress.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import SecureMessagingSite from './sm_site/SecureMessagingSite'; | ||
import PatientInboxPage from './pages/PatientInboxPage'; | ||
import PatientReplyPage from './pages/PatientReplyPage'; | ||
import GeneralFunctionsPage from './pages/GeneralFunctionsPage'; | ||
import PatientMessageDetailsPage from './pages/PatientMessageDetailsPage'; | ||
import { Alerts, AXE_CONTEXT, Data, Locators, Paths } from './utils/constants'; | ||
import singleThreadResponse from './fixtures/thread-response-new-api.json'; | ||
import PatientInterstitialPage from './pages/PatientInterstitialPage'; | ||
import PatientComposePage from './pages/PatientComposePage'; | ||
|
||
describe('SM ATTACHMENT WITH VIRUS ON REPLY', () => { | ||
const updatedSingleThreadResponse = GeneralFunctionsPage.updatedThreadDates( | ||
singleThreadResponse, | ||
); | ||
beforeEach(() => { | ||
SecureMessagingSite.login(); | ||
PatientInboxPage.loadInboxMessages(); | ||
PatientMessageDetailsPage.loadSingleThread(updatedSingleThreadResponse); | ||
PatientReplyPage.clickReplyButton(updatedSingleThreadResponse); | ||
PatientInterstitialPage.getContinueButton().click(); | ||
PatientReplyPage.getMessageBodyField() | ||
.focus() | ||
.clear() | ||
.type(`Test body`); | ||
}); | ||
|
||
describe('Verify single attachment with virus alert', () => { | ||
beforeEach(() => { | ||
PatientComposePage.attachMessageFromFile(Data.SAMPLE_IMG); | ||
cy.intercept( | ||
'POST', | ||
`${Paths.SM_API_EXTENDED}/${ | ||
updatedSingleThreadResponse.data[0].attributes.messageId | ||
}/reply`, | ||
{ | ||
statusCode: 400, | ||
body: { errors: [{ code: 'SM172' }] }, | ||
}, | ||
).as('failed'); | ||
cy.get(Locators.BUTTONS.SEND) | ||
.contains('Send') | ||
.click({ force: true }); | ||
}); | ||
|
||
it('verify alert exist and attach button disappears', () => { | ||
cy.get(Locators.ALERTS.ATTCH_VIRUS) | ||
.should(`be.visible`) | ||
.and(`have.text`, Alerts.VIRUS_ATTCH); | ||
|
||
cy.get(Locators.ATTACH_FILE_INPUT).should(`not.exist`); | ||
cy.get(Locators.BUTTONS.REMOVE_ATTACHMENT).should('be.focused'); | ||
|
||
cy.injectAxe(); | ||
cy.axeCheck(AXE_CONTEXT); | ||
|
||
cy.injectAxe(); | ||
cy.axeCheck(AXE_CONTEXT); | ||
}); | ||
|
||
it(`verify attach button back`, () => { | ||
cy.get(Locators.BUTTONS.REMOVE_ATTACHMENT).click({ force: true }); | ||
cy.get(Locators.BUTTONS.CONFIRM_REMOVE_ATTACHMENT) | ||
.should(`be.visible`) | ||
.then(btn => { | ||
return new Cypress.Promise(resolve => { | ||
setTimeout(resolve, 2000); | ||
cy.wrap(btn).click(); | ||
}); | ||
}); | ||
|
||
cy.get(Locators.BUTTONS.ATTACH_FILE).should(`exist`); | ||
cy.get(Locators.BUTTONS.ATTACH_FILE).should(`be.focused`); | ||
|
||
cy.injectAxe(); | ||
cy.axeCheck(AXE_CONTEXT); | ||
}); | ||
}); | ||
|
||
describe('Verify multiple attachment with virus alert', () => { | ||
beforeEach(() => { | ||
PatientComposePage.attachMessageFromFile(Data.SAMPLE_IMG); | ||
PatientComposePage.attachMessageFromFile(Data.SAMPLE_XLS); | ||
PatientComposePage.attachMessageFromFile(Data.SAMPLE_PDF); | ||
cy.intercept( | ||
'POST', | ||
`${Paths.SM_API_EXTENDED}/${ | ||
updatedSingleThreadResponse.data[0].attributes.messageId | ||
}/reply`, | ||
{ | ||
statusCode: 400, | ||
body: { errors: [{ code: 'SM172' }] }, | ||
}, | ||
).as('failed'); | ||
cy.get(Locators.BUTTONS.SEND) | ||
.contains('Send') | ||
.click({ force: true }); | ||
}); | ||
|
||
it('verify alert exist and attach button disappears', () => { | ||
cy.get(Locators.ALERTS.ATTCH_VIRUS) | ||
.should(`be.visible`) | ||
.and(`have.text`, Alerts.VIRUS_MULTI_ATTCH); | ||
cy.get(Locators.ATTACH_FILE_INPUT).should(`not.exist`); | ||
cy.get(Locators.BUTTONS.REMOVE_ALL_ATTCH).should('be.focused'); | ||
|
||
cy.injectAxe(); | ||
cy.axeCheck(AXE_CONTEXT); | ||
}); | ||
|
||
it(`verify attach button back`, () => { | ||
cy.get(Locators.BUTTONS.REMOVE_ALL_ATTCH) | ||
.should(`be.visible`) | ||
.then(btn => { | ||
return new Cypress.Promise(resolve => { | ||
setTimeout(resolve, 2000); | ||
cy.wrap(btn).click(); | ||
}); | ||
}); | ||
|
||
cy.get(Locators.BUTTONS.ATTACH_FILE).should(`exist`); | ||
cy.get(Locators.BUTTONS.ATTACH_FILE).should(`be.focused`); | ||
|
||
cy.injectAxe(); | ||
cy.axeCheck(AXE_CONTEXT); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters