-
Notifications
You must be signed in to change notification settings - Fork 126
/
secure-messaging-save-reply-draft.cypress.spec.js
61 lines (47 loc) · 2.02 KB
/
secure-messaging-save-reply-draft.cypress.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import SecureMessagingSite from './sm_site/SecureMessagingSite';
import PatientMessageDetailsPage from './pages/PatientMessageDetailsPage';
import PatientInboxPage from './pages/PatientInboxPage';
import PatientMessageDraftsPage from './pages/PatientMessageDraftsPage';
import PatientReplyPage from './pages/PatientReplyPage';
import mockMessages from './fixtures/messages-response.json';
import mockSingleThread from './fixtures/thread-response.json';
import { AXE_CONTEXT, Data, Locators } from './utils/constants';
describe('Secure Messaging Reply', () => {
it('Axe Check Message Reply', () => {
// declare pages & constants
const landingPage = new PatientInboxPage();
const site = new SecureMessagingSite();
const draftPage = new PatientMessageDraftsPage();
const messageDetailsPage = new PatientMessageDetailsPage();
const bodyText = ' Updated body text';
const singleMessage = { data: mockSingleThread.data[0] };
singleMessage.data.attributes.body = bodyText;
// load single thread
site.login();
landingPage.loadInboxMessages(mockMessages);
landingPage.loadSingleThread(mockSingleThread);
// click reply btn
messageDetailsPage.clickReplyButton(mockSingleThread);
// change message
PatientReplyPage.getMessageBodyField().type(bodyText, {
force: true,
});
// save changed message as a draft
draftPage.saveNewDraftMessage(mockSingleThread, singleMessage);
// assert message saved
cy.get(Locators.ALERTS.SAVE_DRAFT).should(
'include.text',
Data.MESSAGE_WAS_SAVED,
);
// verify reply topic
messageDetailsPage.replyToMessageTo(singleMessage);
// verify saved draft details
messageDetailsPage.replyToMessageSenderName(singleMessage);
messageDetailsPage.replyToMessageRecipientName(singleMessage);
messageDetailsPage.replyToMessageDate(singleMessage);
messageDetailsPage.replyToMessageId(singleMessage);
messageDetailsPage.replyToMessageBody(singleMessage);
cy.injectAxe();
cy.axeCheck(AXE_CONTEXT);
});
});