From bb73528a3c6bb95461de8b671dd338fbb67a5813 Mon Sep 17 00:00:00 2001 From: nhanaa Date: Wed, 2 Aug 2023 14:14:04 -0500 Subject: [PATCH] Add helper function for scheduling in transfer criteria --- .../fragments/users/transferFeeFine.js | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cypress/support/fragments/users/transferFeeFine.js b/cypress/support/fragments/users/transferFeeFine.js index 5af15bdd90..11943fbd92 100644 --- a/cypress/support/fragments/users/transferFeeFine.js +++ b/cypress/support/fragments/users/transferFeeFine.js @@ -1,4 +1,4 @@ -import { Button, Modal, TextField, Select, Pane } from '../../../../interactors'; +import { Button, Modal, TextField, Select, Pane, MultiSelect } from '../../../../interactors'; const rootModal = Modal({ id: 'transfer-modal' }); const amountTextfield = rootModal.find(TextField({ id: 'amount' })); @@ -22,6 +22,25 @@ export default { cy.do(Select({ name: 'schedulePeriod' }).choose(period)); }, + setTransferCriteriaScheduling(frequency = 'Never (run manually)', interval, time, weekDays) { + cy.do(Select({ name: 'scheduling.frequency' }).choose(frequency)); + + if (frequency !== 'Never (run manually)') { + cy.do([ + Select({ name: 'scheduling.interval' }).choose(interval), + TextField({ name: 'scheduling.time' }).fillIn(time) + ]); + } + + if (frequency === 'Weekly') { + if (weekDays === undefined) { + cy.do(MultiSelect({ name: 'scheduling.weekDay' }).choose('Monday')); + } else { + weekDays.map((day) => cy.do(MultiSelect({ name: 'scheduling.weekDay' }).choose(day))); + } + } + }, + typeScheduleTime(time) { // time: string like 9:15 AM cy.do([