POS Automation - Perform a Sale with carrier bag and without carrier bag
Overview
This tutorial provides step-by-step guidance on automating the validation of a POS sale transaction with and without a carrier bag while changing the POS terminal properties in the same automated test, including switching the POS terminal within the same automation script.
What you will learn
How to use the following steps
Pre-requisites
-
Should have a POS Setup and Automation Workspace Setup
-
You should have a POS terminal Template with the carrier bag prompt enabled. The property should be fixed and the template should be broadcast to POS before running the test. (For more details you can refer Setting Up POS terminal templates)
Exercises
Add Automation Script File
Right click on the Automated Tests project and create a new package in the test folder, feature.retail.pos.posRetailFunction.sales
Make sure your package is registered in the testNG.xml
Right click on the package and create a new cucumber test ItemSale.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 login, 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_2_DESCRIPTION=HD Complexion Starter Kit
- Using the component Inspection find the Component ID for the Receipt List. (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_RECEIPT=Receipt
- When you press the buttons to continue the 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).
- "Select Tender" page
- "Enter Cash Tender Amount" page
- "Await Drawer Closed" page
- External "Cash Drawer" window
- "Transaction Basket" page
- "Enter User" page
-
After that, set the created POS Terminal Template ID (as described under the prerequisite) for the current POS Terminal. (Refer Set a different template for the POS Terminal for more details.)
-
After that sign on as a given user. Refer Login as a user
-
Then, you can enter the productID. (Refer Component Inspection).
- When you press the buttons to continue the 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).
- "Carrrier Bag Prompt" page
- "Select Tender" page
- "Enter Cash Tender Amount" page
- "Await Drawer Closed" page
- External "Cash Drawer" window
- "Transaction Basket" page
- "Enter User" page
- Finally, Your feature file would be like ,
Scenario: Perform a Sale with carrier bag and without carrier bag
Given user signs on as "Sales Assistant"
And user enters "${Product 2}" into "Input Box" field
And user presses "ENT" button
And "${Product 2 Description}" is displayed in "Receipt" list
When user presses "TOTAL" button and "Select Tender" page shown
And user presses "Cash" button and "Enter Cash Tender Amount" page shown
And user presses "OK" button and "Await Drawer Closed" page shown
And receipt display with following details
| address | ${Street 1},${Street 2},${Town},${County},${Postcode} |
| telephone | Tel: ${Store Phone 1} |
| item | ${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
When template "AUT_RETAIL_FIXED_POS_TEMPLATE" is set for the current POS terminal
Given user signs on as "Sales Assistant"
And user enters "${Product 2}" into "Input Box" field
And user presses "ENT" button
And "${Product 2 Description}" is displayed in "Receipt" list
When user presses "TOTAL" button
Then "Carrrier Bag Prompt" page is shown
And user enters "1" into "Carrier Bag Input Box" field
Given user presses "Carrier Bag Continue Button" icon button
Then "Select Tender" page is shown
And user presses "Cash" button and "Enter Cash Tender Amount" page shown
And user presses "OK" button and "Await Drawer Closed" page shown
And receipt display with following details
| address | ${Street 1},${Street 2},${Town},${County},${Postcode} |
| telephone | Tel: ${Store Phone 1} |
| item | ${Product 2 Description},${Product 2 Price} |
| item | ${Product Carrier Bag 1 Description} |
| item | ${Product Carrier Bag 1 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_INPUT_BOX=InputBox
COMPONENT_RECEIPT=Receipt
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_CASH_DRAWER=Cashdrawer
WINDOW_TRANSACTION_BASKET=Point-of-Sale Application:Point-of-Sale Application:Sale Pos/Sale/Sale SignedOnState NextGen1024x768/Pos/Sale/Sale
WINDOW_ENTER_USER=Point-of-Sale Application:Point-of-Sale Application:Enter User Pos/SignOn/SignOn EnterUserState NextGen1024x768/Pos/SignOn/EnterUser
WINDOW_CARRRIER_BAG_PROMPT=\ Pos/CarrierBag/SellCarrierBag CarrierBagPrompt NextGen1024x768/Pos/CarrierBag/PopUpModalCarrierBag
COMPONENT_CARRIER_BAG_INPUT_BOX=BORDER_PANEL.Panel.INPUT_TEXT_BAGS_NUMBER
COMPONENT_CARRIER_BAG_CONTINUE_BUTTON=BORDER_PANEL.BUTTON_PANEL.EnterButton
- Your data properties file entries would be like,
PRODUCT_2=2
PRODUCT_2_DESCRIPTION=HD Complexion Starter Kit
STREET_1=Enactor House
STREET_2=1 Bluecoats
TOWN=Hertford
COUNTY=Hertfordshire
POSTCODE=SG14 1PB
STORE_PHONE_1=01992 500881
PRODUCT_CARRIER_BAG_1=CB1
PRODUCT_CARRIER_BAG_1_DESCRIPTION=Carrier Bag 1
PRODUCT_CARRIER_BAG_1_PRICE= 2.00
SALES_ASSISTANT_USERNAME=1010
SALES_ASSISTANT_PASSWORD=1010