def bonus_buys(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('bonus buys') l_test_settings = test_settings.bonus_buys() 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]) general_buttons.main_page_key_pad_btns_click('TOTAL') general_functions.pay_transaction_with_multiple_tenders([['ALIPAY', 'REST']]) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('payment_screen') wait(1) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('main_page') x += 1 general_functions.end_of_test_case( )
def remove(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('remove promotion') general_functions.fill_basket(l_test_settings[0], l_test_settings[1]) wait(5) # select first line item Location(254, 214).click() general_buttons.basket_page_edit_line_item_click('REMOVE PROMOTION') general_buttons.item_editing_key_pad_btns_click('END EDITING') general_buttons.basket_page_key_pad_btns_click('TOTAL') receipt_meta_data_array = general_functions.get_receipt_meta_data() general_functions.pay_transaction_with_multiple_tenders([['VISA', 'REST']]) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('payment_screen') wait(1) # type(Key.ENTER) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('main_page') general_functions.end_of_test_case()
def line_items(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('commission sale line item') general_functions.fill_basket(l_test_settings[0], l_test_settings[1]) # select first line item Location(254, 214).click() general_buttons.main_page_key_pad_btns_click('SALES PERSON') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('sales_person_search') sleep(2) type(Key.ENTER) sleep(2) type(Key.ENTER) # general_functions.pause_test_case_msg() # select first line item Location(254, 214).click() general_buttons.main_page_key_pad_btns_click('SALES PERSON') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('select_sales_person') sleep(2) type(Key.ENTER) sleep(2) type(Key.DOWN) type(Key.ENTER) # general_functions.pause_test_case_msg() general_buttons.main_page_key_pad_btns_click('TOTAL') receipt_meta_data_array = general_functions.get_receipt_meta_data() if brand == 'TH': # TH has zalando as tender general_functions.pay_transaction_with_multiple_tenders( [['MAESTRO', 'REST']]) else: general_functions.pay_transaction_with_multiple_tenders( [['MAESTRO', 'REST']]) general_functions.end_of_test_case()
def get_receipt_for_gift_receipt(receipt_number): # go to the search form to select the receipt that needs to be printed as gift receipt wait(10) general_buttons.main_page_footer_menu_btns_click('OTHER') general_buttons.main_page_other_menu_btns_click('PRINT GIFT RECEIPT') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('search_receipt') # select receipt to print type(Key.ENTER) type(Key.ENTER) type(Key.ENTER) print('receipt_number: ' + str(receipt_number)) type(str(receipt_number)) type(Key.ENTER)
def returns_with_receipt_return_items(receipt_number): general_functions.errorhandling("ABORT") general_buttons.main_page_items_gv_menu_btns_click('RETURNS WITH RECEIPT') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('goods_return') wait(2) type(l_general_test_settings[1]) # store type(Key.ENTER) type(Key.ENTER) # date is today type(l_general_test_settings[7]) # till type(Key.ENTER) print(str(receipt_number)) type(str(receipt_number)) # receipt# type(Key.ENTER) # confirm receipt wait(5) click(Location(250, 210)) wait('return_reasons_' + locale + '.png', 30) general_buttons.click_in_list('LIST ITEM 1') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('goods_return') type(Key.ENTER) click(Location(250, 350)) wait('return_reasons_' + locale + '.png', 30) general_buttons.click_in_list('LIST ITEM 2') type(Key.ENTER) click(Location(250, 540)) wait('return_reasons_' + locale + '.png', 30) general_buttons.click_in_list('LIST ITEM 3') type(Key.ENTER) general_buttons.main_page_items_gv_menu_returns_with_receipt_btns_click( 'RETURN SELECTION')
def no_sale(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('no sale') wait(1) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('main_page') general_buttons.main_page_footer_menu_btns_click('OTHER') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('other_screen') general_buttons.main_page_other_menu_btns_click('NO SALE') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('open_drawer_select_reason') general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) type(Key.ENTER) wait(2) general_functions.close_drawer_msg() general_functions.end_of_test_case()
def drop_off(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('drop off') general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) time.sleep(6) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('drop_off') for x in range(0, l_general_test_settings[9]): time.sleep(0.5) number_of_items = l_test_settings type(str(number_of_items[x])) time.sleep(0.5) type(Key.ENTER) time.sleep(0.5) general_functions.writeTestResults("def drop_off", "GUI", "data", str(x), "", "number of denominations", "", "") x += 1 general_buttons.drop_off_page_click('TAKE OVER') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('drop_off_overview') type(Key.ENTER) general_functions.close_drawer_msg() # general end of test case general_functions.end_of_test_case()
def non_merchandise_sale(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('non merchandise sale all types') general_functions.extended_wait("main_page_key_pad", 300) print('length: ' + str(len(l_test_settings))) for transaction in l_test_settings: general_buttons.main_page_items_gv_menu_btns_click( 'NON MERCHANDISE SALE') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('non_merchandise_sale_footer') general_buttons.main_page_items_gv_menu_non_merchandise_sale_btns_click( transaction[0]) wait(0.5) # enter price type(str(transaction[1])) # confirm type(Key.ENTER) # click TOTAL button general_buttons.main_page_key_pad_btns_click('TOTAL') wait(2) general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) wait(2) general_functions.pay_transaction_with_multiple_tenders([['AMEX', 'REST']]) general_functions.end_of_test_case()
def four_eyes(user, password): errorhandling("ABORT") writeTestResults("def four_eyes", "GUI", "data", user, password, "", "", "") # general_message_with_subject('test', 'four_eyes_screen') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('four_eyes_screen') general_buttons.authorization_btns_click('USER') type(user) writeTestResults("def logon", "GUI", "data", user, "", "user was empty", "", "") general_buttons.authorization_btns_click('PASSWORD') type(password) writeTestResults("def logon", "GUI", "data", password, "", "password was empty", "", "") type(Key.ENTER)
def item_not_found(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case( 'TC item not found all divisions test ') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('main_page') time.sleep(5) if is_gui_test == 'YES': # for the GUI test 1 division is enough number_of_divisions = 1 else: number_of_divisions = l_test_settings[0] for div in range(0, number_of_divisions): general_buttons.main_page_items_gv_menu_btns_click('ITEM NOT FOUND') if div == 0: # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('item_not_found') division = "DIV " + str(div + 1) print('division: ' + str(division)) general_buttons.main_page_items_gv_menu_item_not_found_btns_click( division) type("123456789") type(Key.ENTER) amount = 50 + div type(str(amount) + ".00") type(Key.ENTER) # click the TOTAL button general_buttons.main_page_key_pad_btns_click('TOTAL') 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', 60) general_functions.pay_transaction_with_multiple_tenders(l_test_settings[1]) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('main_page') # general end of test case general_functions.end_of_test_case()
def gift_receipt_from_line_items(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('print gift receipt from line item') # make test receipt and get it to print it as a gift receipt get_receipt_for_gift_receipt( general_functions.make_test_receipts(l_test_settings[0], l_test_settings[1])) wait(10) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('print_gift_receipt') # select 2 items Location(254, 214).click() Location(241, 346).click() # print gift receipt general_buttons.gift_receipt_key_pad_btns_click('PRINT') # general end of test case general_functions.end_of_test_case()
def fill_basket(article, number_of_articles): errorhandling("ABORT") extended_wait('main_page_key_pad', 30) # click SEARCH ITEM button general_buttons.main_page_key_pad_btns_click('ITEM SEARCH') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('article_search_form') # move to next line on search form type(Key.ENTER) # article number type(str(article)) # click SEARCH button general_buttons.article_search_form_btns_click('SEARCH') wait(3) # add product(s) z = 0 print('number of products: ' + str(number_of_articles)) while z < number_of_articles - 1: general_buttons.click_element('add_or_substract_product', 100, 0, 'PLUS btn') z += 1 print('z: ' + str(z)) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('basket_with_5_products')
def returns_with_out_receipt_add_return_items(): x = 0 while x < 3: general_functions.extended_wait('main_page_key_pad', 30) general_buttons.main_page_items_gv_menu_btns_click( 'RETURNS NO RECEIPT') wait(2) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('returns_no_receipt') general_buttons.main_page_items_gv_menu_returns_no_receipt_btns_click( 'ITEM NOT FOUND') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('returns_no_receipt_item_not_found') general_buttons.main_page_items_gv_menu_item_not_found_btns_click( 'DIV ' + str(x + 1)) type('1234567890') type(Key.ENTER) price = (x + 1) * 11 type(str(price) + ',' + str(price)) type(Key.ENTER) general_functions.extended_wait('return_reasons', 30) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('cancellation_reasons') # general_buttons.click_element('return_reasons', -70, -30 + (45 * x), 'select return reason') general_buttons.click_in_list('LIST ITEM ' + str(x + 1)) type(Key.ENTER) x += 1 general_buttons.returns_page_key_pad_btns_click('END RETURNS')
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 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 pay_in(): general_functions.errorhandling("ABORT") general_functions.start_of_test_case('pay in') general_functions.extended_wait("main_page_key_pad", 300) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('main_page') for z in range(0, l_test_settings[0]): general_buttons.main_page_footer_menu_btns_click('OTHER') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('other_screen') general_buttons.main_page_other_menu_btns_click('PAY-IN') # four eyes authorization general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) # select pay_out reason print('list item: ' + 'LIST ITEM ' + str(z + 1)) general_buttons.click_in_list('LIST ITEM ' + str(z + 1)) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('pay_in_reasons') # confirm reason type(Key.ENTER) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('pay_in_total_amount_screen') # amount that's payed out type(str(z + 1) + '.00') # confirm amount type(Key.ENTER) wait(3) receipt_meta_data_array = general_functions.get_receipt_meta_data() # click CASH button general_buttons.pay_out_key_pad_click('CASH') # confirm pay out type(Key.ENTER) general_functions.close_drawer_msg() general_functions.start_of_test_case('pay in ' + 'LIST ITEM ' + str(z + 1)) z = +1 general_functions.start_of_test_case('cancel pay in') general_buttons.main_page_footer_menu_btns_click('OTHER') # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('other_screen') general_buttons.main_page_other_menu_btns_click('PAY-IN') # four eyes authorization general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) # select and confirm pay out reason # general_functions.general_message('select pay out reason') type(Key.ENTER) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('pay_in_reasons') # type amount that's payed out # general_functions.general_message('type amount that's payed out') type("9.99") # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('pay_in_total_amount_screen') # confirm amount # general_functions.general_message('confirm amount') type(Key.ENTER) wait(3) # get receipt data and save it receipt_meta_data_array = general_functions.get_receipt_meta_data() # click CANCEL TRANSACTION button # general_functions.general_message('CANCEL') general_buttons.basket_page_key_pad_btns_click('CANCEL') # four eyes authorization general_functions.four_eyes(l_general_test_settings[4], l_general_test_settings[5]) type(Key.ENTER) type(Key.ENTER) # general_functions.general_message('end of payout') general_functions.end_of_test_case()
def pay_transaction_with_multiple_tenders(payment_data_items): ''' payment_data_items example DESCRIPTION VALUE 1 2 [['VISA', '10.00' ], ['ZALANDO', 'REST' ]] ''' # number of tenders to pay with offline_cards = [ 'VISA', 'MASTERCARD', 'MAESTRO', 'AMEX', 'CHINA UNION PAY', 'DINERS', 'ONE4ALLVOUCHER', 'ALIPAY', 'ALIPAY IRELAND', 'WECHAT', 'WECHAT IRELAND', 'BREUNINGER', 'POSTFINANCE', 'BANCOMAT' ] online_cards = [ 'VISA ON', 'MASTERCARD ON', 'MAESTRO ON', 'AMEX ON', 'CHINA UNION PAY ON', 'DINERS ON', 'ALIPAY ON', 'WECHAT ON' ] receipt_meta_data_array = get_receipt_meta_data() cash_included_in_payment = False for payment_item in payment_data_items: tender = payment_item[0] if tender in offline_cards: general_buttons.payment_page_footer_menu_btns_click( 'OTHER TENDERS') wait(0.5) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('other_tenders_screen') general_buttons.payment_page_other_tenders_menu_btns_click( 'OFFLINE CARD') wait(0.5) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element('offline_cards_screen') general_buttons.payment_page_other_tenders_offline_card_menu_btns_click( tender) wait(0.5) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element( 'offline_cards_total_amount_screen') # amount if mentioned if payment_item[1] <> 'REST': type(str(payment_item[1])) type(Key.ENTER) # TEST CASE if is_gui_test == 'YES': gui_screens.check_gui_element( 'offline_card_payment_processed_dialog') type(Key.ENTER) # do_pick_up_if_needed() if tender == 'GIFT VOUCHER': general_buttons.payment_page_footer_menu_btns_click( 'OTHER TENDERS') wait(0.5) general_buttons.payment_page_other_tenders_menu_btns_click(tender) wait(0.5) # gv number if brand == "CK": type(payment_item[1]) general_message_with_subject( 'Type the GV number', 'If the found GV number was NOT correct please type the correct one here and click OK, if it is correct just click OK' ) if brand == "TH": type(payment_item[1]) type(Key.ENTER) # type(Key.ENTER) if tender == 'ZALANDO': general_buttons.payment_page_footer_menu_btns_click( 'OTHER TENDERS') wait(0.5) general_buttons.payment_page_other_tenders_menu_btns_click(tender) wait(0.5) # zalando number type(payment_item[1]) wait(0.5) # confirm number and close sale type(Key.ENTER) wait(0.5) if tender == 'FRANCHISE RETOURE POST': general_buttons.payment_page_footer_menu_btns_click( 'OTHER TENDERS') wait(0.5) general_buttons.payment_page_other_tenders_menu_btns_click(tender) wait(0.5) # frp_number type(payment_item[2]) wait(0.5) type(Key.ENTER) wait(0.5) # amount type(payment_item[1]) wait(0.5) type(Key.ENTER) # pay_transaction_with_tender([['tender', 'DINERS']]) if tender in online_cards: general_buttons.pay_out_key_pad_click('CARD') wait(0.5) # amount if mentioned if payment_item[1] <> 'REST': type(str(payment_item[1])) type(Key.ENTER) general_message( 'pay manually with online ' + tender + ' card and the Adyen terminal. Click OK once your done paying to resume the automated test run' ) if tender == 'CASH': general_buttons.pay_out_key_pad_click('CASH') if payment_item[1] <> 'REST': type(str(payment_item[1])) type(Key.ENTER) cash_included_in_payment = True print('cash_included_in_payment: ' + str(cash_included_in_payment)) if tender == 'FOREIGN CURRENCY': general_buttons.payment_page_footer_menu_btns_click( 'OTHER TENDERS') wait(0.5) general_buttons.payment_page_other_tenders_menu_btns_click(tender) wait(0.5) general_buttons.pay_out_key_pad_click('CASH') type(Key.ENTER) cash_included_in_payment = True print('cash_included_in_payment: ' + str(cash_included_in_payment)) # if there is cash involved in the payment the drawer will be opened after the last tender if cash_included_in_payment == True: close_drawer_msg()