def add(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('TC add loyalty number') print(str(l_test_settings)) for test_data in l_test_settings: general_functions.start_of_test_case('TC add loyalty number ' + test_data[5]) general_functions.fill_basket(test_data[0], test_data[1]) general_buttons.main_page_footer_menu_btns_click('CUSTOMER') # click ENTER LOYALTY NUMBER button general_buttons.main_page_customer_menu_btns_click( 'ENTER LOYALTY NUMBER') type(test_data[2]) type(Key.ENTER) wait(1) type(Key.ENTER) wait(2) # click ENTER VOUCHER NUMBER button general_buttons.main_page_customer_menu_btns_click( 'ENTER VOUCHER NUMBER') type(test_data[3]) type(Key.ENTER) wait(1) type(Key.ENTER) wait(2) general_functions.extended_wait('payment_page_key_pad_TOTAL', 30) general_buttons.main_page_key_pad_btns_click('TOTAL') general_functions.extended_wait('payment_page_key_pad', 30) general_functions.pay_transaction_with_multiple_tenders(test_data[4]) # general end of test case general_functions.end_of_test_case()
def remove(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('TC remove loyalty number') y = l_test_settings[0] general_functions.fill_basket(str(y[0]), y[1]) general_buttons.main_page_footer_menu_btns_click('CUSTOMER') # click ENTER LOYALTY NUMBER button general_buttons.main_page_customer_menu_btns_click('ENTER LOYALTY NUMBER') type(y[2]) type(Key.ENTER) wait(1) type(Key.ENTER) wait(2) # click ENTER VOUCHER NUMBER button general_buttons.main_page_customer_menu_btns_click('ENTER VOUCHER NUMBER') type(y[3]) type(Key.ENTER) wait(1) type(Key.ENTER) wait(2) general_functions.extended_wait('payment_page_key_pad_TOTAL', 30) general_buttons.main_page_key_pad_btns_click('TOTAL') type(Key.ENTER) wait(2) # remove loyalty general_buttons.main_page_footer_menu_btns_click('CUSTOMER') general_buttons.main_page_customer_menu_btns_click('REMOVE LOYALTY') type(Key.ENTER) general_functions.pay_transaction_with_multiple_tenders(y[4]) general_functions.end_of_test_case()
def cancel_receipt(): general_functions.errorhandling("ABORT") l_test_settings = test_settings.void_tender_type_settings(locale) l_general_test_settings = test_settings.general_test_settings() x = 0 while x < len(l_test_settings): y = l_test_settings[x] print("y: " + str(y)) general_functions.fill_basket(y[0], y[1]) if y[5]== 1: # cancel before the total button is clicked general_buttons.click_element('secondary_pages_key_pad', 190, -100, 'CANCEL btn') else: # click TOTAL button general_buttons.click_element('secondary_pages_key_pad', 100, 100, 'TOTAL btn') receipt_meta_data_array = general_functions.get_receipt_meta_data() general_buttons.click_element('secondary_pages_key_pad_after_TOTAL', 190, -100, 'CANCEL TRANSACTION btn') general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) test_cases.errors_and_warnings_tc_0030("does the cancellation warning pop up") # confirm cancelation type(Key.ENTER) # use all cancelation reasons y_coordinaat = (160 + (x * 50)) * -1 print("y_coordinaat: " + str(y_coordinaat)) general_buttons.click_element('cancelation_reasons', 0, y_coordinaat, 'CANCEL REASON btn') # confirm reason type(Key.ENTER) x = x + 1 print("x: " + str(x)) if x == 3: break
def basic_sale_off_line_card(): general_functions.errorhandling("ABORT") l_general_test_settings = test_settings.general_test_settings() locale = l_general_test_settings[8] l_test_settings = test_settings.global_blue_transactions(locale) general_functions.errorhandling("ABORT") general_functions.start_of_test_case('basic sale paid with ' + y[2]) wait(1) general_functions.fill_basket(y[0], y[1]) general_buttons.main_page_key_pad_btns_click('TOTAL') general_buttons.payment_page_other_menu_btns_click('ISSUE TAX FREE') type(Key.ENTER) general_functions.extended_wait('payment_page_key_pad', 30) general_functions.pay_transaction_with_multiple_tenders([y[2], 'REST']])
def local_employee_discount_remove_transaction_discount(settings_index): general_functions.errorhandling("ABORT") general_functions.start_of_test_case( 'employee discount remove transaction discount') general_functions.extended_wait("main_page_key_pad", 300) settings_for_this_test = l_test_settings[settings_index] general_functions.fill_basket(settings_for_this_test[0], settings_for_this_test[1]) general_buttons.basket_page_footer_menu_btns_click('DISCOUNTS') add_employee(settings_for_this_test) # add employee data general_buttons.basket_page_employee_discounts_menu_btns_click( 'EMPLOYEE TRANSACTION DISCOUNT') general_buttons.basket_page_employee_percentage_discounts_menu_btns_click( settings_for_this_test[5]) general_buttons.basket_page_footer_menu_btns_click('DISCOUNTS') general_buttons.basket_page_employee_discounts_menu_btns_click( 'REMOVE TRANSACTION DISCOUNT') type(Key.ENTER) # type(Key.ENTER) # test_cases.does_part_of_screen_exist('discount_is_removed_but_the_employee_isnt', 0.7, 'is the line item discount removed and is the employee still there') # click TOTAL button general_buttons.main_page_key_pad_btns_click('TOTAL') wait(5) general_functions.extended_wait('payment_page_key_pad', 30) general_functions.pay_transaction_with_tender([['tender', 'MAESTRO']]) type(Key.ENTER) general_functions.end_of_test_case()
def void_line_item(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('void line item') wait(1) general_functions.fill_basket(l_test_settings[0], l_test_settings[1]) time.sleep(5) print("VOID LINE ITEM") # void line item general_buttons.click_element('add_or_substract_product', -100, 0, 'PLUS or MINUS btn') time.sleep(5) #test_cases.void_line_item_tc_0010('is the line item voided ') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('is_the_line_item_voided') general_buttons.main_page_key_pad_btns_click('TOTAL') general_functions.extended_wait('payment_page_key_pad', 30) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('payment_screen') general_functions.pay_transaction_with_multiple_tenders(l_test_settings[2]) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('main_page') general_functions.end_of_test_case()
def local_employee_discount_remove_employee(settings_index): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('employee discount remove employee') general_functions.extended_wait("main_page_key_pad", 300) settings_for_this_test = l_test_settings[settings_index] general_functions.fill_basket(settings_for_this_test[0], settings_for_this_test[1]) general_buttons.basket_page_footer_menu_btns_click('DISCOUNTS') add_employee(settings_for_this_test) # add employee data general_buttons.basket_page_employee_discounts_menu_btns_click( 'EMPLOYEE ITEM DISCOUNT') general_buttons.basket_page_employee_percentage_discounts_menu_btns_click( settings_for_this_test[5]) general_buttons.basket_page_footer_menu_btns_click('DISCOUNTS') general_buttons.basket_page_employee_discounts_menu_btns_click( 'REMOVE EMPLOYEE') type(Key.ENTER) # test_cases.does_part_of_screen_exist('employee_and_discount_are_removed', 0.7, 'are employee and discount removed') # click TOTAL button general_buttons.main_page_key_pad_btns_click('TOTAL') wait(5) general_functions.extended_wait('payment_page_key_pad', 30) general_functions.pay_transaction_with_multiple_tenders( [['WECHAT', 'REST']]) general_functions.end_of_test_case()
def issue_tax_form_basic_sale_any_tender(): y = l_test_settings[0] general_functions.errorhandling("ABORT") general_functions.start_of_test_case( 'Issue tax form on basic sale paid with ' + str('card AMEX, paying exact amount.')) # fil basket and press total button wait(0.1) general_functions.fill_basket(y[0], y[1]) #wait(0.1) general_buttons.main_page_key_pad_btns_click('TOTAL') # select the Other button to go to Issue tax form button wait(0.1) general_buttons.payment_page_footer_menu_btns_click('OTHER') # select the Issue tax form button #wait(0.1) general_buttons.payment_page_other_menu_btns_click('ISSUE TAX FREE') # 'Verify steps after this point ', 'are ok now.' #general_functions.show_value__msg('Tax free form requested', 'Global Blue form pulled up to be ready') wait(0.5) general_functions.extended_wait('payment_page_key_pad', 30) #wait(0.1) general_functions.get_receipt_meta_data() wait(1) general_functions.pay_transaction_with_multiple_tenders([['AMEX', 'REST']]) # select the OK button to show the Issue tax form wait(1) click(Location(810, 584)) wait(1) general_functions.extended_wait('TFF', 30) # Enter at least mandatory fields: country and tender # 'Verify steps after this point ', 'are ok now.' #general_functions.show_value__msg('Verify steps after this point ', 'are ok now.') # mandatory field1: select a country # click area #DE#click(Location(200, 490)) #BE# click(Location(200, 470)) type('1') type(Key.DOWN) type(Key.ENTER) # mandatory field2: select a tender # click area #DE#click(Location(535, 235)) #BE# click(Location(580, 220)) type('4') type(Key.DOWN) type(Key.ENTER) # select the Yes button to submit the Issue tax form ## wait(1) ## type(Key.ALT + 'y') ## wait(16) # general end of test case general_functions.end_of_test_case()
def gv_sale(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('gift voucher sale and redemption') wait(10) general_buttons.main_page_footer_menu_btns_click('ITEMS GV') general_buttons.main_page_items_gv_menu_btns_click('GIFT VOUCHER SALE') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('sale_gift_voucher') type(l_test_settings[0]) type(Key.ENTER) general_functions.extended_wait("payment_page_key_pad_TOTAL", 300) general_buttons.main_page_key_pad_btns_click('TOTAL') general_functions.extended_wait("payment_page_key_pad", 300) # general_functions.pause_test_case_msg() receipt_meta_data_array = general_functions.get_receipt_meta_data() print('receipt_meta_data_array: ' + str(receipt_meta_data_array)) r = Region(165, 183, 221, 21) r.highlight(2) evaluation_string = r.text() print("evaluation str " + evaluation_string) evaluation_string = evaluation_string.replace("I", "1") print("evaluation str " + evaluation_string) evaluation_string = evaluation_string.replace("O", "0") print("evaluation str " + evaluation_string) evaluation_string = evaluation_string.replace("o", "0") print("evaluation str " + evaluation_string) evaluation_string = evaluation_string.replace("|", "1") print("evaluation str " + evaluation_string) evaluation_string = evaluation_string.replace("l", "1") print("evaluation str " + evaluation_string) evaluation_string = evaluation_string.replace(" ", "") print("evaluation str " + evaluation_string) evaluation_string = evaluation_string.replace("?", "9") print("evaluation str " + evaluation_string) gv_number = evaluation_string print("gv number " + gv_number) general_functions.writeTestResults("gift voucher number", "", gv_number, "", "", "", "", "") if brand == "CK": general_functions.general_message_with_subject( 'Check the GV number', 'The GV number we found is ' + gv_number + '. If this not the correct number please write the correct nunmber down on a piece of paper' ) general_functions.pay_transaction_with_multiple_tenders( [['CHINA UNION PAY', 'REST']]) general_functions.fill_basket(l_test_settings[2], l_test_settings[3]) general_buttons.main_page_key_pad_btns_click('TOTAL') general_functions.pay_transaction_with_multiple_tenders( [['GIFT VOUCHER', gv_number, 'REST']]) general_functions.end_of_test_case()
def cancel_receipt(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('TC cancel receipt all reasons') x = 0 while x < len(l_test_settings): y = l_test_settings[x] print("y: " + str(y)) # wait for the main screen to be there general_functions.extended_wait('main_page_key_pad', 30) general_functions.fill_basket(y[0], y[1]) if y[2] == 1: # cancel before the total button is clicked general_functions.start_of_test_case( 'cancel receipt before total button is clicked') receipt_meta_data_array = general_functions.get_receipt_meta_data() general_buttons.main_page_key_pad_btns_click('CANCEL') else: # cancel after the total button is clicked # click TOTAL button general_buttons.main_page_key_pad_btns_click('TOTAL') general_functions.start_of_test_case( 'cancel receipt after total button is clicked') receipt_meta_data_array = general_functions.get_receipt_meta_data() # this is actually the CANCEL TRANSACTION button but it's in the same location as the CANCEL button general_buttons.main_page_key_pad_btns_click('CANCEL') general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) #general_functions.general_message_with_subject('test', 'cancellation_warning') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('cancellation_warning') # confirm cancellation type(Key.ENTER) # short wait to get cancellation reason screen in focus wait(0.5) # use all cancelation reasons # general_functions.general_message_with_subject('test', 'cancellation_reasons') wait(5) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('cancellation_reasons') button_name = 'LIST ITEM ' + str(x + 1) print('cancel reason: ' + button_name) general_buttons.click_in_list(button_name) # confirm reason type(Key.ENTER) x = x + 1 print("x: " + str(x)) if x == 3: break # to return to the main screen wait(10) general_functions.end_of_test_case()
def manual_discount_tr(): general_functions.errorhandling("ABORT") general_functions.extended_wait("main_page_key_pad", 300) print('length: ' + str(len(l_test_settings))) x = 0 while x < len(l_test_settings): print('x: ' + str(x)) y = l_test_settings[x] print('y: ' + str(y)) # get article general_functions.fill_basket(y[0], y[1]) # click DISCOUNT buttons general_buttons.basket_page_footer_menu_btns_click('DISCOUNTS') # click ITEM DISCOUNT% button general_buttons.basket_page_discounts_menu_btns_click( 'TRANSACTION DISCOUNT TENDER') # enter discount discount = y[2] print('discount: ' + str(discount)) type(str(discount)) # confirm type(Key.ENTER) if x < 10: # first page with reasons # click discount reason general_buttons.return_reasons_click('return reason ' + str(x + 1)) print('return reason: ' + 'return reason ' + str(x + 1)) # confirm reason type(Key.ENTER) else: if x == 10: print("reason 11") type(Key.RIGHT) type(Key.ENTER) else: print("reason 12") type(Key.RIGHT) type(Key.DOWN) type(Key.ENTER) print("x: " + str(x)) # click TOTAL button general_buttons.main_page_key_pad_btns_click('TOTAL') general_functions.start_of_test_case('manual discount on transaction') wait(5) # general_functions.extended_wait('four_eyes_form', 60) general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) general_functions.extended_wait('payment_page_key_pad', 30) general_functions.pay_transaction_with_multiple_tenders( [['MAESTRO', 'REST']]) general_functions.end_of_test_case() x = x + 1 general_functions.end_of_test_case()