daily pastebin goal
29%
SHARE
TWEET

Untitled

iramirez May 31st, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ################################################################################
  2. ##
  3. ##  Filename:     TSTR_1138_edit_payee_unit_test.py
  4. ##
  5. ##  Description:  This unit test validates if the user is able to edit a payee.
  6. ##                (~atf/pages/ngam/transactions/messages.py)
  7. ##
  8. ################################################################################
  9.  
  10. import importer
  11. import unittest
  12. import sys
  13. import xmlrunner
  14. from lib import q2_library
  15. from pages.ngam import main_page, login_page
  16. from pages.ngam.billpay import billpay_page
  17. from proboscis.asserts import assert_true, assert_false
  18.  
  19.  
  20. class EditPayee(unittest.TestCase):
  21.     driver = None
  22.     util = None
  23.     ENV = 'CI'
  24.     BROWSER = 'CHROME_MAC'
  25.  
  26.     @classmethod
  27.     def setUpClass(cls):
  28.         cls.util = q2_library.Utilities()
  29.         cls.util.load_config(cls)
  30.         cls.data = cls.util.read_data_file('payments/TSTR_1138_edit_payee.dat')
  31.         cls.driver = cls.util.get_browser()
  32.         cls.url = cls.util.get_config("base_url")
  33.         cls.user = cls.util.get_credentials('autorelbp')
  34.         cls.password = cls.util.get_credentials('passwordlbp')
  35.  
  36.     def test_01_navigation(self):
  37.         self.driver.get(self.url)
  38.         self.driver.maximize_window()
  39.  
  40.     def test_02_login(self):
  41.         """Login to the app"""
  42.         login = login_page.LoginPage(self.driver)
  43.         login.wait_for_page_to_load()
  44.         login.enter_username(self.user)
  45.         login.enter_password(self.password)
  46.         principal_page = login.click_submit_button()
  47.         message = principal_page.validate_welcome_msg()
  48.         self.assertIn('Welcome back', message, 'Login Failed')
  49.  
  50.     def test_03_click_submenu_item(self):
  51.         """Open the iPay Multi-Billpay menu"""
  52.         iPay_multi_billpay = billpay_page.BillpayPage(self.driver)
  53.         side_bar_menu = main_page.Menu(self.driver)
  54.         side_bar_menu.open_menu_item("iPay Billpays")
  55.         iPay_multi_billpay.pause(5)
  56.         side_bar_menu.open_menu_child_item("iPay Multi-Billpay")
  57.         is_multibillpay_page_displayed = iPay_multi_billpay.validate_pay_bills_tab()
  58.         assert_true(is_multibillpay_page_displayed, "The Pay Bills tab is not displayed")
  59.  
  60.     def test_04_click_add_payee(self):
  61.         """Click on Add payee option and validate if the page is displayed"""
  62.         iPay_multi_billpay = billpay_page.BillpayPage(self.driver)
  63.         iPay_multi_billpay.click_add_payee()
  64.         is_page_displayed = iPay_multi_billpay.validate_add_payee_page()
  65.         assert_true(is_page_displayed, "The page Add Payee is not displayed")
  66.  
  67.     def test_05_add_payee(self):
  68.         """Add the payee and validate the success message"""
  69.         iPay_multi_billpay = billpay_page.BillpayPage(self.driver)
  70.         data = self.data.get("add payee")
  71.         iPay_multi_billpay.fill_in_payee_name(data.get("name"))
  72.         iPay_multi_billpay.select_payee_type(data.get("payee_type"))
  73.         iPay_multi_billpay.fill_in_payee_address1(data.get("address1"))
  74.         iPay_multi_billpay.fill_in_payee_city(data.get("city"))
  75.         iPay_multi_billpay.select_payee_state(data.get("state"))
  76.         iPay_multi_billpay.fill_in_payee_zip(data.get("zip"))
  77.         iPay_multi_billpay.fill_in_payee_area_code(data.get("area_cod"))
  78.         iPay_multi_billpay.fill_in_payee_phone(data.get("phone"))
  79.         iPay_multi_billpay.fill_account(data.get("account"))
  80.         iPay_multi_billpay.click_payee_save()
  81.         is_success_message_displayed = 'Your new Bill Payee has been successfully created.' == iPay_multi_billpay.get_modal_text()
  82.         assert_true(is_success_message_displayed, 'Success message is not displayed when trying to add the payee')
  83.  
  84.     def test_06_close_success_modal(self):
  85.         """Click in the Close button and validate if the payee was created"""
  86.         iPay_multi_billpay = billpay_page.BillpayPage(self.driver)
  87.         data = self.data.get("add payee")
  88.         iPay_multi_billpay.click_close__modal()
  89.         iPay_multi_billpay.wait_for_page_to_load()
  90.         is_payee_created = iPay_multi_billpay.validate_payee_name(data.get("name"))
  91.         assert_true(is_payee_created, "Payee was not created")
  92.  
  93.     def test_07_click_edit_payee(self):
  94.         """Click on Edit Payee"""
  95.         iPay_multi_billpay = billpay_page.BillpayPage(self.driver)
  96.         data = self.data.get("add payee")
  97.         iPay_multi_billpay.enter_search_term(data.get("name"))
  98.         iPay_multi_billpay.pause(5)
  99.         iPay_multi_billpay.click_elipse_options(data.get("name"))
  100.         iPay_multi_billpay.click_edit_payee_with_elipse_option(data.get("name"))
  101.         is_edit_pay_displayed = iPay_multi_billpay.validate_edit_page_is_displayed
  102.         assert_true(is_edit_pay_displayed, "Edit Payee page is not displayed")
  103.  
  104.     def test_08_edit_payee(self):
  105.         """Edit the payee and validate the success message"""
  106.         iPay_multi_billpay = billpay_page.BillpayPage(self.driver)
  107.         data = self.data.get("edit payee")
  108.         iPay_multi_billpay.edit_in_payee_nickname(data.get("nickname"))
  109.         iPay_multi_billpay.edit_in_payee_address1(data.get("address1"))
  110.         iPay_multi_billpay.click_payee_save()
  111.         is_success_message_displayed = 'Your new Bill Payee has been successfully saved.' == iPay_multi_billpay.get_modal_text()
  112.         assert_true(is_success_message_displayed, 'Success message is not displayed when trying to edit the payee')
  113.  
  114.     def test_09_close_success_modal(self):
  115.         """Click in the Close button and validate if Pay Bills tab is displayed"""
  116.         iPay_multi_billpay = billpay_page.BillpayPage(self.driver)
  117.         iPay_multi_billpay.click_close__modal()
  118.         is_multibillpay_page_displayed = iPay_multi_billpay.validate_pay_bills_tab()
  119.         assert_true(is_multibillpay_page_displayed, "The Pay Bills tab is not displayed")
  120.  
  121.     def test_10_validate_payee_address1(self):
  122.         """Click on Edit Payee and validate if the address1 is updated"""
  123.         iPay_multi_billpay = billpay_page.BillpayPage(self.driver)
  124.         data = self.data.get("edit payee")
  125.         iPay_multi_billpay.enter_search_term(data.get("nickname"))
  126.         iPay_multi_billpay.click_elipse_options(data.get("nickname"))
  127.         iPay_multi_billpay.click_edit_payee_with_elipse_option(data.get("nickname"))
  128.         iPay_multi_billpay.pause(5)
  129.         is_address1_updated = iPay_multi_billpay.is_address1_updated(data.get("addresstest"))
  130.         assert_true(is_address1_updated, "Address1 was not updated.")
  131.  
  132.     def setUp(self):
  133.         self.util.set_up(self)
  134.  
  135.     def tearDown(self):
  136.         self.util.tear_down(self)
  137.  
  138.     @classmethod
  139.     def tearDownClass(cls):
  140.         cls.util.close_the_browser(cls.driver)
  141.  
  142. if __name__ == '__main__':
  143.     q2_library.Utilities().set_parameters_to_this(EditPayee)
  144.     with open('test-reports/junit.xml', 'wb') as output:
  145.         unittest.main(testRunner=xmlrunner.XMLTestRunner(output=output, verbosity=2), failfast=False, buffer=False, catchbreak=False)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top