Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import importer
- import sys
- import unittest
- import xmlrunner
- from lib import q2_library, modal_page
- from pages.ngam import main_page, login_page
- from pages.ngam.transactions import activity_center_page
- from pages.ngam.transactions.funds_transfer import individual_transfers_page, multi_account_transfers_page, accounts_and_amounts_page, schedule_and_submit_page
- class MultiTransferDraft(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 = cls.util.get_credentials("multi_transfer")
- cls.password = cls.util.get_credentials("passwordp1")
- cls.current_page = None
- cls.user_name = "AutoMultiTaxOne asfg"
- cls.account1 = "****-9789"
- cls.account2 = "****-6789"
- cls.account3 = "****-7887"
- cls.account4 = "****-9988"
- cls.amount1 = "9.11"
- cls.amount2 = "10.11"
- cls.amount3 = "11.11"
- cls.amount4 = "12.11"
- 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_funds_transfer(self):
- self.menu = main_page.Menu(self.driver)
- self.menu.open_menu_item('Transactions')
- self.funds_transfer = self.menu.open_menu_child_item('Funds Transfer')
- self.funds_transfer.wait_for_page_to_load()
- self.assertTrue(self.funds_transfer.is_page_loaded(), "Checking that the Funds Transfer Page got loaded")
- def test_04_multi_account_transfers(self):
- self.funds_transfer = individual_transfers_page.FundsTransferPage(self.driver)
- multi_transfers = self.funds_transfer.go_to_multitransfer_tab()
- self.__class__.current_page = multi_transfers
- self.assertTrue(multi_transfers.is_page_loaded(), "Checking that the multi transfers tab got loaded")
- def test_05_select_funds_transfer(self):
- multi_transfers = self.current_page
- accounts_and_amounts_tab = multi_transfers.click_on_transfers_funds()
- self.__class__.current_page = accounts_and_amounts_tab
- self.assertTrue(accounts_and_amounts_tab.is_page_loaded(), "Checking that the multi transfers tab got loaded")
- def test_06_add_more_transfers(self):
- accounts_and_amounts_tab = self.current_page
- accounts_and_amounts_tab.click_on_more_transfer()
- is_num_of_lines_correct = accounts_and_amounts_tab.ret_num_account_lines() == 4
- self.assertTrue(is_num_of_lines_correct, "Checking that 4 accounts are displayed")
- def test_07_fill_accounts_and_amounts(self):
- accounts_and_amounts_tab = self.current_page
- accounts_and_amounts_tab.choose_from_account(self.account1, 1)
- accounts_and_amounts_tab.choose_to_account(self.account2, 1)
- accounts_and_amounts_tab.enter_amount(self.amount1, 1)
- accounts_and_amounts_tab.choose_from_account(self.account2, 2)
- accounts_and_amounts_tab.choose_to_account(self.account3, 2)
- accounts_and_amounts_tab.enter_amount(self.amount2, 2)
- accounts_and_amounts_tab.choose_from_account(self.account3, 3)
- accounts_and_amounts_tab.choose_to_account(self.account2, 3)
- accounts_and_amounts_tab.enter_amount(self.amount3, 3)
- accounts_and_amounts_tab.choose_from_account(self.account4, 4)
- accounts_and_amounts_tab.choose_to_account(self.account1, 4)
- accounts_and_amounts_tab.enter_amount(self.amount4, 4)
- accounts_and_amounts_tab = self.current_page
- schedule_and_submit = accounts_and_amounts_tab.click_on_next()
- self.__class__.current_page = schedule_and_submit
- schedule_and_submit.wait_for_page_to_load()
- self.assertTrue(schedule_and_submit.is_page_loaded, "Checking that the Schedule & Submit page got loaded")
- def test_08_verify_accounts_submit_page(self):
- schedule_and_submit = self.current_page
- schedule_and_submit.expand_nth_rec(1)
- schedule_and_submit.enter_memo_nth_rec("MemoMemoMemo", 1)
- schedule_and_submit.expand_nth_rec(1)
- total_transfers_is_correct = schedule_and_submit.ret_total_transfers() == "4"
- total_amount_is_correct = schedule_and_submit.ret_total_amount() == "$42.44"
- is_from_account1_correct = schedule_and_submit.ret_text_from_account(1) == self.account1
- is_to_account1_correct = schedule_and_submit.ret_text_to_account(1) == self.account2
- is_amount1_correct = schedule_and_submit.ret_text_amount(1) == "$" + self.amount1
- is_date1_correct = len(schedule_and_submit.ret_date(1)) > 0 and schedule_and_submit.ret_date(1) is not \
- "Choose above"
- is_from_account2_correct = schedule_and_submit.ret_text_from_account(2) == self.account2
- is_to_account2_correct = schedule_and_submit.ret_text_to_account(2) == self.account3
- is_amount2_correct = schedule_and_submit.ret_text_amount(2) == "$" + self.amount2
- is_date2_correct = len(schedule_and_submit.ret_date(2)) > 0 and schedule_and_submit.ret_date(2) is not \
- "Choose above"
- is_from_account3_correct = schedule_and_submit.ret_text_from_account(3) == self.account3
- is_to_account3_correct = schedule_and_submit.ret_text_to_account(3) == self.account2
- is_amount3_correct = schedule_and_submit.ret_text_amount(3) == "$" + self.amount3
- is_date3_correct = len(schedule_and_submit.ret_date(3)) > 0 and schedule_and_submit.ret_date(3) is not \
- "Choose above"
- is_from_account4_correct = schedule_and_submit.ret_text_from_account(4) == self.account4
- is_to_account4_correct = schedule_and_submit.ret_text_to_account(4) == self.account1
- is_amount4_correct = schedule_and_submit.ret_text_amount(4) == "$" + self.amount4
- is_date4_correct = len(schedule_and_submit.ret_date(4)) > 0 and schedule_and_submit.ret_date(4) is not \
- "Choose above"
- schedule_and_submit.expand_nth_rec(1)
- is_memo1_displayed = schedule_and_submit.ret_text_of_memo(1) == "MemoMemoMemo"
- schedule_and_submit.expand_nth_rec(2)
- is_memo2_displayed = schedule_and_submit.ret_text_of_memo(2) == ""
- schedule_and_submit.expand_nth_rec(3)
- is_memo3_displayed = schedule_and_submit.ret_text_of_memo(3) == ""
- schedule_and_submit.expand_nth_rec(4)
- is_memo4_displayed = schedule_and_submit.ret_text_of_memo(4) == ""
- self.assertTrue(total_amount_is_correct and total_transfers_is_correct and is_from_account1_correct and
- is_to_account1_correct and is_date1_correct and is_from_account2_correct and
- is_to_account2_correct and is_date2_correct and is_from_account3_correct and
- is_to_account3_correct and is_date3_correct and is_from_account4_correct and
- is_to_account4_correct and is_amount1_correct and is_amount2_correct and is_amount3_correct and
- is_amount4_correct and is_date4_correct and is_memo1_displayed and is_memo2_displayed and
- is_memo3_displayed and is_memo4_displayed and schedule_and_submit.is_schedule_recurring_link_displayed(),
- "Checking the information of Schedule & Submit page is displayed correctly")
- def test_09_enter_recurring_information(self):
- schedule_and_submit = self.current_page
- schedule_and_submit.select_date()
- schedule_and_submit.set_recurring_schedule()
- schedule_and_submit.sel_quarterly_on_rec_modal()
- schedule_and_submit.select_date_on_rec_sch_modal()
- schedule_and_submit.click_save_on_rec_sch_modal()
- self.assertTrue(schedule_and_submit.is_page_loaded(), "Checking that the Review and Submit tab is loaded")
- def test_10_validate_recurring_information(self):
- schedule_and_submit = self.current_page
- is_recurrence_correct = schedule_and_submit.is_sel_rec_sch_lnk_present("Quarterly")
- self.assertTrue(is_recurrence_correct, "Checking that the Review and Submit tab is loaded")
- def test_11_draft_transfer(self):
- schedule_and_submit = self.current_page
- modal = schedule_and_submit.click_draft()
- self.__class__.current_page = modal
- is_title_correct = modal.get_modal_title() == "Transfers Drafted"
- is_modal_text_color_correct = modal.get_modal_color() == "rgba(228, 225, 4, 1)"
- is_modal_text_correct = modal.get_modal_text() == "Your funds transfers have been drafted but still require approval." \
- " Go to Activity Center to view or approve these transactions."
- is_modal_amount_correct = "$42.44" in modal.get_multi_draft_amount()
- is_batch_id_correct = len(modal.get_multi_wire_modal_data("Batch ID:")) > 0
- is_from_correct = "4 accounts" in modal.get_multi_wire_modal_data("From:")
- is_to_correct = "3 accounts" in modal.get_multi_wire_modal_data("To:")
- is_download_link_present = modal.is_multi_draft_download_link_present()
- is_recurs_data_present = "Quarterly" in modal.get_ach_draft_modal_data("Recurs")
- self.assertTrue(is_modal_text_correct and is_modal_text_color_correct and is_batch_id_correct and is_from_correct and
- is_modal_amount_correct and is_title_correct and is_to_correct and
- is_download_link_present and is_recurs_data_present, "Checking that the approve modal information is correct")
- def test_12_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)
- is_third_transaction_not_expanded = not activity_center.is_row_expanded(3)
- is_fourth_transaction_not_expanded = not activity_center.is_row_expanded(4)
- self.assertTrue(activity_center.is_activity_center_page_loaded and is_first_transaction_not_expanded and
- is_second_transaction_not_expanded and is_third_transaction_not_expanded and
- is_fourth_transaction_not_expanded, "Checking that the Activity Center got loaded")
- def test_13_ac_transfers_title_info(self):
- activity_center = self.current_page
- is_header_date_valid = len(activity_center.return_header_date()) > 0
- are_header_approvals_correct = activity_center.return_header_approvals() == "0 of 1"
- is_header_status_correct = activity_center.return_header_status() == "Drafted"
- is_transaction_type_correct = "Funds Transfer" in activity_center.return_header_trans_type()
- is_account_correct = self.account4 in activity_center.return_header_account()
- is_amount_correct = activity_center.return_header_amount() == "$" + self.amount4
- is_header_date2_valid = len(activity_center.return_header_date(2)) > 0
- are_header_approvals2_correct = activity_center.return_header_approvals(2) == "0 of 1"
- is_header_status2_correct = activity_center.return_header_status(2) == "Drafted"
- is_transaction_type2_correct = "Funds Transfer" in activity_center.return_header_trans_type(2)
- is_account2_correct = self.account3 in activity_center.return_header_account(2)
- is_amount2_correct = activity_center.return_header_amount(2) == "$" + self.amount3
- is_header_date3_valid = len(activity_center.return_header_date(3)) > 0
- are_header_approvals3_correct = activity_center.return_header_approvals(3) == "0 of 1"
- is_header_status3_correct = activity_center.return_header_status(3) == "Drafted"
- is_transaction_type3_correct = "Funds Transfer" in activity_center.return_header_trans_type(3)
- is_account3_correct = self.account2 in activity_center.return_header_account(3)
- is_amount3_correct = activity_center.return_header_amount(3) == "$" + self.amount2
- is_header_date4_valid = len(activity_center.return_header_date(4)) > 0
- are_header_approvals4_correct = activity_center.return_header_approvals(4) == "0 of 1"
- is_header_status4_correct = activity_center.return_header_status(4) == "Drafted"
- is_transaction_type4_correct = "Funds Transfer" in activity_center.return_header_trans_type(4)
- is_account4_correct = self.account1 in activity_center.return_header_account(4)
- is_amount4_correct = activity_center.return_header_amount(4) == "$" + self.amount1
- 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 and
- is_header_date2_valid and are_header_approvals2_correct and is_header_status2_correct and
- is_transaction_type2_correct and is_account2_correct and is_amount2_correct and
- is_header_date3_valid and are_header_approvals3_correct and is_header_status3_correct and
- is_transaction_type3_correct and is_account3_correct and is_amount3_correct and
- is_header_date4_valid and are_header_approvals4_correct and is_header_status4_correct and
- is_transaction_type4_correct and is_account4_correct and is_amount4_correct,
- "Checking that the header fields are correct")
- def test_14_verify_fourth_trans_body(self):
- activity_center = self.current_page
- activity_center.scroll_the_page(0,'document.body.scrollHeight')
- activity_center.expand_nth_item(4)
- 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() == self.user_name
- is_process_date_valid = len(activity_center.return_process_date()) > 0
- is_amount_correct = activity_center.return_item_amount() == "$" + self.amount1
- is_memo_msg_correct = "MemoMemoMemo" in activity_center.return_item_description()
- is_from_account_correct = self.account1 in activity_center.return_item_from_account()
- is_to_account_correct = self.account2 in activity_center.return_item_to_account()
- self.assertTrue(is_tracking_id_correct and is_batch_id_correct and is_created_by_correct and
- is_created_date_valid and is_process_date_valid and
- is_amount_correct and is_from_account_correct and is_memo_msg_correct and is_to_account_correct,
- "Checking that the transaction information in the activity center is correct")
- def test_15_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', 'AutoMultiTaxOne asfg')
- is_approve_box_data_correct = 'Pending' in activity_center.get_trans_fld_data('Approval(s)', '1.')
- authorized_box_does_not_have_data = not 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_does_not_have_data and processes_box_does_not_have_data,
- "Checking that all the transaction boxes are present and their information is correct")
- def test_14_check_if_notify_is_not_present(self):
- activity_center = self.current_page
- activity_center.click_actions_link(4)
- is_notify_absent = activity_center.is_actions_menu_item_present("Notify") == False
- self.assertTrue(is_notify_absent, "Checking if notify is not present for the recurring transfer")
- def test_15_approve_payment(self):
- activity_center = self.current_page
- activity_center.wait_for_page_to_load()
- activity_center.click_actions_link(4)
- activity_center.click_actions_menu_item("Approve")
- modal = modal_page.ModalPage(self.driver)
- is_modal_color_correct = modal.return_title_color() == "rgba(228, 225, 4, 1)"
- is_modal_title_correct = modal.return_title_modal() == "Approve Transaction"
- is_modal_text_correct = modal.return_text_modal() == "Are you sure you want to approve this transaction?"
- self.assertTrue(is_modal_color_correct and is_modal_text_correct and is_modal_title_correct,
- "Checking that the confirm approval modal is shown correctly")
- def test_16_approve_success_modal(self):
- activity_center = self.current_page
- activity_center.click_confirm()
- modal = modal_page.ModalPage(self.driver)
- is_title_correct = modal.return_title_modal() == "Approval Successful"
- is_modal_color_correct = modal.return_title_color() == "rgba(0, 154, 64, 1)"
- is_amount_correct = " ($" + self.amount1 + ")" in activity_center.return_modal_trans_info()
- self.assertTrue(is_modal_color_correct and is_title_correct and is_amount_correct,
- "Checking that the approve success modal is shown correctly")
- def test_17_verify_transaction_status(self):
- modal_page.ModalPage(self.driver).click_close_modal()
- activity_center = self.current_page
- activity_center.wait_for_page_to_load()
- is_header_status_correct = activity_center.return_header_status(4) == "Authorized"
- self.assertTrue(is_header_status_correct, "Checking that the header status is now approved")
- '''
- def test_16_go_to_notify(self):
- activity_center = self.current_page
- activity_center.click_actions_link(4)
- activity_center.click_actions_menu_item("Notify")
- is_there_a_user_disabled = activity_center.check_if_user_enabled('AutoMulitTax Two')
- self.assertTrue(is_there_a_user_disabled, "Checking that there is a disabled user")
- def test_17_select_user_to_notify_and_send(self):
- activity_center = self.current_page
- activity_center.select_user('AutoMulitTax Two')
- activity_center.click_send()
- modal = modal_page.ModalPage(self.driver)
- is_modal_color_correct = modal.return_title_color() == 'rgba(0, 154, 64, 1)'
- is_modal_text_correct = modal.return_text_modal() == 'Notifications successfully sent to selected users.'
- self.assertTrue(is_modal_color_correct and is_modal_text_correct,
- "Checking that the notifications were sent successfully")
- def test_18_approve_payment(self):
- modal = modal_page.ModalPage(self.driver)
- modal.click_close_modal()
- activity_center = self.current_page
- activity_center.scroll_the_page(0, 20)
- activity_center.expand_nth_item(4)
- activity_center.click_actions_link(4)
- activity_center.click_actions_menu_item("Approve")
- is_modal_color_correct = modal.return_title_color() == 'rgba(228, 225, 4, 1)'
- is_modal_title_correct = modal.return_title_modal() == 'Approve Transaction'
- is_modal_text_correct = modal.return_text_modal() == 'Are you sure you want to approve this transaction?'
- self.assertTrue(is_modal_color_correct and is_modal_text_correct and is_modal_title_correct,
- "Checking that the confirm approval modal is shown correctly")
- def test_19_approve_success_modal(self):
- activity_center = self.current_page
- activity_center.click_confirm()
- modal_functions = modal_page.ModalPage(self.driver)
- is_title_correct = modal_functions.return_title_modal() == 'Approval Successful'
- is_text_correct = modal_functions.return_text_modal() == 'Transaction successfully approved.'
- is_modal_color_correct = modal_functions.return_title_color() == 'rgba(0, 154, 64, 1)'
- is_amount_correct = '$9.11' in activity_center.return_modal_trans_info()
- is_status_correct = "Approved" in activity_center.return_modal_trans_info()
- self.assertTrue(is_modal_color_correct and is_title_correct and is_amount_correct and is_status_correct and is_text_correct,
- "Checking that the successful modal is shown correctly")
- def test_20_verify_transaction_status(self):
- modal_page.ModalPage(self.driver).click_close_modal()
- activity_center = self.current_page
- activity_center.wait_for_page_to_load()
- is_header_status_correct = activity_center.return_header_status(4) == 'Authorized'
- self.assertTrue(is_header_status_correct, "Checking that the header status is now approved")
- def test_21_cancel_transaction(self):
- activity_center = self.current_page
- activity_center.scroll_the_page(0, 20)
- activity_center.click_actions_link(4)
- activity_center.click_actions_menu_item("Cancel")
- is_modal_color_correct = modal_page.ModalPage(self.driver).return_title_color() == "rgba(228, 225, 4, 1)"
- is_modal_title_correct = modal_page.ModalPage(self.driver).return_title_modal() == "Cancel Transaction"
- is_modal_text_correct = modal_page.ModalPage(self.driver).return_text_modal() == "Are you sure you want to " \
- "cancel this transaction?"
- self.assertTrue(is_modal_color_correct and is_modal_text_correct and is_modal_title_correct,
- "checking if the correct confirm modal showed up")
- def test_22_confirm_if_cancel_is_success(self):
- activity_center = self.current_page
- activity_center.click_confirm()
- modal = modal_page.ModalPage(self.driver)
- is_title_correct = modal.return_title_modal() == "Transaction Cancelled"
- is_text_correct = modal.return_text_modal() == 'Transaction successfully cancelled.'
- is_modal_info_correct = "$9.11" in activity_center.return_modal_trans_info()
- is_modal_status_correct = 'Cancelled' in activity_center.return_modal_trans_info()
- is_modal_color_correct = modal.return_title_color() == "rgba(0, 154, 64, 1)"
- self.assertTrue(is_modal_color_correct and is_modal_info_correct and is_title_correct and is_modal_status_correct and is_text_correct,
- "Checking that the successful modal is shown correctly")
- def test_23_verify_trans_status_is_cancelled(self):
- modal_page.ModalPage(self.driver).click_close_modal()
- activity_center = self.current_page
- activity_center.wait_for_page_to_load()
- activity_center.scroll_the_page(0, 40)
- is_header_status_correct = activity_center.return_header_status(4) == "Cancelled"
- is_trans_box_approval_fld_correct = 'AutoMultiTaxOne asfg - Cancelled' in activity_center.get_trans_fld_data("Approval(s)", "2.")
- self.assertTrue(is_header_status_correct and is_trans_box_approval_fld_correct,
- "Checking that the header status is now cancelled")
- def test_24_log_off(self):
- menu = main_page.Menu(self.driver)
- menu.open_menu_item('Log Off')
- login = login_page.LoginPage(self.driver)
- 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:
- MultiTransferDraft.ENV = sys.argv.pop()
- if len(sys.argv) == 3:
- MultiTransferDraft.BROWSER = sys.argv.pop()
- MultiTransferDraft.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