import { ContourAlert } from '../../../elements/contourAlert'; import { SECTION } from '../../../enum/navigationSection'; import { P2P_MESSAGE_BUTTONS, 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, clickButtonAtMessageInP2PThread, openP2PThreadFromListing, removeFilesFromP2PMessage } from '../../p2p/glue'; export async function loginAndEditP2PMessage( party: string, role: string, message: string, subject: string, documentType: string, dataTable: { rowsHash: () => any } ) { await loginAndOpenCurrentDC(party, role); await navigateFromDCToP2PSection(SECTION.NEW_P2P_MESSAGE, documentType); await openP2PThreadFromListing(subject); await clickButtonAtMessageInP2PThread(P2P_MESSAGE_BUTTONS.EDIT, message); const rowsHash = dataTable.rowsHash(); const p2pMessagePage = new P2PMessage(); if (rowsHash[P2P_PROP.EDITED_MESSAGE]) { const editedMessage = stepVariableMap.replaceWithSpecialKeyValue(rowsHash[P2P_PROP.EDITED_MESSAGE]); await p2pMessagePage.getFormMessageTextArea().setInputField(editedMessage); } if (rowsHash[P2P_PROP.ADD_FILES]) { const addedFiles = stepVariableMap.replaceWithSpecialKeyValue(rowsHash[P2P_PROP.ADD_FILES]); attachFilesToP2PMessage(addedFiles); } if (rowsHash[P2P_PROP.REMOVE_FILES]) { const removedFiles = stepVariableMap.replaceWithSpecialKeyValue(rowsHash[P2P_PROP.REMOVE_FILES]); removeFilesFromP2PMessage(removedFiles); } await p2pMessagePage.getSendButton().clickElement(); await new ContourAlert().clickButtonByLabelTxt('Confirm'); await browser.pause(3000); }