import { Given, Then, When } from '@cucumber/cucumber'; import * as glue from './glue'; Given( /^I select message type as (General message|Request for cancellation|Notice of discrepancy)$/, glue.selectP2PMessageType ); Given( /^(applicant|beneficiary|issuingBank|confirmingBank|advisingBank|nominatedBank) (maker|checker|approver|makerChecker|checkerApprover|admin1|admin2) login and create p2p (General message) at current dc under (DC|DP) with the following values$/, glue.loginAndCreateP2PMessage ); Given( /^(applicant|beneficiary|issuingBank|confirmingBank|advisingBank|nominatedBank) (checker|approver|makerChecker|checkerApprover|admin1|admin2) login and (Verify|Reject) p2p message "([^"]+)?" with subject "([^"]+)?" at current dc under (DC|DP)$/, glue.loginAndVerfiyP2PMessage ); Given( /^(applicant|beneficiary|issuingBank|confirmingBank|advisingBank|nominatedBank) (maker|checker|approver|makerChecker|checkerApprover|admin1|admin2) login and Edit p2p message "([^"]+)?" with subject "([^"]+)?" at current dc under (DC|DP) with the following values$/, glue.loginAndEditP2PMessage ); Given( /^(applicant|beneficiary|issuingBank|confirmingBank|advisingBank|nominatedBank) (maker|checker|approver|makerChecker|checkerApprover|admin1|admin2) login and Reply to message subject "([^"]+)?" at current dc under (DC|DP) with the following values$/, glue.loginAndReplyP2PMessage ); When(/^I toggle read status at message with subject "([^"]+)?"$/, glue.toggleMessageReadStatusAtSubject); When( /^I (create|reply) p2p (General message) with the following values$/, async function (action, messageType, dataTable) { if (action === 'create') { await glue.createP2PMessage(messageType, dataTable); } else { await glue.replyP2PMessage(messageType, dataTable); } } ); When(/^I open p2p message which has subject "([^"]+)?" from listing$/, glue.openP2PThreadFromListing); When(/^I refresh P2P page$/, glue.refreshP2PMessagePage); When( /^I click on the button (Verify|Approve|Reject|Edit|Discard) at message "([^"]+)?"$/, glue.clickButtonAtMessageInP2PThread ); When( /^I click on the button (Verify|Approve|Reject|Edit|Discard) at pending message$/, glue.clickButtonAtPendingMessage ); When(/^I fill in p2p (General message|Notice of discrepancy) with the following values$/, glue.fillInCreateP2PMessage); When(/^I remove files "([^"]+)?" from p2p message$/, glue.removeFilesFromP2PMessage); When(/^I attach files "([^"]+)?" to p2p message$/, glue.attachFilesToP2PMessage); When(/^I scroll to p2p message "([^"]+)?"$/, async (message) => { await glue.scrollToP2PMessage(message); }); When(/^I move to p2p message "([^"]+)?"$/, async (message) => { await glue.moveToP2PMessage(message); }); Then(/^I expect message with subject "([^"]+)?" to match reference "([^"]+)?"$/, glue.checkVRForCTAP2PThreadAtSubject); Then(/^I see Option at message with subject "([^"]+)?" (Exist|Not Exist)$/, async function (subject, exist) { await glue.checkOptionAtMessageBySubjectExists(subject, exist !== 'Exist'); }); Then( /^I can view body of (General message|Request for cancellation) and see the following messages$/, glue.checkBodyOfP2PThread ); Then( /^I (can|cannot) see p2p (General message) which has subject "([^"]+)?" from listing$/, async (canSee, threadType, subject) => { await glue.checkIsP2PThreadExisting(threadType, subject, canSee === 'cannot'); } ); Then(/^I can see p2p (General message) at listing with the following values$/, glue.checkMessageAtListing); Then(/^I expect the Files tab view to match reference "([^"]+)?"$/, glue.checkVRAtFilesTab); Then(/^I expect the Message view to match reference "([^"]+)?"$/, glue.checkVRAtMessageView); Then(/^I can download files "([^"]+)?" at p2p Files tab view$/, glue.checkDownloadAtP2PFilesTabView); Then(/^I can download files "([^"]+)?" at p2p message "([^"]+)?"$/, glue.checkDownloadAtMessage);