Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. import importer
  2. import unittest
  3. import xmlrunner
  4. import time
  5. from lib import q2_library, modal_page
  6. from pages.ngam import main_page, login_page
  7. from pages.ngam.transactions import activity_center_page
  8.  
  9.  
  10. class TSTR_1985_DA_zerolimit_eftps_Approve(unittest.TestCase):
  11. driver = None
  12. util = None
  13. ENV = 'CI'
  14. BROWSER = 'CHROME_MAC'
  15. TRACKING_ID = None
  16. calendar_end = None
  17. calendar_start = None
  18.  
  19. @classmethod
  20. def setUpClass(cls):
  21. cls.util = q2_library.Utilities()
  22. cls.util.load_config(cls)
  23. cls.input = cls.util.read_data_file("payments/tstr_1985_data.json")
  24. cls.driver = cls.util.get_browser(5)
  25. cls.url = cls.util.get_config("base_url")
  26. cls.user = cls.util.get_credentials('dual_action_user')
  27. cls.password = cls.util.get_credentials('password_ma')
  28. cls.second_user = cls.util.get_credentials('dual_actionfx_user_1')
  29. cls.current_page = None
  30. cls.tracking_id = None
  31.  
  32. def test_01_navigation(self):
  33. """Opening the Browser"""
  34. self.driver.get(self.url)
  35. self.driver.maximize_window()
  36. self.assertIn("4", self.driver.title, "Checking the title has the correct value")
  37.  
  38. def test_02_login_successful(self):
  39. """Login the app"""
  40. login = login_page.LoginPage(self.driver)
  41. login.enter_username(self.user)
  42. login.enter_password(self.password)
  43. main_page = login.click_submit_button()
  44. msg = main_page.validate_welcome_msg()
  45. self.assertIn("Welcome back", msg, "Login was successful")
  46.  
  47. def test_04_tax_payments(self):
  48. """Going to tax payments"""
  49. menu = main_page.Menu(self.driver)
  50. menu.open_menu_item(self.input["commercial_menu"])
  51. tax_payment_page = menu.open_menu_child_item(self.input["tax_menu"])
  52. self.__class__.current_page = tax_payment_page
  53. tax_payment_page.wait_for_page_to_load()
  54. self.assertTrue(tax_payment_page.is_page_loaded(), "Checking if the tax payments page is loaded")
  55.  
  56. def test_05_search_tax_forms(self):
  57. """Going to tax payments"""
  58. tax_payment_page = self.current_page
  59. #tax_payment_page.scroll_the_page(x=0, y =1)
  60. tax_payment_page.search_federal_forms(self.input["federal_search"])
  61. tax_payment_form = tax_payment_page.click_on_selected_form(self.input["form1041"])
  62. self.__class__.current_page = tax_payment_form
  63. self.assertTrue(tax_payment_form.is_page_loaded(),"The Form page is not present")
  64.  
  65. def test_06_create_new_tax(self):
  66.  
  67. tax_payment_form = self.current_page
  68. tax_payment_form.select_payment_from(self.input["payment_from"])
  69. tax_payment_form.select_from_account(self.input["from_account"])
  70. tax_payment_form.fill_payment_amount_txt(self.input["payment_amount"])
  71. calendar = tax_payment_form.get_calendar('single')
  72. calendar.select_date(0,False,1)
  73. tax_payment_form.select_tax_type(self.input["tax_type"])
  74. calendar = tax_payment_form.get_calendar('end')
  75. calendar.select_date(0, True, 1)
  76. tax_payment_form = self.current_page
  77. tax_payment_form.pause(3)
  78. warning_msg = tax_payment_form.check_for_alac_warning_msg(self.input["warning_msg"])
  79. warning_msg2 = tax_payment_form.check_for_alac_warning_msg(self.input["warning_msg2"])
  80. is_draft_enabled = tax_payment_form.is_draft_enabled()
  81. is_approve_disabled = not tax_payment_form.is_approve_enabled()
  82. self.assertTrue(warning_msg and warning_msg2 and is_draft_enabled and is_approve_disabled is False,
  83. "Some of the validations are not correct")
  84.  
  85. def test_07_validate_draft_modal_page(self):
  86.  
  87. tax_payment_form = self.current_page
  88.  
  89.  
  90.  
  91.  
  92.  
  93. def setUp(self):
  94. self.util.set_up(self)
  95.  
  96. def tearDown(self):
  97. self.util.tear_down(self)
  98.  
  99. @classmethod
  100. def tearDownClass(cls):
  101. cls.util.close_the_browser(cls.driver)
  102.  
  103.  
  104. if __name__ == '__main__':
  105. q2_library.Utilities().set_parameters_to_this(TSTR_1985_DA_zerolimit_eftps_Approve)
  106. with open('test-reports/TSTR_1985_DA_zerolimit_eftps_Approve.xml', 'wb') as output:
  107. unittest.main(testRunner=xmlrunner.XMLTestRunner(output=output, verbosity=2),
  108. failfast=False, buffer=False, catchbreak=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement