import ActionButton from '../../../pages/actionButton/actionButton.page'; import DpOtherDocument from '../../../pages/dp/dpOtherDocument.page'; import SubSideMenu from '../../../pages/sideMenu/subSideMenu.page'; import path = require('path'); import process = require('process'); export async function fillInPackingList(otherDocumentName: string, dataTable: any) { const data = dataTable.rowsHash(); const subSideMenu = new SubSideMenu(); const dpOtherDocument = new DpOtherDocument(); const actionButton = new ActionButton(); await subSideMenu.getSubMenuSubOption(otherDocumentName).clickElement(); if (data['Document'] == 'Electronic record') { await dpOtherDocument.getRadioElectronicRecordAvailable().clickElement(); } else if (data['Document'] == 'Paper document') { await dpOtherDocument.getRadioDocumentsWillBeMailed().clickElement(); } else { await dpOtherDocument.getRadioDocumentNotAvailable().clickElement(); } if (data['Upload file']) { const filePaths = data['Upload file'].split(','); for (const element of filePaths) { const fullPath = path.join(process.cwd(), element); const remoteFilePath = browser.uploadFile(fullPath); logger.debug('remotepath', remoteFilePath); await dpOtherDocument.getUploadFiles().uploadFile(await remoteFilePath); } } await actionButton.getSaveAndNextButton().clickElement(); }