| 1 |
import * as Order from "@point_of_sale/../tests/generic_helpers/order_widget_util"; |
| 2 |
import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; |
| 3 |
import * as TextInputPopup from "@point_of_sale/../tests/generic_helpers/text_input_popup_util"; |
| 4 |
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; |
| 5 |
|
| 6 |
export function clickOrderButton() { |
| 7 |
return [ |
| 8 |
{ |
| 9 |
content: "click order button", |
| 10 |
trigger: ".actionpad .submit-order", |
| 11 |
run: "click", |
| 12 |
}, |
| 13 |
]; |
| 14 |
} |
| 15 |
export function orderlinesHaveNoChange() { |
| 16 |
return Order.doesNotHaveLine({ withClass: ".has-change" }); |
| 17 |
} |
| 18 |
export function orderlineIsToOrder(name) { |
| 19 |
return Order.hasLine({ |
| 20 |
productName: name, |
| 21 |
withClass: ".orderline.has-change", |
| 22 |
}); |
| 23 |
} |
| 24 |
export function guestNumberIs(num) { |
| 25 |
return [ |
| 26 |
...ProductScreen.clickControlButtonMore(), |
| 27 |
{ |
| 28 |
content: `guest number is ${num}`, |
| 29 |
trigger: ProductScreen.controlButtonTrigger("Guests") + `:contains(${num})`, |
| 30 |
}, |
| 31 |
]; |
| 32 |
} |
| 33 |
export function OrderButtonNotContain(data) { |
| 34 |
const steps = [ |
| 35 |
{ |
| 36 |
isActive: ["desktop"], |
| 37 |
content: "check order button not contain data", |
| 38 |
trigger: `.product-screen .submit-order:not(:contains("${data}"))`, |
| 39 |
run: function () {}, // it's a check |
| 40 |
}, |
| 41 |
]; |
| 42 |
return steps; |
| 43 |
} |
| 44 |
export function clickCourseButton() { |
| 45 |
return [ |
| 46 |
{ |
| 47 |
content: "click course button", |
| 48 |
trigger: `.course-btn`, |
| 49 |
run: "click", |
| 50 |
}, |
| 51 |
]; |
| 52 |
} |
| 53 |
export function selectCourseLine(name) { |
| 54 |
return [ |
| 55 |
{ |
| 56 |
content: `select course ${name}`, |
| 57 |
trigger: `.order-course-name:contains(${name})`, |
| 58 |
run: "click", |
| 59 |
}, |
| 60 |
]; |
| 61 |
} |
| 62 |
export function fireCourseButton() { |
| 63 |
return [ |
| 64 |
{ |
| 65 |
content: "fire course button", |
| 66 |
trigger: `.actionpad .fire-btn`, |
| 67 |
run: "click", |
| 68 |
}, |
| 69 |
]; |
| 70 |
} |
| 71 |
export function fireCourseButtonHighlighted(courseName) { |
| 72 |
return [ |
| 73 |
{ |
| 74 |
content: "fire course button highlighted", |
| 75 |
trigger: `.actionpad .fire-btn.btn-primary:contains('Fire ${courseName}')`, |
| 76 |
}, |
| 77 |
]; |
| 78 |
} |
| 79 |
export function payButtonNotHighlighted() { |
| 80 |
return [ |
| 81 |
{ |
| 82 |
content: "pay button not highlighted", |
| 83 |
trigger: |
| 84 |
".actionpad .pay-order-button:not('.highlight'):not('.btn-primary'):contains('Payment')", |
| 85 |
}, |
| 86 |
]; |
| 87 |
} |
| 88 |
export function setTab(name) { |
| 89 |
return [ |
| 90 |
{ |
| 91 |
content: `set tab to ${name}`, |
| 92 |
trigger: `.product-screen .new-tab`, |
| 93 |
run: "click", |
| 94 |
}, |
| 95 |
TextInputPopup.inputText(name), |
| 96 |
Dialog.confirm(), |
| 97 |
]; |
| 98 |
} |
| 99 |
|
| 100 |
export function releaseTable() { |
| 101 |
return [ |
| 102 |
{ |
| 103 |
content: "release table", |
| 104 |
trigger: ".product-screen .leftpane .unbook-table", |
| 105 |
run: "click", |
| 106 |
}, |
| 107 |
]; |
| 108 |
} |
| 109 |
|
| 110 |
export function addCourse() { |
| 111 |
return { |
| 112 |
content: `click Course button`, |
| 113 |
trigger: ProductScreen.controlButtonTrigger("Course"), |
| 114 |
run: "click", |
| 115 |
}; |
| 116 |
} |
| 117 |
|
| 118 |
export function transferCourseTo(destCourse) { |
| 119 |
return [ |
| 120 |
...ProductScreen.clickControlButton("Transfer course"), |
| 121 |
{ |
| 122 |
content: `click ${destCourse} from available courses`, |
| 123 |
trigger: `.modal-body button:contains(${destCourse})`, |
| 124 |
run: "click", |
| 125 |
}, |
| 126 |
]; |
| 127 |
} |
| 128 |
|
| 129 |
export function discardOrderWarningDialog() { |
| 130 |
return [ |
| 131 |
{ |
| 132 |
trigger: `.modal-dialog:contains("It seems that the order has not been sent. Would you like to send it to preparation?")`, |
| 133 |
}, |
| 134 |
Dialog.discard(), |
| 135 |
]; |
| 136 |
} |
| 137 |
|
| 138 |
export function confirmOrderWarningDialog() { |
| 139 |
return [ |
| 140 |
{ |
| 141 |
trigger: `.modal-dialog:contains("It seems that the order has not been sent. Would you like to send it to preparation?")`, |
| 142 |
}, |
| 143 |
Dialog.confirm(), |
| 144 |
]; |
| 145 |
} |