Pos Automation - Validate Transaction Discount
Overview
This tutorial will provides step-by-step guidance on automating the feature of Transaction Discount.
We will be performing a Transaction Discount Percentage on a product by Capturing the Name and Address of a Customer and complete transaction in Cash tender
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.transactionDiscount
Make sure your package is registered in the testNG.xml
Right click on the package and create a new cucumber test TransactionDiscount.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_1=1
PRODUCT_1_DESCRIPTION=KAT VON D Eye Liner
PRODUCT_1_PRICE=£18.00
PRODUCT_2=2
PRODUCT_2_DESCRIPTION=HD Complexion Starter Kit
PRODUCT_2_PRICE=£10.00
- You can also define the customer data entries to data property file in order to use them as variables.
your entries would be like
CUSTOMER_1_NAME=Mark
CUSTOMER_1_SURNAME=Harrison
CUSTOMER_1_ORGANISATION=Enactor
CUSTOMER_1_TITLE=Mr
CUSTOMER_1_INITIALS=A
CUSTOMER_1_SEX=Male
CUSTOMER_1_DOB=28/08/79
CUSTOMER_1_ADDRESS_ORGANISATION=Enactor
CUSTOMER_1_ADDRESS_LINE1=1 Enactor House
CUSTOMER_1_ADDRESS_LINE2=Bluecoats Avenue
CUSTOMER_1_ADDRESS_LINE3=Hertford1
CUSTOMER_1_ADDRESS_TOWN=Hertford
CUSTOMER_1_ADDRESS_COUNTY=Hertfordshire
CUSTOMER_1_ADDRESS_COUNTRY=UK
CUSTOMER_1_ADDRESS_POSTCODE=SG141PB
CUSTOMER_1_CONTACT_EMAIL=demo@enactor.co.uk
CUSTOMER_1_CONTACT_PHONE1_NO=01295768256
CUSTOMER_1_CONTACT_PHONE2_NO=01295768253
CUSTOMER_1_CONTACT_MOBILE_PHONE_NO=00775316921
CUSTOMER_1_CONTACT_FAX_NO=01295768254
-
Using the component Inspection find the Component IDs for the fllowing Customer data input fields. (Refer Component Inspection).
-
Add the component entries to
.properties
file ( Refer Component Details to set up Client Property file).
- In Capture Customer Name Page
2.. In Capture Customer Address Page
- In Capture Customer Phone and Email Page
your entries would be like
COMPONENT_CUSTOMER_FORENAME_TEXT=DialogPanel.TABLE_1.ROW:1.CELL:2.ITEM:0.ForenameField
COMPONENT_CUSTOMER_SURNAME_TEXT=DialogPanel.TABLE_1.ROW:2.CELL:2.ITEM:0.SurnameField
COMPONENT_CUSTOMER_ORGANISATION_TEXT=DialogPanel.TABLE_1.ROW:3.CELL:2.ITEM:0.OrganisationField
COMPONENT_CUSTOMER_TITLE_DROPDOWN=DialogPanel.TABLE_1.ROW:4.CELL:2.ITEM:0.ComboFieldTitle
COMPONENT_CUSTOMER_INITIALS_TEXT=DialogPanel.TABLE_1.ROW:5.CELL:2.ITEM:0.InitialsField
COMPONENT_CUSTOMER_SEX_DROPDOWN=DialogPanel.TABLE_1.ROW:6.CELL:2.ITEM:0.SexField
COMPONENT_CUSTOMER_DATE_OF_BIRTH_TEXT=DialogPanel.TABLE_1.ROW:7.CELL:2.ITEM:0.DateOfBirthField
COMPONENT_CUSTOMER_ADDRESS_ORGANISATION_TEXT=DialogPanel.TABLE_1.ROW:1.CELL:2.ITEM:0.OrganisationField
COMPONENT_CUSTOMER_ADDRESS_LINE1_TEXT=DialogPanel.TABLE_1.ROW:2.CELL:2.ITEM:0.AddressLine1Field
COMPONENT_CUSTOMER_ADDRESS_LINE2_TEXT=DialogPanel.TABLE_1.ROW:3.CELL:2.ITEM:0.AddressLine2Field
COMPONENT_CUSTOMER_ADDRESS_LINE3_TEXT=DialogPanel.TABLE_1.ROW:4.CELL:2.ITEM:0.AddressLine3Field
COMPONENT_CUSTOMER_TOWN_TEXT=DialogPanel.TABLE_1.ROW:5.CELL:2.ITEM:0.TownField
COMPONENT_CUSTOMER_COUNTY_TEXT=DialogPanel.TABLE_1.ROW:6.CELL:2.ITEM:0.CountyField
COMPONENT_CUSTOMER_COUNTRY_DROPDOWN=DialogPanel.TABLE_1.ROW:7.CELL:2.ITEM:0.CountryField
COMPONENT_CUSTOMER_ADDRESS_COUNTRY_DROPDOWN=DialogPanel.TABLE_1.ROW:8.CELL:2.ITEM:0.CountryField
COMPONENT_CUSTOMER_POSTCODE_FIELD=DialogPanel.TABLE_1.ROW:9.CELL:2.ITEM:0.PostCodeField
COMPONENT_CUSTOMER_PHONE1_TEXT=DialogPanel.TABLE_1.ROW:1.CELL:2.ITEM:0.Phone1Field
COMPONENT_CUSTOMER_PHONE2_TEXT=DialogPanel.TABLE_1.ROW:2.CELL:2.ITEM:0.Phone2Field
COMPONENT_CUSTOMER_MOBILE_TEXT=DialogPanel.TABLE_1.ROW:3.CELL:2.ITEM:0.MobilePhoneField
COMPONENT_CUSTOMER_FAX_TEXT=DialogPanel.TABLE_1.ROW:4.CELL:2.ITEM:0.FaxField
COMPONENT_CUSTOMER_EMAIL_TEXT_OPTIONAL=DialogPanel.TABLE_1.ROW:6.CELL:2.ITEM:0.OptionalEmailField
COMPONENT_CUSTOMER_INTERNAL_MARKETING_CHECK_BOX=DialogPanel.TABLE_1.ROW:7.CELL:2.ITEM:0.InternalMarketingField
COMPONENT_CUSTOMER_EXTERNAL_MARKETING_CHECK_BOX=DialogPanel.TABLE_1.ROW:8.CELL:2.ITEM:0.ExternalMarketingField
- Using the component Inspection find the Component ID for the "Reason Selection List" (Refer Component Inspection).
your entry would be like
COMPONENT_SELECTION_LIST=SelectionList
- When you press the buttons to continue the Transaction Discount, you will be navigated to the following pages. Therefore the following Window names should be inspected and add the window entries to
.properties
file ( Refer Window Details to set up Client Property file).
-
"Transaction Basket" page shown
-
"Select Reason" page
-
"Capture Customer Name" page
-
"Capture Customer Address" page
-
"Capture Customer Phone Email" page
-
"Select Tender" page shown
-
"Enter Cash Tender Amount" page
-
"Await Drawer Closed" page
-
External "Cash Drawer" window
-
"Enter User" page
When updated the client property file,
your entries would be like
WINDOW_TRANSACTION_BASKET=Point-of-Sale Application:Point-of-Sale Application:Sale Pos/Sale/Sale SignedOnState NextGen1024x768/Pos/Sale/Sale
WINDOW_SELECT_REASON=Point-of-Sale Application: Pos/Reason/SelectReasonCode SelectReasonCode Pos/Reason/SelectReason
WINDOW_CAPTURE_CUSTOMER_NAME=Point-of-Sale Application: NextGen/Pos/Name/CaptureName NameValidatingForm Pos/Name/NamePrompt
WINDOW_CAPTURE_CUSTOMER_ADDRESS=Point-of-Sale Application: Pos/Address/CaptureAddress AddressPrompt Pos/Address/AddressPrompt
WINDOW_CAPTURE_CUSTOMER_PHONE_EMAIL=Point-of-Sale Application: Pos/Address/CapturePhoneAndEmail PromptForPhoneAndEmailForm Pos/Address/PhoneAndEmailPrompt
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_ENTER_USER=Point-of-Sale Application:Point-of-Sale Application:Enter User Pos/SignOn/SignOn EnterUserState NextGen1024x768/Pos/SignOn/EnterUser
-
To check selecting a checkbox feature refer Checkbox Selection
-
Finally, Your feature file would be like ,
Scenario: Perform a Transaction Discount Percentage with Capture Name and Address and complete transaction in Cash tender
Given user signs on as "Sales Assistant"
When user enters "${Product 1}" into "Input Box" field
And user presses "ENT" button
Then "Transaction Basket" page is shown
When user enters "${Product 2}" into "Input Box" field
And user presses "ENT" button
Then "Transaction Basket" page is shown
And user presses "Discount / Overrides" button
And user presses "Transaction Discount" button
Then "Select Reason" page is shown
When user selects "15% Trans. Disc. with Name & Address" from "Selection List" list
And user presses "OK" button
Then "Capture Customer Name" page is shown
When user enters "${Customer 1 Name}" into "Customer Forename Text" field
And user enters "${Customer 1 SurName}" into "Customer SurName Text" field
And user enters "${Customer 1 Organisation}" into "Customer Organisation Text" field
And user selects "${Customer 1 Title}" from "Customer Title DropDown" combobox
And user enters "${Customer 1 Initials}" into "Customer Initials Text" field
And user selects "${Customer 1 Sex}" from "Customer Sex DropDown" combobox
And user enters "${Customer 1 DOB}" into "Customer Date Of Birth Text" field
And user presses "OK" button
Then "Capture Customer Address" page is shown
When user enters "${Customer 1 Address Organisation}" into "Customer Address Organisation Text" field
And user enters "${Customer 1 Address Line1}" into "Customer Address Line1 Text" field
And user enters "${Customer 1 Address Line2}" into "Customer Address Line2 Text" field
And user enters "${Customer 1 Address Line3}" into "Customer Address Line3 Text" field
And user enters "${Customer 1 Address Town}" into "Customer Town Text" field
And user enters "${Customer 1 Address County}" into "Customer County Text" field
And user selects "United Kingdom" from "Customer Address Country DropDown" combobox
And user enters "${Customer 1 Address Postcode}" into "Customer Postcode Field" field
And user presses "OK" button
Then "Capture Customer Phone Email" page is shown
When user enters "${Customer 1 Contact Phone1 No}" into "Customer Phone1 Text" field
And user enters "${Customer 1 Contact Phone2 No}" into "Customer Phone2 Text" field
And user enters "${Customer 1 Contact Mobile Phone No}" into "Customer Mobile Text" field
And user enters "${Customer 1 Contact Fax No}" into "Customer Fax Text" field
And user enters "${Customer 1 Contact Email}" into "Customer Email Text Optional" field
And user presses "Customer Internal Marketing Check Box" checkbox
And user presses "Customer External Marketing Check Box" checkbox
And user presses "OK" button
Then "Transaction Basket" page is shown
And "Customer: Mr Mark Harrison" is displayed in "Receipt" list
And "Address: 1 Enactor House Bluecoats Avenue Hertford1 Hertford SG141PB" is displayed in "Receipt" list
And "Transaction Discount (15% Trans. Disc. with Name & Address 15%)" 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
| text | Customer: Mark Harrison |
| item | Address: 1 Enactor House Bluecoats Avenue Hertford1 Hertford SG141PB United Kingdom|
| text | Tel: 01295768256 |
| text | Mob: 00775316921 |
| item | ${Product 1 Description},${Product 1 Price} |
| item | ${Product 2 Description},${Product 2 Price} |
| item | Discount (15% Trans. Disc. with Name & Address),-£4.20 |
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_SELECTION_LIST=SelectionList
COMPONENT_CUSTOMER_FORENAME_TEXT=DialogPanel.TABLE_1.ROW:1.CELL:2.ITEM:0.ForenameField
COMPONENT_CUSTOMER_SURNAME_TEXT=DialogPanel.TABLE_1.ROW:2.CELL:2.ITEM:0.SurnameField
COMPONENT_CUSTOMER_ORGANISATION_TEXT=DialogPanel.TABLE_1.ROW:3.CELL:2.ITEM:0.OrganisationField
COMPONENT_CUSTOMER_TITLE_DROPDOWN=DialogPanel.TABLE_1.ROW:4.CELL:2.ITEM:0.ComboFieldTitle
COMPONENT_CUSTOMER_INITIALS_TEXT=DialogPanel.TABLE_1.ROW:5.CELL:2.ITEM:0.InitialsField
COMPONENT_CUSTOMER_SEX_DROPDOWN=DialogPanel.TABLE_1.ROW:6.CELL:2.ITEM:0.SexField
COMPONENT_CUSTOMER_DATE_OF_BIRTH_TEXT=DialogPanel.TABLE_1.ROW:7.CELL:2.ITEM:0.DateOfBirthField
COMPONENT_CUSTOMER_ADDRESS_ORGANISATION_TEXT=DialogPanel.TABLE_1.ROW:1.CELL:2.ITEM:0.OrganisationField
COMPONENT_CUSTOMER_ADDRESS_LINE1_TEXT=DialogPanel.TABLE_1.ROW:2.CELL:2.ITEM:0.AddressLine1Field
COMPONENT_CUSTOMER_ADDRESS_LINE2_TEXT=DialogPanel.TABLE_1.ROW:3.CELL:2.ITEM:0.AddressLine2Field
COMPONENT_CUSTOMER_ADDRESS_LINE3_TEXT=DialogPanel.TABLE_1.ROW:4.CELL:2.ITEM:0.AddressLine3Field
COMPONENT_CUSTOMER_TOWN_TEXT=DialogPanel.TABLE_1.ROW:5.CELL:2.ITEM:0.TownField
COMPONENT_CUSTOMER_COUNTY_TEXT=DialogPanel.TABLE_1.ROW:6.CELL:2.ITEM:0.CountyField
COMPONENT_CUSTOMER_COUNTRY_DROPDOWN=DialogPanel.TABLE_1.ROW:7.CELL:2.ITEM:0.CountryField
COMPONENT_CUSTOMER_ADDRESS_COUNTRY_DROPDOWN=DialogPanel.TABLE_1.ROW:8.CELL:2.ITEM:0.CountryField
COMPONENT_CUSTOMER_POSTCODE_FIELD=DialogPanel.TABLE_1.ROW:9.CELL:2.ITEM:0.PostCodeField
COMPONENT_CUSTOMER_PHONE1_TEXT=DialogPanel.TABLE_1.ROW:1.CELL:2.ITEM:0.Phone1Field
COMPONENT_CUSTOMER_PHONE2_TEXT=DialogPanel.TABLE_1.ROW:2.CELL:2.ITEM:0.Phone2Field
COMPONENT_CUSTOMER_MOBILE_TEXT=DialogPanel.TABLE_1.ROW:3.CELL:2.ITEM:0.MobilePhoneField
COMPONENT_CUSTOMER_FAX_TEXT=DialogPanel.TABLE_1.ROW:4.CELL:2.ITEM:0.FaxField
COMPONENT_CUSTOMER_EMAIL_TEXT_OPTIONAL=DialogPanel.TABLE_1.ROW:6.CELL:2.ITEM:0.OptionalEmailField
COMPONENT_CUSTOMER_INTERNAL_MARKETING_CHECK_BOX=DialogPanel.TABLE_1.ROW:7.CELL:2.ITEM:0.InternalMarketingField
COMPONENT_CUSTOMER_EXTERNAL_MARKETING_CHECK_BOX=DialogPanel.TABLE_1.ROW:8.CELL:2.ITEM:0.ExternalMarketingField
WINDOW_TRANSACTION_BASKET=Point-of-Sale Application:Point-of-Sale Application:Sale Pos/Sale/Sale SignedOnState NextGen1024x768/Pos/Sale/Sale
WINDOW_SELECT_REASON=Point-of-Sale Application: Pos/Reason/SelectReasonCode SelectReasonCode Pos/Reason/SelectReason
WINDOW_CAPTURE_CUSTOMER_NAME=Point-of-Sale Application: NextGen/Pos/Name/CaptureName NameValidatingForm Pos/Name/NamePrompt
WINDOW_CAPTURE_CUSTOMER_ADDRESS=Point-of-Sale Application: Pos/Address/CaptureAddress AddressPrompt Pos/Address/AddressPrompt
WINDOW_CAPTURE_CUSTOMER_PHONE_EMAIL=Point-of-Sale Application: Pos/Address/CapturePhoneAndEmail PromptForPhoneAndEmailForm Pos/Address/PhoneAndEmailPrompt
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_ENTER_USER=Point-of-Sale Application:Point-of-Sale Application:Enter User Pos/SignOn/SignOn EnterUserState NextGen1024x768/Pos/SignOn/EnterUser
- Your data properties file entries would be like,
PRODUCT_1=1
PRODUCT_1_DESCRIPTION=KAT VON D Eye Liner
PRODUCT_1_PRICE=£18.00
PRODUCT_2=2
PRODUCT_2_DESCRIPTION=HD Complexion Starter Kit
PRODUCT_2_PRICE=£10.00
CUSTOMER_1_NAME=Mark
CUSTOMER_1_SURNAME=Harrison
CUSTOMER_1_ORGANISATION=Enactor
CUSTOMER_1_TITLE=Mr
CUSTOMER_1_INITIALS=A
CUSTOMER_1_SEX=Male
CUSTOMER_1_DOB=28/08/79
CUSTOMER_1_ADDRESS_ORGANISATION=Enactor
CUSTOMER_1_ADDRESS_LINE1=1 Enactor House
CUSTOMER_1_ADDRESS_LINE2=Bluecoats Avenue
CUSTOMER_1_ADDRESS_LINE3=Hertford1
CUSTOMER_1_ADDRESS_TOWN=Hertford
CUSTOMER_1_ADDRESS_COUNTY=Hertfordshire
CUSTOMER_1_ADDRESS_COUNTRY=UK
CUSTOMER_1_ADDRESS_POSTCODE=SG141PB
CUSTOMER_1_CONTACT_EMAIL=demo@enactor.co.uk
CUSTOMER_1_CONTACT_PHONE1_NO=01295768256
CUSTOMER_1_CONTACT_PHONE2_NO=01295768253
CUSTOMER_1_CONTACT_MOBILE_PHONE_NO=00775316921
CUSTOMER_1_CONTACT_FAX_NO=01295768254
SALES_ASSISTANT_USERNAME=1010
SALES_ASSISTANT_PASSWORD=1010