Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import importer
- import sys
- import unittest
- import xmlrunner
- import time
- from lib import q2_library
- from pages.ngam import main_page, login_page
- from pages.ngam.commercial.payments import payments
- from pages.ngam.transactions import activity_center_page
- class MultiwireInternationalApproveTest(unittest.TestCase):
- driver = None
- util = None
- TRACKING_ID = None
- ENV = 'CI'
- BROWSER = 'CHROME_MAC'
- @classmethod
- def setUpClass(cls):
- cls.util = q2_library.Utilities()
- cls.util.load_config(cls)
- cls.driver = cls.util.get_browser()
- cls.url = cls.util.get_config("base_url")
- cls.user = "mw1"
- cls.password = "qa123"
- cls.current_page = None
- def test_01_navigation(self):
- self.driver.get(self.url)
- self.driver.maximize_window()
- self.assertIn("4", self.driver.title, "Checking the title has the correct value")
- def test_02_login_successful(self):
- login = login_page.LoginPage(self.driver)
- login.enter_username(self.user)
- login.enter_password(self.password)
- self.main_page = login.click_submit_button()
- msg = self.main_page.validate_welcome_msg()
- self.assertIn('Welcome back', msg, "Login was successful")
- def test_03_payments(self):
- self.menu = main_page.Menu(self.driver)
- self.menu.open_menu_item('Commercial')
- self.payment_page = self.menu.open_menu_child_item('Payments')
- self.payment_page.wait_for_page_to_load()
- self.assertTrue(self.payment_page.is_page_loaded(), "Checking that the Payments Page got loaded")
- def test_04_select_international_wire(self):
- self.payment_page = payments.PaymentsPage(self.driver)
- self.payment_page.click_new_payment_drop_down()
- setup_wire = self.payment_page.click_new_payment_dropdown_val("International Wire")
- self.__class__.current_page = setup_wire
- self.assertTrue(setup_wire.is_page_loaded(), "Checking that the Set Up Wires tab got loaded")
- def test_05_verify_date(self):
- setup_wire = self.current_page
- is_current_date_correct = setup_wire.is_current_date_in_process_date_field()
- is_same_date_for_all_checked = setup_wire.is_same_date_for_all_checked()
- self.assertTrue(is_current_date_correct and is_same_date_for_all_checked, "Checking that the date information is correct")
- def test_06_add_wire(self):
- setup_wire = self.current_page
- #setup_wire.click_more_wires_btn()
- #is_num_of_lines_correct = setup_wire.ret_num_wire_lines() == 2
- #self.assertTrue(is_num_of_lines_correct, "Checking that 2 wires are displayed")
- def test_07_fill_first_line(self):
- setup_wire = self.current_page
- setup_wire.choose_recipient("IntnlWireSwiftBic", 1)
- setup_wire.enter_amount("3.33", 1)
- setup_wire.choose_subsidiary("DallasWireOnly", 1)
- setup_wire.choose_from_account("****-4321", 1)
- is_transaction_valid = setup_wire.is_transaction_valid(1)
- self.assertTrue(is_transaction_valid, "Checking that the first wire was filled out correctly")
- """
- def test_08_fill_second_line(self):
- setup_wire = self.current_page
- setup_wire.choose_recipient("IntnlWireIban", 2,2)
- setup_wire.enter_amount("22", 2)
- setup_wire.choose_subsidiary("AustinACH&Wire", 2)
- setup_wire.choose_from_account("****-9789", 2)
- is_transaction_valid = setup_wire.is_transaction_valid(2)
- self.assertTrue(is_transaction_valid, "Checking that the second wire was filled out correctly")
- """
- def test_09_go_to_review_submit_page(self):
- setup_wire = self.current_page
- review_submit_page = setup_wire.click_next_button()
- self.__class__.current_page = review_submit_page
- review_submit_page.wait_for_page_to_load()
- self.assertTrue(review_submit_page.is_page_loaded, "Checking that the Review & Submit page got loaded")
- def test_10_verify_payment_section_submit_page(self):
- review_submit_page = self.current_page
- is_num_of_payments_correct = review_submit_page.get_num_of_payments_overview() == 1 #cambiar a 2
- #is_num_of_payments_with_currency_correct = review_submit_page.get_num_of_payments_with_currency_in_overview() == '2 (USD)'
- is_tot_amount_correct = review_submit_page.get_total_amt_in_overview() == '$3.33' # cambiar
- is_send_payment_as_correct = review_submit_page.get_send_payment_as_str() == '1 subsidiaries'# cambiar
- is_from_account_correct = review_submit_page.get_txt_frm_acc_overview() == '1 accounts' #cambiar
- self.assertTrue(is_num_of_payments_correct and
- is_send_payment_as_correct and is_from_account_correct and is_tot_amount_correct,
- "Checking that the Review & Submit information is correct")
- def test_11_verify_first_recipient_section_submit_page(self):
- review_submit_page = self.current_page
- review_submit_page.expand_nth_rec(1)
- is_num_correct = review_submit_page.ret_num_nth_rec(1) == 1
- is_name_correct = review_submit_page.ret_name_nth_rec(1) == 'IntnlWireSwiftBic'
- is_account_id_correct = 'SB1234' in review_submit_page.ret_account_id_nth_rec(1)
- is_amount_correct = review_submit_page.ret_amount_nth_rec(1) == '$3.33'
- is_subsidiary_correct = review_submit_page.ret_subs_nth_rec(1) == 'DallasWireOnly'
- is_from_account_number_correct = review_submit_page.ret_frm_acc_num_nth_rec(1) == '****-4321'
- is_notify_correct = review_submit_page.ret_notify_nth_rec(1) == 'No'
- is_process_date_correct = review_submit_page.ret_process_date_nth_rec() == time.strftime("%m/%d/%Y")
- is_account_correct_orig_info = '****-4321' in review_submit_page.ret_orig_ben_data_nth_rec('From:')
- is_amount_correct_orig_info = review_submit_page.ret_orig_ben_data_nth_rec('Amount:') == '$3.33'
- is_to_correct_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('To:') == 'IntnlWireSwiftBic'
- is_account_correct_benef_info = 'SB1234' in review_submit_page.ret_orig_ben_data_nth_rec('Account:')
- is_routing_num_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('Routing Number:') == '' # ask if it is correct
- is_beneficiary_correct_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('Beneficiary:') == 'IntnlWireSwiftBic Benie'
- self.assertTrue(is_num_correct and is_name_correct and is_account_id_correct and is_amount_correct and
- is_subsidiary_correct and is_from_account_number_correct and is_notify_correct and is_process_date_correct and
- is_account_correct_orig_info and is_amount_correct_orig_info and is_to_correct_benef_info and
- is_account_correct_benef_info and is_routing_num_benef_info and is_beneficiary_correct_benef_info and "Checking that the information of the first recipient is correct")
- """
- def test_12_verify_second_recipient_section_submit_page(self):
- review_submit_page = self.current_page
- review_submit_page.expand_nth_rec(2)
- is_num_correct = review_submit_page.ret_num_nth_rec(2) == 2
- is_name_correct = review_submit_page.ret_name_nth_rec(2) == 'DomesticWire2'
- is_account_id_correct = 'DW6789' in review_submit_page.ret_account_id_nth_rec(2)
- is_amount_correct = review_submit_page.ret_amount_nth_rec(2) == '$20.35'
- is_subsidiary_correct = review_submit_page.ret_subs_nth_rec(2) == 'DallasWireOnly'
- is_from_account_number_correct = review_submit_page.ret_frm_acc_num_nth_rec(2) == '****-7887'
- is_notify_correct = review_submit_page.ret_notify_nth_rec(2) == 'No'
- is_process_date_correct = review_submit_page.ret_process_date_nth_rec(2) == time.strftime("%m/%d/%Y")
- is_account_correct_orig_info = '****-7887' in review_submit_page.ret_orig_ben_data_nth_rec('From:', 2)
- is_amount_correct_orig_info = review_submit_page.ret_orig_ben_data_nth_rec('Amount:', 2) == '$20.35'
- is_to_correct_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('To:', 2) == 'DomesticWire2'
- is_account_correct_benef_info = 'DW6789' in review_submit_page.ret_orig_ben_data_nth_rec('Account:', 2)
- is_routing_num_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('Routing Number:', 2) == '044444444'
- is_beneficiary_correct_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('Beneficiary:', 2) == 'DomesticWire2'
- self.assertTrue(is_num_correct and is_name_correct and is_account_id_correct and is_amount_correct and
- is_subsidiary_correct and is_from_account_number_correct and is_notify_correct and is_process_date_correct and
- is_account_correct_orig_info and is_amount_correct_orig_info and is_to_correct_benef_info and
- is_account_correct_benef_info and is_routing_num_benef_info and is_beneficiary_correct_benef_info,
- "Checking that the information of the second recipient is correct")
- """
- def test_13_approve_payment(self):
- review_submit_page = self.current_page
- modal = review_submit_page.click_approve()
- self.__class__.current_page = modal
- is_title_correct = modal.get_modal_title() == 'Payments Approved'
- is_success_icon_displayed = modal.is_success_icon_displayed()
- is_modal_text_color_correct = modal.get_modal_text_color() == 'rgba(0, 154, 64, 1)'
- is_modal_text_correct = modal.get_modal_text() == 'Your payments have been approved.'
- is_modal_amount_correct = modal.get_multi_approve_amount() == '2 (USD): $31.90'
- is_batch_id_correct = len(modal.get_multi_wire_modal_data("Batch ID:")) > 0
- is_from_correct = '2 accounts' in modal.get_multi_wire_modal_data("From:")
- is_to_correct = '2 accounts' in modal.get_multi_wire_modal_data("To:")
- is_send_as_correct = '2 subsidiaries' in modal.get_multi_wire_modal_data("Send Payment(s) As:")
- is_created_by_correct = ' AutoMultiWire One' in modal.get_multi_wire_modal_data("Created By:")
- is_download_link_present = modal.is_multi_approve_download_link_present()
- self.assertTrue(is_success_icon_displayed and is_title_correct and is_modal_text_correct and is_modal_amount_correct and is_modal_text_color_correct and
- is_batch_id_correct and is_from_correct and is_to_correct and is_send_as_correct and is_created_by_correct and is_download_link_present,
- "Checking that the modal information is correct")
- def test_14_go_to_activity_center(self):
- modal = self.current_page
- modal.go_to_activity_center()
- activity_center = activity_center_page.ActivityCenterPage(self.driver)
- self.__class__.current_page = activity_center
- activity_center.wait_for_page_to_load()
- is_first_transaction_not_expanded = not activity_center.is_row_expanded(1)
- is_second_transaction_not_expanded = not activity_center.is_row_expanded(2)
- self.assertTrue(activity_center.is_activity_center_page_loaded and is_first_transaction_not_expanded and
- is_second_transaction_not_expanded, "Checking that the Activity Center got loaded")
- def test_15_verify_title_first_trans(self):
- activity_center = self.current_page
- is_header_date_valid = len(activity_center.return_header_date(1)) > 0
- is_header_status_correct = activity_center.return_header_status(1) == 'Authorized'
- are_header_approvals_correct = activity_center.return_header_approvals(1) == '1 of 1'
- is_transaction_type_correct = 'International Wire' in activity_center.return_header_trans_type(1)
- is_account_correct = '*****-4321' in activity_center.return_header_account(1)
- is_amount_correct = activity_center.return_header_amount(1) == '$3.33'
- self.assertTrue(is_header_date_valid and are_header_approvals_correct and is_header_status_correct and
- is_transaction_type_correct and is_account_correct and is_amount_correct, "Checking that the header fields are correct for the first transaction")
- """
- def test_16_verify_title_second_trans(self):
- activity_center = self.current_page
- is_header_date_valid = len(activity_center.return_header_date(2)) > 0
- is_header_status_correct = activity_center.return_header_status(2) == 'Authorized'
- are_header_approvals_correct = activity_center.return_header_approvals(2) == '1 of 1'
- is_transaction_type_correct = 'International Wire' in activity_center.return_header_trans_type(2)
- is_account_correct = '****-9789' in activity_center.return_header_account(2)
- is_amount_correct = activity_center.return_header_amount(2) == '$22'
- self.assertTrue(is_header_date_valid and are_header_approvals_correct and is_header_status_correct and
- is_transaction_type_correct and is_account_correct and is_amount_correct, "Checking that the header fields are correct for the second transaction")
- def test_17_verify_body_first_transs(self):
- activity_center = self.current_page
- activity_center.expand_nth_item(1)
- is_tracking_id_correct = len(activity_center.return_tracking_id()) > 0
- is_batch_id_correct = len(activity_center.return_batch_id()) > 0
- is_created_date_valid = len(activity_center.return_created_date1()) > 0
- is_created_by_correct = activity_center.return_created_by() == 'AutoMultiWire One'
- is_auth_date_valid = len(activity_center.return_auth_date()) > 0
- is_auth_by_correct = activity_center.return_auth_by() == 'AutoMultiWire One'
- is_process_date_valid = len(activity_center.return_process_date()) > 0
- is_from_account_correct = '****-7887' in activity_center.return_item_from_account()
- is_to_account_correct = 'XXX789' in activity_center.return_item_to_account()
- is_to_account_type_correct = 'Checking' in activity_center.return_item_to_account_type()
- is_originator_wire_header_correct = 'DallasWireHeader' in activity_center.return_item_originator_wire_header()
- is_amount_correct = activity_center.return_item_amount() == '$20.35'
- is_ben_wire_name_correct = activity_center.return_item_wire_name() == 'DomesticWire2'
- is_ben_fi_rout_num_correct = activity_center.return_item_beneficiary_routing_number() == 'XXXXX4444'
- is_ben_fi_name_correct = activity_center.return_item_beneficiary_name() == 'DomesticWire2'
- self.assertTrue(is_tracking_id_correct and is_batch_id_correct and is_created_by_correct and is_created_date_valid and
- is_auth_date_valid and is_auth_by_correct and is_process_date_valid and is_from_account_correct and
- is_to_account_correct and is_to_account_type_correct and is_originator_wire_header_correct and
- is_amount_correct and is_ben_wire_name_correct and is_ben_fi_rout_num_correct and is_ben_fi_name_correct,
- "Checking that the transaction information in the activity center is correct")
- def test_18_transaction_boxes_activity_center(self):
- activity_center = self.current_page
- is_drafted_box_correct = activity_center.is_trans_fld_present('Drafted')
- is_approvals_box_present = activity_center.is_trans_fld_present('Approval(s)')
- is_authorized_box_present = activity_center.is_trans_fld_present('Authorized')
- is_processed_box_present = activity_center.is_trans_fld_present('Processed')
- is_draft_box_data_valid = activity_center.is_trans_fld_data_present('Drafted', 'AutoMultiWire One')
- is_approve_box_data_correct = activity_center.get_trans_fld_data('Approval(s)', 'AutoMultiWire One')
- authorized_box_has_data = activity_center.trans_fld_has_data('Authorized')
- processes_box_does_not_have_data = not activity_center.trans_fld_has_data('Processed')
- self.assertTrue(is_drafted_box_correct and is_approvals_box_present and is_authorized_box_present and is_processed_box_present
- and is_draft_box_data_valid and is_approve_box_data_correct and authorized_box_has_data and processes_box_does_not_have_data,
- "Checking that all the transaction boxes are present and their information is correct")
- """
- def test_19_log_off(self):
- self.menu = main_page.Menu(self.driver)
- self.menu.open_menu_item('Log Off')
- login = login_page.LoginPage(self.driver)
- self.__class__.current_page = login
- login.wait_for_page_to_load()
- self.assertTrue(login.is_login_page_loaded(), "Checking that the user logged off correctly")
- def setUp(self):
- self.util.set_up(self)
- def tearDown(self):
- self.util.tear_down(self)
- @classmethod
- def tearDownClass(cls):
- cls.util.close_the_browser(cls.driver)
- if __name__ == '__main__':
- if len(sys.argv) == 2:
- MultiwireInternationalApproveTest.ENV = sys.argv.pop()
- if len(sys.argv) == 3:
- MultiwireInternationalApproveTest.BROWSER = sys.argv.pop()
- MultiwireInternationalApproveTest.ENV = sys.argv.pop()
- with open('test-reports/junit.xml', 'wb') as output:
- unittest.main(testRunner=xmlrunner.XMLTestRunner(output=output),
- failfast=False, buffer=False, catchbreak=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement