import { ContourAlert } from '../../../elements/contourAlert'; import { SECTION } from '../../../enum/navigationSection'; import { P2P_PROP } from '../../../enum/p2p'; import P2PMessage from '../../../pages/p2p/p2pMessage.page'; import * as stepVariableMap from '../../../util/stepVariableMap'; import { loginAndOpenCurrentDC } from '../../login/glue'; import { navigateFromDCToP2PSection } from '../../navigation/glue'; import { attachFilesToP2PMessage, openP2PThreadFromListing } from './'; export async function loginAndReplyP2PMessage(party, role, subject, documentType, dataTable: { rowsHash: () => any }) { await loginAndOpenCurrentDC(party, role); await navigateFromDCToP2PSection(SECTION.NEW_P2P_MESSAGE, documentType); await openP2PThreadFromListing(subject); const rowsHash = dataTable.rowsHash(); const p2pMessagePage = new P2PMessage(); if (rowsHash[P2P_PROP.MESSAGE]) { const message = stepVariableMap.replaceWithSpecialKeyValue(rowsHash[P2P_PROP.MESSAGE]); await p2pMessagePage.getFormMessageTextArea().setInputField(message); } if (rowsHash[P2P_PROP.ATTACHMENT]) { const addedFiles = stepVariableMap.replaceWithSpecialKeyValue(rowsHash[P2P_PROP.ATTACHMENT]); attachFilesToP2PMessage(addedFiles); } await p2pMessagePage.getSendButton().clickElement(); await new ContourAlert().clickButtonByLabelTxt('Confirm'); await browser.pause(3000); }