Advertisement
Guest User

Untitled

a guest
Apr 4th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.35 KB | None | 0 0
  1. import importer
  2. import sys
  3. import unittest
  4. import xmlrunner
  5. import time
  6. from lib import q2_library
  7. from pages.ngam import main_page, login_page
  8. from pages.ngam.commercial.payments import payments
  9. from pages.ngam.transactions import activity_center_page
  10.  
  11.  
  12. class MultiwireInternationalApproveTest(unittest.TestCase):
  13. driver = None
  14. util = None
  15. TRACKING_ID = None
  16. ENV = 'CI'
  17. BROWSER = 'CHROME_MAC'
  18.  
  19. @classmethod
  20. def setUpClass(cls):
  21. cls.util = q2_library.Utilities()
  22. cls.util.load_config(cls)
  23. cls.driver = cls.util.get_browser()
  24. cls.url = cls.util.get_config("base_url")
  25. cls.user = "mw1"
  26. cls.password = "qa123"
  27. cls.current_page = None
  28.  
  29. def test_01_navigation(self):
  30. self.driver.get(self.url)
  31. self.driver.maximize_window()
  32. self.assertIn("4", self.driver.title, "Checking the title has the correct value")
  33.  
  34. def test_02_login_successful(self):
  35. login = login_page.LoginPage(self.driver)
  36. login.enter_username(self.user)
  37. login.enter_password(self.password)
  38. self.main_page = login.click_submit_button()
  39. msg = self.main_page.validate_welcome_msg()
  40. self.assertIn('Welcome back', msg, "Login was successful")
  41.  
  42. def test_03_payments(self):
  43. self.menu = main_page.Menu(self.driver)
  44. self.menu.open_menu_item('Commercial')
  45. self.payment_page = self.menu.open_menu_child_item('Payments')
  46. self.payment_page.wait_for_page_to_load()
  47. self.assertTrue(self.payment_page.is_page_loaded(), "Checking that the Payments Page got loaded")
  48.  
  49. def test_04_select_international_wire(self):
  50. self.payment_page = payments.PaymentsPage(self.driver)
  51. self.payment_page.click_new_payment_drop_down()
  52. setup_wire = self.payment_page.click_new_payment_dropdown_val("International Wire")
  53. self.__class__.current_page = setup_wire
  54. self.assertTrue(setup_wire.is_page_loaded(), "Checking that the Set Up Wires tab got loaded")
  55.  
  56. def test_05_verify_date(self):
  57. setup_wire = self.current_page
  58. is_current_date_correct = setup_wire.is_current_date_in_process_date_field()
  59. is_same_date_for_all_checked = setup_wire.is_same_date_for_all_checked()
  60. self.assertTrue(is_current_date_correct and is_same_date_for_all_checked, "Checking that the date information is correct")
  61.  
  62. def test_06_add_wire(self):
  63. setup_wire = self.current_page
  64. #setup_wire.click_more_wires_btn()
  65. #is_num_of_lines_correct = setup_wire.ret_num_wire_lines() == 2
  66. #self.assertTrue(is_num_of_lines_correct, "Checking that 2 wires are displayed")
  67.  
  68. def test_07_fill_first_line(self):
  69. setup_wire = self.current_page
  70. setup_wire.choose_recipient("IntnlWireSwiftBic", 1)
  71. setup_wire.enter_amount("3.33", 1)
  72. setup_wire.choose_subsidiary("DallasWireOnly", 1)
  73. setup_wire.choose_from_account("****-4321", 1)
  74. is_transaction_valid = setup_wire.is_transaction_valid(1)
  75. self.assertTrue(is_transaction_valid, "Checking that the first wire was filled out correctly")
  76. """
  77. def test_08_fill_second_line(self):
  78. setup_wire = self.current_page
  79. setup_wire.choose_recipient("IntnlWireIban", 2,2)
  80. setup_wire.enter_amount("22", 2)
  81. setup_wire.choose_subsidiary("AustinACH&Wire", 2)
  82. setup_wire.choose_from_account("****-9789", 2)
  83. is_transaction_valid = setup_wire.is_transaction_valid(2)
  84. self.assertTrue(is_transaction_valid, "Checking that the second wire was filled out correctly")
  85. """
  86. def test_09_go_to_review_submit_page(self):
  87. setup_wire = self.current_page
  88. review_submit_page = setup_wire.click_next_button()
  89. self.__class__.current_page = review_submit_page
  90. review_submit_page.wait_for_page_to_load()
  91. self.assertTrue(review_submit_page.is_page_loaded, "Checking that the Review & Submit page got loaded")
  92.  
  93. def test_10_verify_payment_section_submit_page(self):
  94. review_submit_page = self.current_page
  95. is_num_of_payments_correct = review_submit_page.get_num_of_payments_overview() == 1 #cambiar a 2
  96. #is_num_of_payments_with_currency_correct = review_submit_page.get_num_of_payments_with_currency_in_overview() == '2 (USD)'
  97. is_tot_amount_correct = review_submit_page.get_total_amt_in_overview() == '$3.33' # cambiar
  98. is_send_payment_as_correct = review_submit_page.get_send_payment_as_str() == '1 subsidiaries'# cambiar
  99. is_from_account_correct = review_submit_page.get_txt_frm_acc_overview() == '1 accounts' #cambiar
  100. self.assertTrue(is_num_of_payments_correct and
  101. is_send_payment_as_correct and is_from_account_correct and is_tot_amount_correct,
  102. "Checking that the Review & Submit information is correct")
  103.  
  104. def test_11_verify_first_recipient_section_submit_page(self):
  105. review_submit_page = self.current_page
  106. review_submit_page.expand_nth_rec(1)
  107. is_num_correct = review_submit_page.ret_num_nth_rec(1) == 1
  108. is_name_correct = review_submit_page.ret_name_nth_rec(1) == 'IntnlWireSwiftBic'
  109. is_account_id_correct = 'SB1234' in review_submit_page.ret_account_id_nth_rec(1)
  110. is_amount_correct = review_submit_page.ret_amount_nth_rec(1) == '$3.33'
  111. is_subsidiary_correct = review_submit_page.ret_subs_nth_rec(1) == 'DallasWireOnly'
  112. is_from_account_number_correct = review_submit_page.ret_frm_acc_num_nth_rec(1) == '****-4321'
  113. is_notify_correct = review_submit_page.ret_notify_nth_rec(1) == 'No'
  114. is_process_date_correct = review_submit_page.ret_process_date_nth_rec() == time.strftime("%m/%d/%Y")
  115. is_account_correct_orig_info = '****-4321' in review_submit_page.ret_orig_ben_data_nth_rec('From:')
  116. is_amount_correct_orig_info = review_submit_page.ret_orig_ben_data_nth_rec('Amount:') == '$3.33'
  117. is_to_correct_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('To:') == 'IntnlWireSwiftBic'
  118. is_account_correct_benef_info = 'SB1234' in review_submit_page.ret_orig_ben_data_nth_rec('Account:')
  119. is_routing_num_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('Routing Number:') == '' # ask if it is correct
  120. is_beneficiary_correct_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('Beneficiary:') == 'IntnlWireSwiftBic Benie'
  121. self.assertTrue(is_num_correct and is_name_correct and is_account_id_correct and is_amount_correct and
  122. is_subsidiary_correct and is_from_account_number_correct and is_notify_correct and is_process_date_correct and
  123. is_account_correct_orig_info and is_amount_correct_orig_info and is_to_correct_benef_info and
  124. 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")
  125. """
  126. def test_12_verify_second_recipient_section_submit_page(self):
  127. review_submit_page = self.current_page
  128. review_submit_page.expand_nth_rec(2)
  129. is_num_correct = review_submit_page.ret_num_nth_rec(2) == 2
  130. is_name_correct = review_submit_page.ret_name_nth_rec(2) == 'DomesticWire2'
  131. is_account_id_correct = 'DW6789' in review_submit_page.ret_account_id_nth_rec(2)
  132. is_amount_correct = review_submit_page.ret_amount_nth_rec(2) == '$20.35'
  133. is_subsidiary_correct = review_submit_page.ret_subs_nth_rec(2) == 'DallasWireOnly'
  134. is_from_account_number_correct = review_submit_page.ret_frm_acc_num_nth_rec(2) == '****-7887'
  135. is_notify_correct = review_submit_page.ret_notify_nth_rec(2) == 'No'
  136. is_process_date_correct = review_submit_page.ret_process_date_nth_rec(2) == time.strftime("%m/%d/%Y")
  137. is_account_correct_orig_info = '****-7887' in review_submit_page.ret_orig_ben_data_nth_rec('From:', 2)
  138. is_amount_correct_orig_info = review_submit_page.ret_orig_ben_data_nth_rec('Amount:', 2) == '$20.35'
  139. is_to_correct_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('To:', 2) == 'DomesticWire2'
  140. is_account_correct_benef_info = 'DW6789' in review_submit_page.ret_orig_ben_data_nth_rec('Account:', 2)
  141. is_routing_num_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('Routing Number:', 2) == '044444444'
  142. is_beneficiary_correct_benef_info = review_submit_page.ret_orig_ben_data_nth_rec('Beneficiary:', 2) == 'DomesticWire2'
  143. self.assertTrue(is_num_correct and is_name_correct and is_account_id_correct and is_amount_correct and
  144. is_subsidiary_correct and is_from_account_number_correct and is_notify_correct and is_process_date_correct and
  145. is_account_correct_orig_info and is_amount_correct_orig_info and is_to_correct_benef_info and
  146. is_account_correct_benef_info and is_routing_num_benef_info and is_beneficiary_correct_benef_info,
  147. "Checking that the information of the second recipient is correct")
  148. """
  149.  
  150. def test_13_approve_payment(self):
  151. review_submit_page = self.current_page
  152. modal = review_submit_page.click_approve()
  153. self.__class__.current_page = modal
  154. is_title_correct = modal.get_modal_title() == 'Payments Approved'
  155. is_success_icon_displayed = modal.is_success_icon_displayed()
  156. is_modal_text_color_correct = modal.get_modal_text_color() == 'rgba(0, 154, 64, 1)'
  157. is_modal_text_correct = modal.get_modal_text() == 'Your payments have been approved.'
  158. is_modal_amount_correct = modal.get_multi_approve_amount() == '2 (USD): $31.90'
  159. is_batch_id_correct = len(modal.get_multi_wire_modal_data("Batch ID:")) > 0
  160. is_from_correct = '2 accounts' in modal.get_multi_wire_modal_data("From:")
  161. is_to_correct = '2 accounts' in modal.get_multi_wire_modal_data("To:")
  162. is_send_as_correct = '2 subsidiaries' in modal.get_multi_wire_modal_data("Send Payment(s) As:")
  163. is_created_by_correct = ' AutoMultiWire One' in modal.get_multi_wire_modal_data("Created By:")
  164. is_download_link_present = modal.is_multi_approve_download_link_present()
  165. 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
  166. 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,
  167. "Checking that the modal information is correct")
  168.  
  169. def test_14_go_to_activity_center(self):
  170. modal = self.current_page
  171. modal.go_to_activity_center()
  172. activity_center = activity_center_page.ActivityCenterPage(self.driver)
  173. self.__class__.current_page = activity_center
  174. activity_center.wait_for_page_to_load()
  175. is_first_transaction_not_expanded = not activity_center.is_row_expanded(1)
  176. is_second_transaction_not_expanded = not activity_center.is_row_expanded(2)
  177. self.assertTrue(activity_center.is_activity_center_page_loaded and is_first_transaction_not_expanded and
  178. is_second_transaction_not_expanded, "Checking that the Activity Center got loaded")
  179.  
  180. def test_15_verify_title_first_trans(self):
  181. activity_center = self.current_page
  182. is_header_date_valid = len(activity_center.return_header_date(1)) > 0
  183. is_header_status_correct = activity_center.return_header_status(1) == 'Authorized'
  184. are_header_approvals_correct = activity_center.return_header_approvals(1) == '1 of 1'
  185. is_transaction_type_correct = 'International Wire' in activity_center.return_header_trans_type(1)
  186. is_account_correct = '*****-4321' in activity_center.return_header_account(1)
  187. is_amount_correct = activity_center.return_header_amount(1) == '$3.33'
  188. self.assertTrue(is_header_date_valid and are_header_approvals_correct and is_header_status_correct and
  189. is_transaction_type_correct and is_account_correct and is_amount_correct, "Checking that the header fields are correct for the first transaction")
  190. """
  191. def test_16_verify_title_second_trans(self):
  192. activity_center = self.current_page
  193. is_header_date_valid = len(activity_center.return_header_date(2)) > 0
  194. is_header_status_correct = activity_center.return_header_status(2) == 'Authorized'
  195. are_header_approvals_correct = activity_center.return_header_approvals(2) == '1 of 1'
  196. is_transaction_type_correct = 'International Wire' in activity_center.return_header_trans_type(2)
  197. is_account_correct = '****-9789' in activity_center.return_header_account(2)
  198. is_amount_correct = activity_center.return_header_amount(2) == '$22'
  199. self.assertTrue(is_header_date_valid and are_header_approvals_correct and is_header_status_correct and
  200. is_transaction_type_correct and is_account_correct and is_amount_correct, "Checking that the header fields are correct for the second transaction")
  201.  
  202. def test_17_verify_body_first_transs(self):
  203. activity_center = self.current_page
  204. activity_center.expand_nth_item(1)
  205. is_tracking_id_correct = len(activity_center.return_tracking_id()) > 0
  206. is_batch_id_correct = len(activity_center.return_batch_id()) > 0
  207. is_created_date_valid = len(activity_center.return_created_date1()) > 0
  208. is_created_by_correct = activity_center.return_created_by() == 'AutoMultiWire One'
  209. is_auth_date_valid = len(activity_center.return_auth_date()) > 0
  210. is_auth_by_correct = activity_center.return_auth_by() == 'AutoMultiWire One'
  211. is_process_date_valid = len(activity_center.return_process_date()) > 0
  212. is_from_account_correct = '****-7887' in activity_center.return_item_from_account()
  213. is_to_account_correct = 'XXX789' in activity_center.return_item_to_account()
  214. is_to_account_type_correct = 'Checking' in activity_center.return_item_to_account_type()
  215. is_originator_wire_header_correct = 'DallasWireHeader' in activity_center.return_item_originator_wire_header()
  216. is_amount_correct = activity_center.return_item_amount() == '$20.35'
  217. is_ben_wire_name_correct = activity_center.return_item_wire_name() == 'DomesticWire2'
  218. is_ben_fi_rout_num_correct = activity_center.return_item_beneficiary_routing_number() == 'XXXXX4444'
  219. is_ben_fi_name_correct = activity_center.return_item_beneficiary_name() == 'DomesticWire2'
  220. self.assertTrue(is_tracking_id_correct and is_batch_id_correct and is_created_by_correct and is_created_date_valid and
  221. is_auth_date_valid and is_auth_by_correct and is_process_date_valid and is_from_account_correct and
  222. is_to_account_correct and is_to_account_type_correct and is_originator_wire_header_correct and
  223. is_amount_correct and is_ben_wire_name_correct and is_ben_fi_rout_num_correct and is_ben_fi_name_correct,
  224. "Checking that the transaction information in the activity center is correct")
  225.  
  226. def test_18_transaction_boxes_activity_center(self):
  227. activity_center = self.current_page
  228. is_drafted_box_correct = activity_center.is_trans_fld_present('Drafted')
  229. is_approvals_box_present = activity_center.is_trans_fld_present('Approval(s)')
  230. is_authorized_box_present = activity_center.is_trans_fld_present('Authorized')
  231. is_processed_box_present = activity_center.is_trans_fld_present('Processed')
  232. is_draft_box_data_valid = activity_center.is_trans_fld_data_present('Drafted', 'AutoMultiWire One')
  233. is_approve_box_data_correct = activity_center.get_trans_fld_data('Approval(s)', 'AutoMultiWire One')
  234. authorized_box_has_data = activity_center.trans_fld_has_data('Authorized')
  235. processes_box_does_not_have_data = not activity_center.trans_fld_has_data('Processed')
  236. self.assertTrue(is_drafted_box_correct and is_approvals_box_present and is_authorized_box_present and is_processed_box_present
  237. and is_draft_box_data_valid and is_approve_box_data_correct and authorized_box_has_data and processes_box_does_not_have_data,
  238. "Checking that all the transaction boxes are present and their information is correct")
  239. """
  240. def test_19_log_off(self):
  241. self.menu = main_page.Menu(self.driver)
  242. self.menu.open_menu_item('Log Off')
  243. login = login_page.LoginPage(self.driver)
  244. self.__class__.current_page = login
  245. login.wait_for_page_to_load()
  246. self.assertTrue(login.is_login_page_loaded(), "Checking that the user logged off correctly")
  247.  
  248.  
  249. def setUp(self):
  250. self.util.set_up(self)
  251.  
  252. def tearDown(self):
  253. self.util.tear_down(self)
  254.  
  255. @classmethod
  256. def tearDownClass(cls):
  257. cls.util.close_the_browser(cls.driver)
  258.  
  259. if __name__ == '__main__':
  260. if len(sys.argv) == 2:
  261. MultiwireInternationalApproveTest.ENV = sys.argv.pop()
  262. if len(sys.argv) == 3:
  263. MultiwireInternationalApproveTest.BROWSER = sys.argv.pop()
  264. MultiwireInternationalApproveTest.ENV = sys.argv.pop()
  265. with open('test-reports/junit.xml', 'wb') as output:
  266. unittest.main(testRunner=xmlrunner.XMLTestRunner(output=output),
  267. failfast=False, buffer=False, catchbreak=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement