| 1 |
import * as FloorScreen from "@pos_restaurant/../tests/tours/utils/floor_screen_util"; |
| 2 |
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; |
| 3 |
import * as NumberPopup from "@point_of_sale/../tests/generic_helpers/number_popup_util"; |
| 4 |
import * as ChromePos from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; |
| 5 |
import * as ChromeRestaurant from "@pos_restaurant/../tests/tours/utils/chrome"; |
| 6 |
const Chrome = { ...ChromePos, ...ChromeRestaurant }; |
| 7 |
import * as ProductScreenPos from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; |
| 8 |
import * as ProductScreenResto from "@pos_restaurant/../tests/tours/utils/product_screen_util"; |
| 9 |
import * as Utils from "@point_of_sale/../tests/generic_helpers/utils"; |
| 10 |
import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util"; |
| 11 |
import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util"; |
| 12 |
const ProductScreen = { ...ProductScreenPos, ...ProductScreenResto }; |
| 13 |
import * as TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util"; |
| 14 |
import { registry } from "@web/core/registry"; |
| 15 |
import { inLeftSide } from "@point_of_sale/../tests/pos/tours/utils/common"; |
| 16 |
|
| 17 |
registry.category("web_tour.tours").add("FloorScreenTour", { |
| 18 |
steps: () => |
| 19 |
[ |
| 20 |
// check floors if they contain their corresponding tables |
| 21 |
Chrome.startPoS(), |
| 22 |
FloorScreen.selectedFloorIs("Main Floor"), |
| 23 |
FloorScreen.hasTable("2"), |
| 24 |
FloorScreen.hasTable("4"), |
| 25 |
FloorScreen.hasTable("5"), |
| 26 |
FloorScreen.clickFloor("Second Floor"), |
| 27 |
FloorScreen.hasTable("3"), |
| 28 |
FloorScreen.hasTable("1"), |
| 29 |
|
| 30 |
// clicking table in active mode does not open product screen |
| 31 |
// instead, table is selected |
| 32 |
Chrome.clickMenuOption("Edit Plan"), |
| 33 |
FloorScreen.clickTable("3"), |
| 34 |
FloorScreen.selectedTableIs("3"), |
| 35 |
FloorScreen.clickTable("1"), |
| 36 |
FloorScreen.selectedTableIs("1"), |
| 37 |
|
| 38 |
//test copy floor |
| 39 |
FloorScreen.clickFloor("Main Floor"), |
| 40 |
FloorScreen.clickEditButton("Clone"), |
| 41 |
FloorScreen.selectedFloorIs("Main Floor (copy)"), |
| 42 |
FloorScreen.hasTable("2"), |
| 43 |
FloorScreen.hasTable("4"), |
| 44 |
FloorScreen.hasTable("5"), |
| 45 |
Utils.refresh(), |
| 46 |
Chrome.clickMenuOption("Edit Plan"), |
| 47 |
FloorScreen.clickFloor("Main Floor (copy)"), |
| 48 |
FloorScreen.hasTable("2"), |
| 49 |
FloorScreen.hasTable("4"), |
| 50 |
FloorScreen.hasTable("5"), |
| 51 |
FloorScreen.clickEditButton("Delete"), |
| 52 |
Dialog.confirm(), |
| 53 |
Utils.refresh(), |
| 54 |
Chrome.clickMenuOption("Edit Plan"), |
| 55 |
Utils.elementDoesNotExist( |
| 56 |
".floor-selector .button-floor:contains('Main Floor (copy)')" |
| 57 |
), |
| 58 |
|
| 59 |
// test add table |
| 60 |
FloorScreen.clickFloor("Main Floor"), |
| 61 |
{ |
| 62 |
trigger: `.edit-buttons i[aria-label="Add Table"]`, |
| 63 |
run: "click", |
| 64 |
}, |
| 65 |
FloorScreen.selectedTableIs("6"), |
| 66 |
FloorScreen.clickEditButton("Rename"), |
| 67 |
|
| 68 |
NumberPopup.enterValue("100"), |
| 69 |
NumberPopup.isShown("100"), |
| 70 |
Dialog.confirm(), |
| 71 |
FloorScreen.selectedTableIs("100"), |
| 72 |
|
| 73 |
// test duplicate table |
| 74 |
FloorScreen.clickEditButton("Clone"), |
| 75 |
// the name is the first number available on the floor |
| 76 |
FloorScreen.selectedTableIs("1"), |
| 77 |
FloorScreen.clickEditButton("Rename"), |
| 78 |
|
| 79 |
NumberPopup.enterValue("1111"), |
| 80 |
NumberPopup.isShown("1111"), |
| 81 |
Dialog.confirm(), |
| 82 |
FloorScreen.selectedTableIs("1111"), |
| 83 |
|
| 84 |
// switch floor, switch back and check if |
| 85 |
// the new tables are still there |
| 86 |
FloorScreen.clickFloor("Second Floor"), |
| 87 |
FloorScreen.hasTable("3"), |
| 88 |
FloorScreen.hasTable("1"), |
| 89 |
|
| 90 |
//test duplicate multiple tables |
| 91 |
FloorScreen.clickTable("1"), |
| 92 |
FloorScreen.selectedTableIs("1"), |
| 93 |
FloorScreen.ctrlClickTable("3"), |
| 94 |
FloorScreen.selectedTableIs("3"), |
| 95 |
FloorScreen.clickEditButton("Clone"), |
| 96 |
FloorScreen.selectedTableIs("4"), |
| 97 |
FloorScreen.selectedTableIs("5"), |
| 98 |
|
| 99 |
//test delete multiple tables |
| 100 |
FloorScreen.clickEditButton("Delete"), |
| 101 |
Dialog.confirm(), |
| 102 |
|
| 103 |
FloorScreen.clickFloor("Main Floor"), |
| 104 |
FloorScreen.hasTable("2"), |
| 105 |
FloorScreen.hasTable("4"), |
| 106 |
FloorScreen.hasTable("5"), |
| 107 |
FloorScreen.hasTable("100"), |
| 108 |
FloorScreen.hasTable("1111"), |
| 109 |
|
| 110 |
// test delete table |
| 111 |
FloorScreen.clickTable("1111"), |
| 112 |
FloorScreen.selectedTableIs("1111"), |
| 113 |
FloorScreen.clickEditButton("Delete"), |
| 114 |
Dialog.confirm(), |
| 115 |
|
| 116 |
// change number of seats |
| 117 |
FloorScreen.clickTable("4"), |
| 118 |
FloorScreen.selectedTableIs("4"), |
| 119 |
FloorScreen.clickEditButton("Seats"), |
| 120 |
NumberPopup.enterValue("⌫9"), |
| 121 |
NumberPopup.enterValue("9"), |
| 122 |
NumberPopup.isShown("9"), |
| 123 |
Dialog.confirm(), |
| 124 |
FloorScreen.table({ name: "4" }), |
| 125 |
|
| 126 |
// change number of seat when the input is already selected |
| 127 |
FloorScreen.selectedTableIs("4"), |
| 128 |
FloorScreen.clickEditButton("Seats"), |
| 129 |
NumberPopup.enterValue("15"), |
| 130 |
NumberPopup.isShown("15"), |
| 131 |
Dialog.confirm(), |
| 132 |
FloorScreen.table({ name: "4" }), |
| 133 |
|
| 134 |
// change shape |
| 135 |
FloorScreen.clickEditButton("Make Round"), |
| 136 |
|
| 137 |
// Opening product screen in main floor should go back to main floor |
| 138 |
FloorScreen.clickSaveEditButton(), |
| 139 |
FloorScreen.table({ name: "4", withoutClass: ".selected" }), |
| 140 |
FloorScreen.clickTable("4"), |
| 141 |
ProductScreen.isShown(), |
| 142 |
Chrome.clickPlanButton(), |
| 143 |
|
| 144 |
// Opening product screen in second floor should go back to second floor |
| 145 |
FloorScreen.clickFloor("Second Floor"), |
| 146 |
FloorScreen.hasTable("3"), |
| 147 |
FloorScreen.clickTable("3"), |
| 148 |
ProductScreen.isShown(), |
| 149 |
Chrome.clickPlanButton(), |
| 150 |
FloorScreen.selectedFloorIs("Second Floor"), |
| 151 |
].flat(), |
| 152 |
}); |
| 153 |
registry.category("web_tour.tours").add("TableMergeUnmergeTour", { |
| 154 |
steps: () => |
| 155 |
[ |
| 156 |
Chrome.startPoS(), |
| 157 |
// Check the linking of tables |
| 158 |
FloorScreen.clickFloor("Main Floor"), |
| 159 |
FloorScreen.clickTable("4"), |
| 160 |
ProductScreen.clickDisplayedProduct("Coca-Cola"), |
| 161 |
Chrome.clickPlanButton(), |
| 162 |
FloorScreen.isShown(), |
| 163 |
FloorScreen.linkTables("5", "4"), |
| 164 |
FloorScreen.isChildTable("5"), |
| 165 |
Utils.refresh(), |
| 166 |
FloorScreen.isChildTable("5"), |
| 167 |
|
| 168 |
// Check that tables are unlinked automatically when the order is done |
| 169 |
FloorScreen.clickTable("5"), |
| 170 |
Chrome.isTabActive("4 & 5"), |
| 171 |
inLeftSide(ProductScreen.orderLineHas("Coca-Cola", "1")), |
| 172 |
Chrome.clickPlanButton(), |
| 173 |
FloorScreen.isShown(), |
| 174 |
FloorScreen.goTo("5"), |
| 175 |
Chrome.isTabActive("4 & 5"), |
| 176 |
inLeftSide(ProductScreen.orderLineHas("Coca-Cola", "1")), |
| 177 |
ProductScreen.clickPayButton(false), |
| 178 |
ProductScreen.discardOrderWarningDialog(), |
| 179 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 180 |
PaymentScreen.clickValidate(), |
| 181 |
ReceiptScreen.clickNextOrder(), |
| 182 |
Utils.negateStep(FloorScreen.isChildTable("5")), |
| 183 |
|
| 184 |
FloorScreen.linkTables("5", "4"), |
| 185 |
// Check that the tables are unlinked when the child table is dragged |
| 186 |
FloorScreen.unlinkTables("5", "4"), |
| 187 |
Utils.negateStep(FloorScreen.isChildTable("5")), |
| 188 |
|
| 189 |
// Verify that tables are unlinked and original orders are restored after dragging a child table. |
| 190 |
FloorScreen.isShown(), |
| 191 |
FloorScreen.clickTable("4"), |
| 192 |
ProductScreen.clickDisplayedProduct("Coca-Cola"), |
| 193 |
Chrome.clickPlanButton(), |
| 194 |
FloorScreen.isShown(), |
| 195 |
|
| 196 |
FloorScreen.clickTable("5"), |
| 197 |
ProductScreen.clickDisplayedProduct("Minute Maid"), |
| 198 |
Chrome.clickPlanButton(), |
| 199 |
FloorScreen.isShown(), |
| 200 |
|
| 201 |
// Link tables 5 and 4 |
| 202 |
FloorScreen.linkTables("5", "4"), |
| 203 |
FloorScreen.isChildTable("5"), |
| 204 |
|
| 205 |
// Check merged orders |
| 206 |
FloorScreen.clickTable("5"), |
| 207 |
Chrome.isTabActive("4 & 5"), |
| 208 |
inLeftSide(ProductScreen.orderLineHas("Coca-Cola", "1")), |
| 209 |
inLeftSide(ProductScreen.orderLineHas("Minute Maid", "1")), |
| 210 |
Chrome.clickPlanButton(), |
| 211 |
FloorScreen.isShown(), |
| 212 |
|
| 213 |
// Unlink tables and verify restoration of original orders |
| 214 |
FloorScreen.unlinkTables("5", "4"), |
| 215 |
Utils.negateStep(FloorScreen.isChildTable("5")), |
| 216 |
|
| 217 |
// Check original orders for table 4 |
| 218 |
FloorScreen.clickTable("4"), |
| 219 |
inLeftSide(ProductScreen.orderLineHas("Coca-Cola", "1")), |
| 220 |
ProductScreen.clickOrderButton(), |
| 221 |
{ |
| 222 |
...Dialog.confirm(), |
| 223 |
content: "Acknowledge printing error (test does not use a printer).", |
| 224 |
}, |
| 225 |
ProductScreen.orderlinesHaveNoChange(), |
| 226 |
Chrome.clickPlanButton(), |
| 227 |
FloorScreen.isShown(), |
| 228 |
|
| 229 |
// Check original orders for table 5 |
| 230 |
FloorScreen.clickTable("5"), |
| 231 |
inLeftSide(ProductScreen.orderLineHas("Minute Maid", "1")), |
| 232 |
ProductScreen.clickOrderButton(), |
| 233 |
{ |
| 234 |
...Dialog.confirm(), |
| 235 |
content: "Acknowledge printing error (test does not use a printer).", |
| 236 |
}, |
| 237 |
ProductScreen.orderlinesHaveNoChange(), |
| 238 |
Chrome.clickPlanButton(), |
| 239 |
FloorScreen.isShown(), |
| 240 |
|
| 241 |
// Relink tables and verify |
| 242 |
FloorScreen.linkTables("5", "4"), |
| 243 |
FloorScreen.clickTable("5"), |
| 244 |
Chrome.isTabActive("4 & 5"), |
| 245 |
ProductScreen.orderlinesHaveNoChange(), |
| 246 |
|
| 247 |
// Add a new product to the merged order |
| 248 |
ProductScreen.clickDisplayedProduct("Minute Maid"), |
| 249 |
ProductScreen.orderlineIsToOrder("Minute Maid"), |
| 250 |
ProductScreen.clickOrderButton(), |
| 251 |
{ |
| 252 |
...Dialog.confirm(), |
| 253 |
content: "Acknowledge printing error (test does not use a printer).", |
| 254 |
}, |
| 255 |
ProductScreen.orderlinesHaveNoChange(), |
| 256 |
|
| 257 |
// Unlink tables again and verify restoration |
| 258 |
Chrome.clickPlanButton(), |
| 259 |
FloorScreen.isShown(), |
| 260 |
FloorScreen.unlinkTables("5", "4"), |
| 261 |
Utils.negateStep(FloorScreen.isChildTable("5")), |
| 262 |
|
| 263 |
// Verify orders after unlinking |
| 264 |
FloorScreen.clickTable("5"), |
| 265 |
inLeftSide(ProductScreen.orderLineHas("Minute Maid", "1")), |
| 266 |
Chrome.clickPlanButton(), |
| 267 |
FloorScreen.isShown(), |
| 268 |
FloorScreen.clickTable("4"), |
| 269 |
inLeftSide(ProductScreen.orderLineHas("Coca-Cola", "1")), |
| 270 |
Chrome.clickPlanButton(), |
| 271 |
FloorScreen.isShown(), |
| 272 |
].flat(), |
| 273 |
}); |
| 274 |
|
| 275 |
registry.category("web_tour.tours").add("test_create_floor_tour", { |
| 276 |
steps: () => |
| 277 |
[ |
| 278 |
Chrome.startPoS(), |
| 279 |
Dialog.confirm("Open Register"), |
| 280 |
Chrome.clickMenuOption("Edit Plan"), |
| 281 |
FloorScreen.addFloor("AAA"), |
| 282 |
].flat(), |
| 283 |
}); |
| 284 |
|
| 285 |
registry.category("web_tour.tours").add("test_tax_in_merge_table_order_line_tour", { |
| 286 |
steps: () => |
| 287 |
[ |
| 288 |
Chrome.startPoS(), |
| 289 |
Dialog.confirm("Open Register"), |
| 290 |
FloorScreen.clickFloor("Main Floor"), |
| 291 |
FloorScreen.clickTable("4"), |
| 292 |
ProductScreen.clickDisplayedProduct("product_1"), |
| 293 |
Chrome.clickPlanButton(), |
| 294 |
FloorScreen.clickFloor("Main Floor"), |
| 295 |
FloorScreen.clickTable("5"), |
| 296 |
ProductScreen.clickDisplayedProduct("product_2"), |
| 297 |
Chrome.clickPlanButton(), |
| 298 |
FloorScreen.isShown(), |
| 299 |
FloorScreen.linkTables("5", "4"), |
| 300 |
FloorScreen.isChildTable("5"), |
| 301 |
].flat(), |
| 302 |
}); |
| 303 |
|
| 304 |
registry.category("web_tour.tours").add("no_ghost_floor", { |
| 305 |
steps: () => |
| 306 |
[ |
| 307 |
Chrome.startPoS(), |
| 308 |
Dialog.confirm("Open Register"), |
| 309 |
|
| 310 |
// 1. Create new floor along with a table |
| 311 |
Chrome.clickMenuOption("Edit Plan"), |
| 312 |
FloorScreen.addFloor("Ghost Floor"), |
| 313 |
{ |
| 314 |
trigger: `.edit-buttons i[aria-label="Add Table"]`, |
| 315 |
run: "click", |
| 316 |
}, |
| 317 |
FloorScreen.selectedTableIs("1"), |
| 318 |
FloorScreen.clickEditButton("Rename"), |
| 319 |
|
| 320 |
NumberPopup.enterValue("999"), |
| 321 |
NumberPopup.isShown("999"), |
| 322 |
Dialog.confirm(), |
| 323 |
FloorScreen.selectedTableIs("999"), |
| 324 |
FloorScreen.clickSaveEditButton(), |
| 325 |
|
| 326 |
// 2. Create and pay an order on that table |
| 327 |
FloorScreen.clickFloor("Ghost Floor"), |
| 328 |
FloorScreen.clickTable("999"), |
| 329 |
ProductScreen.clickDisplayedProduct("Coca-Cola"), |
| 330 |
ProductScreen.clickPayButton(false), |
| 331 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 332 |
PaymentScreen.clickValidate(), |
| 333 |
ReceiptScreen.clickNextOrder(), |
| 334 |
|
| 335 |
// 3. Delete the floor |
| 336 |
Chrome.clickMenuOption("Edit Plan"), |
| 337 |
FloorScreen.clickFloor("Ghost Floor"), |
| 338 |
FloorScreen.clickEditButton("Delete"), |
| 339 |
Dialog.confirm(), |
| 340 |
FloorScreen.clickSaveEditButton(), |
| 341 |
|
| 342 |
// 4. Refund one orderline of the paid order |
| 343 |
Chrome.clickOrders(), |
| 344 |
TicketScreen.selectFilter("Active"), |
| 345 |
TicketScreen.selectFilter("Paid"), |
| 346 |
TicketScreen.selectOrder("0001"), |
| 347 |
TicketScreen.confirmRefund(), |
| 348 |
PaymentScreen.isShown(), |
| 349 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 350 |
PaymentScreen.clickValidate(), |
| 351 |
ReceiptScreen.clickNextOrder(), |
| 352 |
|
| 353 |
// 5. Floor Plan ===> The floor deleted was reappearing |
| 354 |
FloorScreen.hasNotFloor("Ghost Floor"), |
| 355 |
].flat(), |
| 356 |
}); |