POS Automation - Validate Gift Receipt Return
Overview
This tutorial provides step-by-step guidance on automating the process of validating the gift receipt return.
What you will learn
How to use the following steps
Pre-requisites
Should have a POS Setup and Automation Workspace Setup
Exercises
Add Automation Script File
Right click on the Automated Tests project and create a new package in the test folder, feature.retail.pos.tutorials.returns
Make sure your package is registered in the testNG.xml
Right click on the package and create a new cucumber test PosGiftReceiptReturn.feature
Add the Steps
-
First you have to start from adding the step to sign on as a given user. Refer Login as a user
-
After logging in, press the button labeled "Sales" on the transaction page. Refer Press a button
- After pressing the Sales button, press the button labeled "Receipts" on the transaction page. Refer Press a button
- After the Receipts button is pressed, press the button labeled "Request Gift Receipt" on the transaction page. Refer Press a button
- After that you have to inspect the Component Id for the Input Box in the transaction page so that you can enter the productID. (Refer Component Inspection).
- Add the component entries to
.properties
file ( Refer Component Details to set up Client Property file).
your entry would be like
COMPONENT_INPUT_BOX=InputBox
- You can directly add the ProductID and Product Description to the step or else you can add data entries to data property file and use the variables. Refer Data property File
If defined in the data property file,
your entries would be like
PRODUCT_2=2
PRODUCT_3=A-1
- When you press the buttons to continue the gift sale, you will be navigated to the following pages. Therfore the Window names should be inspected and add the window entries to
.properties
file ( Refer Window Details to set up Client Property file).
- "Request Gift Receipt Total" page
- "Select Tender" page
- "Enter Cash Tender Amount" page
- "Await Drawer Closed" page
- "Primary Printer" window
- "Cash Drawer" window
- "Enter User" page
When updated the client property file,
your entries would be like
WINDOW_REQUEST_GIFT_RECEIPT_TOTAL=Point-of-Sale Application:Point-of-Sale Application:Gift Receipt At Total Pos/GiftReceipt/RequestGiftReceiptAtTotal GiftReceiptAtTotal Pos/GiftReceipt/GiftReceiptAtTotal
WINDOW_SELECT_TENDER=Point-of-Sale Application:Point-of-Sale Application:Select Tender Pos/Tender/DoTender SelectTender NextGen1024x768/Pos/Tender/SelectTender
WINDOW_ENTER_CASH_TENDER_AMOUNT=Point-of-Sale Application:Point-of-Sale Application:Enter Tender Amount Pos/Tender/GetTenderAmountMain EnterTenderAmountWithSuggestions Pos/Tender/EnterCashTenderAmount
WINDOW_AWAIT_DRAWER_CLOSED=Point-of-Sale Application:Point-of-Sale Application:Wait Drawer Closed Pos/Transaction/AwaitDrawerClosed AwaitDrawerClosed Pos/Transaction/AwaitDrawerClosed
WINDOW_PRIMARY_PRINTER=PrimaryPrinter
WINDOW_CASH_DRAWER=Cashdrawer
WINDOW_ENTER_USER=Point-of-Sale Application:Point-of-Sale Application:Enter User Pos/SignOn/SignOn EnterUserState NextGen1024x768/Pos/SignOn/EnterUser
After completing the Gift Receipt sale, the gift products are returned in this automation script.
-
Again you have to start from adding the step to sign on as a given user. Refer Login as a user
-
After logging in, press the button labeled "Returns" on the transaction page. Refer Press a button
- When you press the buttons to continue the gift receipt return, you will be navigated to the following pages. Therfore the Window names should be inspected and add the window entries to
.properties
file ( Refer Window Details to set up Client Property file).
- "Enter Original Transaction Id" page
- "Display Transaction with MSG config" page
- "Extended Return Details" page
When updated the client property file,
your entries would be like
WINDOW_ENTER_ORIGINAL_TRANSACTION_ID=Point-of-Sale Application: Pos/Transaction/GetRetailArchiveTransaction GetOriginalTransactionID Pos/Transaction/EnterOriginalTransactionID
WINDOW_DISPLAY_TRANSACTION_WITH_MSG_CONFIG=Point-of-Sale Application:Point-of-Sale Application:Display Transaction Pos/Print/DisplayAndPrintTransaction DisplayTransactionWithMSGConfig Pos/Transaction/DisplayTransaction
WINDOW_EXTENDED_RETURN_DETAILS=Point-of-Sale Application:Point-of-Sale Application:Select Extended Return Details Pos/Return/HandleReceiptReturnItemSelection SelectReturnItems Pos/Return/SelectExtendedReturnDetails
After that you have to inspect the Component Id for the "Selection List" list (Refer Component Inspection).
- Add the component entry to
.properties
file ( Refer Component Details to set up Client Property file).
your entry would be like
COMPONENT_SELECTION_LIST=SelectionList
- When you press the buttons to continue the gift receipt return, you will be navigated to the following pages. Therfore the Window names should be inspected and add the window entries to
.properties
file ( Refer Window Details to set up Client Property file).
- "Confirm Return Complete Receipt" page
- "Select Reason" page
When updated the client property file,
your entries would be like
WINDOW_CONFIRM_RETURN_COMPLETE_RECEIPT=\ Pos/Return/HandleReceiptReturnItemSelection ConfirmReturnCompleteReceipt NextGen1024x768/Message/NonModalOKCancel
WINDOW_SELECT_REASON=Point-of-Sale Application: Pos/Reason/SelectReasonCode SelectReasonCode Pos/Reason/SelectReason
After that you have to inspect the Component Id for the "Selection List" list (Refer Component Inspection).
- Add the component entry to
.properties
file ( Refer Component Details to set up Client Property file).
your entry would be like
COMPONENT_SELECTION_LIST=SelectionList
- When you press the buttons to continue the gift receipt return, you will be navigated to the following pages. Therfore the Window names should be inspected and add the window entries to
.properties
file ( Refer Window Details to set up Client Property file).
- "Return Slip Message" page
- "Transaction Basket" page
- "Refund Item" page
- "Enter Cash Tender Amount" page
- "Transaction Signature Verification" page
- "Await Drawer Closed" page
When updated the client property file,
your entries would be like
WINDOW_RETURN_SLIP_MESSAGE=Point-of-Sale Application: Pos/Product/ProductReturnDataCapture OfferProductReturnSlip Message/ModalYesNo
WINDOW_TRANSACTION_BASKET=Point-of-Sale Application:Point-of-Sale Application:Sale Pos/Sale/Sale SignedOnState NextGen1024x768/Pos/Sale/Sale
WINDOW_REFUND_ITEM=Point-of-Sale Application:Point-of-Sale Application:Select Refund Pos/Tender/DoTender SelectRefund NextGen1024x768/Pos/Tender/SelectRefund
WINDOW_ENTER_CASH_TENDER_AMOUNT=Point-of-Sale Application:Point-of-Sale Application:Enter Tender Amount Pos/Tender/GetTenderAmountMain EnterTenderAmountWithSuggestions Pos/Tender/EnterCashTenderAmount
WINDOW_TRANSACTION_SIGNATURE_VERIFICATION=Point-of-Sale Application:Point-of-Sale Application:Signature Verification Pos/Print/PrintSignatureSlips GetCustomerSignature Pos/Transaction/GetSignatureVerification
WINDOW_AWAIT_DRAWER_CLOSED=Point-of-Sale Application:Point-of-Sale Application:Wait Drawer Closed Pos/Transaction/AwaitDrawerClosed AwaitDrawerClosed Pos/Transaction/AwaitDrawerClosed
- Finally, Your feature file would be like ,
Scenario: Return gift receipt
Given user signs on as "Sales Assistant"
And user presses "Sales" button
And user presses "Receipts" button
And user presses "Request Gift Receipt" button
And "Gift Receipt Requested" is displayed in "Receipt" list
And user enters "${Product 2}" into "Input Box" field
And user presses "ENT" button
And user enters "${Product 3}" into "Input Box" field
And user presses "ENT" button
And user presses "TOTAL" button and "Request Gift Receipt Total" page shown
When user presses "Individual Receipts" button and "Select Tender" page shown
And "Gift" is displayed in "Receipt" list
And user presses "Cash" button and "Enter Cash Tender Amount" page shown
And user presses "OK" button and "Await Drawer Closed" page shown
Then receipt display with following details
| address | ${Street 1},${Street 2},${Town},${County},${Postcode} |
| telephone | Tel: ${Store Phone 1} |
| text | Sale |
| item | ${Product 2 Description},${Product 2 Price} |
| item | ${Product 3 Description},${Product 3 Price} |
| item | Cash UK,-£16.00 |
Then gift receipt "1" display with following details
| text | Gift Receipt |
| item | ${Product 2 Description},OUZ |
Then gift receipt "2" display with following details
| text | Gift Receipt |
| item | ${Product 3 Description},HKR |
And user presses "Clear" button on external "Primary Printer" window
And user presses "Close" button on external "Cash Drawer" window
When user presses "SignOff" button
Then "Enter User" page is shown
# waits for transaction to appear &proccess in EM
And user waits "150" seconds
#Return gift Receipt 1
When user signs on as "Sales Assistant"
When user presses "Returns" button
And user presses "Return Receipt" button and "Enter Original Transaction Id" page shown
And user enters "${retrieveTransactionReference(1)}" into "Input Box" field
And user presses "OK" button and "Display Transaction with MSG config" page shown
And user presses "Continue" button and "Extended Return Details" page shown
And user selects "${Product 2 Description}" from "Selection List" list
When user presses "Return Entire Receipt" button and "Confirm Return Complete Receipt" page shown
And user presses "OK" button and "Select Reason" page shown
And user selects "Damaged / Faulty (30 Days)" from "Selection List" list
And user presses "OK" button and "Return Slip Message" page shown
And user presses "Yes" button and "Transaction Basket" page shown
And user presses "TOTAL" button and "Refund Item" page shown
Then user presses "Cash" button and "Enter Cash Tender Amount" page shown
And user presses "OK" button and "Transaction Signature Verification" page shown
And user presses "Signature OK" button and "Await Drawer Closed" page shown
And receipt display with following details
| text | Refund |
| item | R,${Product 2 Description},-${Product 2 Price} |
When user presses "Close" button on external "Cash Drawer" window
Then "Transaction Basket" page is shown
When user presses "SignOff" button
Then "Enter User" page is shown
#Return gift Receipt 2
When user signs on as "Sales Assistant"
When user presses "Returns" button
And user presses "Return Receipt" button and "Enter Original Transaction Id" page shown
And user enters "${retrieveTransactionReference(2)}" into "Input Box" field
And user presses "OK" button and "Display Transaction with MSG config" page shown
And user presses "Continue" button and "Extended Return Details" page shown
And user selects "${Product 3 Description}" from "Selection List" list
When user presses "Return Entire Receipt" button and "Confirm Return Complete Receipt" page shown
And user presses "OK" button and "Select Reason" page shown
And user selects "Damaged / Faulty (30 Days)" from "Selection List" list
And user presses "OK" button and "Return Slip Message" page shown
And user presses "Yes" button and "Transaction Basket" page shown
And user presses "TOTAL" button and "Refund Item" page shown
Then user presses "Cash" button and "Enter Cash Tender Amount" page shown
And user presses "OK" button and "Transaction Signature Verification" page shown
And user presses "Signature OK" button and "Await Drawer Closed" page shown
And receipt display with following details
| text | Refund |
| item | R,${Product 3 Description},-${Product 3 Price} |
When user presses "Close" button on external "Cash Drawer" window
Then "Transaction Basket" page is shown
When user presses "SignOff" button
Then "Enter User" page is shown
- Your client properties file entries would be like,
COMPONENT_USER_NAME_TEXT=INPUT_TEXT_1
COMPONENT_PASSWORD_TEXT=INPUT_TEXT_2
COMPONENT_INPUT_BOX=InputBox
COMPONENT_SELECTION_LIST=SelectionList
WINDOW_REQUEST_GIFT_RECEIPT_TOTAL=Point-of-Sale Application:Point-of-Sale Application:Gift Receipt At Total Pos/GiftReceipt/RequestGiftReceiptAtTotal GiftReceiptAtTotal Pos/GiftReceipt/GiftReceiptAtTotal
WINDOW_SELECT_TENDER=Point-of-Sale Application:Point-of-Sale Application:Select Tender Pos/Tender/DoTender SelectTender NextGen1024x768/Pos/Tender/SelectTender
WINDOW_ENTER_CASH_TENDER_AMOUNT=Point-of-Sale Application:Point-of-Sale Application:Enter Tender Amount Pos/Tender/GetTenderAmountMain EnterTenderAmountWithSuggestions Pos/Tender/EnterCashTenderAmount
WINDOW_AWAIT_DRAWER_CLOSED=Point-of-Sale Application:Point-of-Sale Application:Wait Drawer Closed Pos/Transaction/AwaitDrawerClosed AwaitDrawerClosed Pos/Transaction/AwaitDrawerClosed
WINDOW_PRIMARY_PRINTER=PrimaryPrinter
WINDOW_CASH_DRAWER=Cashdrawer
WINDOW_ENTER_USER=Point-of-Sale Application:Point-of-Sale Application:Enter User Pos/SignOn/SignOn EnterUserState NextGen1024x768/Pos/SignOn/EnterUser
WINDOW_ENTER_ORIGINAL_TRANSACTION_ID=Point-of-Sale Application: Pos/Transaction/GetRetailArchiveTransaction GetOriginalTransactionID Pos/Transaction/EnterOriginalTransactionID
WINDOW_DISPLAY_TRANSACTION_WITH_MSG_CONFIG=Point-of-Sale Application:Point-of-Sale Application:Display Transaction Pos/Print/DisplayAndPrintTransaction DisplayTransactionWithMSGConfig Pos/Transaction/DisplayTransaction
WINDOW_EXTENDED_RETURN_DETAILS=Point-of-Sale Application:Point-of-Sale Application:Select Extended Return Details Pos/Return/HandleReceiptReturnItemSelection SelectReturnItems Pos/Return/SelectExtendedReturnDetails
WINDOW_CONFIRM_RETURN_COMPLETE_RECEIPT=\ Pos/Return/HandleReceiptReturnItemSelection ConfirmReturnCompleteReceipt NextGen1024x768/Message/NonModalOKCancel
WINDOW_SELECT_REASON=Point-of-Sale Application: Pos/Reason/SelectReasonCode SelectReasonCode Pos/Reason/SelectReason
WINDOW_RETURN_SLIP_MESSAGE=Point-of-Sale Application: Pos/Product/ProductReturnDataCapture OfferProductReturnSlip Message/ModalYesNo
WINDOW_TRANSACTION_BASKET=Point-of-Sale Application:Point-of-Sale Application:Sale Pos/Sale/Sale SignedOnState NextGen1024x768/Pos/Sale/Sale
WINDOW_REFUND_ITEM=Point-of-Sale Application:Point-of-Sale Application:Select Refund Pos/Tender/DoTender SelectRefund NextGen1024x768/Pos/Tender/SelectRefund
WINDOW_ENTER_CASH_TENDER_AMOUNT=Point-of-Sale Application:Point-of-Sale Application:Enter Tender Amount Pos/Tender/GetTenderAmountMain EnterTenderAmountWithSuggestions Pos/Tender/EnterCashTenderAmount
WINDOW_TRANSACTION_SIGNATURE_VERIFICATION=Point-of-Sale Application:Point-of-Sale Application:Signature Verification Pos/Print/PrintSignatureSlips GetCustomerSignature Pos/Transaction/GetSignatureVerification
WINDOW_AWAIT_DRAWER_CLOSED=Point-of-Sale Application:Point-of-Sale Application:Wait Drawer Closed Pos/Transaction/AwaitDrawerClosed AwaitDrawerClosed Pos/Transaction/AwaitDrawerClosed
- Your data properties file entries would be like,
PRODUCT_2=2
PRODUCT_2_DESCRIPTION=HD Complexion Starter Kit
PRODUCT_2_PRICE=£10.00
PRODUCT_3=A-1
PRODUCT_3_DESCRIPTION=A-1
PRODUCT_3_PRICE=£5.00
SALES_ASSISTANT_USERNAME=1010
SALES_ASSISTANT_PASSWORD=1010