import { DataTable, Then, When } from '@cucumber/cucumber'; import DcForm from '../../pages/dc/dcForm.page'; import * as glue from './glue'; /** * UI */ When( /^I (fill|fill & Save) DC for scenario (sc1|sc2|sc4|sc5|sc6|sc8|sc10|sc11|sc12) with following values$/, glue.fillDc ); When(/^I fill in DC Details section with following values$/, async (dataTable: DataTable) => { const dcForm = new DcForm(); await dcForm.fillDocumentSource(dataTable); }); When(/^I attach files "([^"]+)?" to DC form$/, glue.attachFilesToDCForm); When(/^I remove (\d+) row of attachment$/, async (rowNum) => { const dcForm = new DcForm(); const removeAttachmentButton = dcForm.getAttachmentRemoveButton(rowNum); await removeAttachmentButton.clickElement(); }); Then(/^I can see dc for scenario (sc1|sc2|sc4|sc5|sc6|sc8|sc10|sc11)$/, glue.checkDc); Then(/^I can see the following document source with following values$/, glue.checkDocumentSource); Then(/^I can see the following attachment and remove button with following values$/, glue.checkAttachment); Then(/^I check DC fields are editable$/, glue.checkDCEditable); Then('required field error banner shows {int} error(s)', async (errorCount) => { const dcForm = new DcForm(); await dcForm.checkRequiredFieldErrorCount(errorCount); }); When(/^I save the latest UUID in DC list page$/, glue.saveLatestUUIDinDCList); When( /^I get UUID for the DC submitted by (maker|admin1) for scenario (sc1|sc2|sc4|sc5|sc6|sc8|sc10|sc11)$/, glue.getUUIDFromSubmitResponse ); When(/^I fill in Available By section with following values$/, async (dataTable: DataTable) => { const dcForm = new DcForm(); await dcForm.fillAvailableBy(dataTable); }); Then( /^(applicant|beneficiary|issuingBank|confirmingBank|advisingBank|nominatedBank) proceeds to submit the (dc|draft|draftAmendment|Amendment|DP) to (IssuingBank|beneficiary|applicant|confirmingBank) to complete the flow using (mca1|mca2) for scenario (sc1|sc5|sc11)$/, glue.performMcaFlow ); Then( /^the (applicant|beneficiary|issuingBank|confirmingBank|advisingBank|nominatedBank) proceeds to submit the (dc|draft|draftAmendment|Amendment|DP) to (IssuingBank|beneficiary|applicant|confirmingBank|nominatedBank|advisingBank|acceptedAmendment) to complete the flow using (mca1|mca2) for scenario (sc1|sc5|sc11)$/, glue.populateMCAWorkflows );