コード例 #1
0
 def setUpClass(cls):
     cls.driver = webdriver.Chrome(
         executable_path="E:\\chromedriver_win32\\chromedriver.exe")
     cls.driver.maximize_window()
     BankAPP_CommonFunctions.login_bankApp(cls.driver,
                                           BankAPP_CommonFunctions.username,
                                           BankAPP_CommonFunctions.Password)
     BankAPP_CommonFunctions.close_popup(cls.driver)
コード例 #2
0
    def test_enquire_balance(self):
        try:
            BankAPP_CommonFunctions.click_menu_by_partial_link_text(
                "Balance Enq", "Balance Enquiry")

        except Exception as e:
            print("Exception found in balance enquiry test method :",
                  type(e).__name__)
            print(
                'Error on line {} of ' + __name__ +
                " of class ".format(sys.exc_info()[-1].tb_lineno),
                type(e).__name__, e)
コード例 #3
0
def test_8delete_account(setup):
    print("8delete_account called............")
    BankAPP_CommonFunctions.login_bankApp(driver,
                                          BankAPP_CommonFunctions.username,
                                          BankAPP_CommonFunctions.Password)
    BankAPP_CommonFunctions.close_popup(driver)
    account_id_delete = TC_DeleteAccountTest.create_dummy_account(driver)
    print("Acc id to delete:", account_id_delete)
    BankAPP_CommonFunctions.close_popup(driver)
    BankAPP_CommonFunctions.click_menu_by_partial_link_text(
        driver, "Delete Acc", "Delete Account")
    TC_DeleteAccountTest.search_acc_BYID_Delete(driver, account_id_delete,
                                                "Yes")
    BankAPP_CommonFunctions.logout(driver)
コード例 #4
0
 def create_dummy_account(driver):
     total_row = Excelutility.get_row_count(TC_DeleteAccountTest.Path,TC_DeleteAccountTest.Sheet_Name)
     print("Total Row:",total_row)
     last_cust_id = Excelutility.read_data(TC_DeleteAccountTest.Path,TC_DeleteAccountTest.Sheet_Name,total_row,1)
     print("Last Cust Id :",last_cust_id)
     BankAPP_CommonFunctions.close_popup(driver)
     BankAPP_CommonFunctions.click_menu_by_perform_mouse_action(driver, "New Acc", "new account")
     TC_AddAccountTest.add_account_details(driver,last_cust_id,"Savings",3000)
     TC_AddAccountTest.validate_account_info(driver,"Savings",3000)
     total_row_after_addition = Excelutility.get_row_count(TC_DeleteAccountTest.Path, TC_DeleteAccountTest.Sheet_Name)
     print("Total row in excel after adding new account:",total_row_after_addition)
     account_id_to_delete = Excelutility.read_data(TC_DeleteAccountTest.Path,TC_DeleteAccountTest.Sheet_Name,
                                                    total_row_after_addition,2)
     print("Account Id to delete is :",account_id_to_delete)
     return account_id_to_delete
コード例 #5
0
def test_2menu_click_Validation_in_sequence(setup):
    print("2menu_click_Validation_in_sequence called........")
    BankAPP_CommonFunctions.login_bankApp(driver,
                                          BankAPP_CommonFunctions.username,
                                          BankAPP_CommonFunctions.Password)
    BankAPP_CommonFunctions.close_popup(driver)
    dict_menu = {
        "Manag": "Manager",
        "New Cust": "New Customer",
        "Edit Cust": "Edit Customer",
        "Delete Cust": "Delete Customer",
        "New Acc": "new account",
        "Edit Acc": "Edit Account",
        "Delete Acc": "Delete Account",
        "Deposit": "Deposit",
        "Withdrawal": "Withdrawal",
        "Fund Transfer": "Fund transfer",
        "Change Pass": "******",
        "Balance Enq": "Balance Enquiry",
        "Mini State": "Mini Statement",
        "Customised State": "Customized Statement"
    }

    TC_MenuClickInSequenceTest.menu_click_sequence(driver, dict_menu)
    BankAPP_CommonFunctions.logout(driver)
コード例 #6
0
def test_7edit_account(setup):
    print("7edit_account called........")
    BankAPP_CommonFunctions.login_bankApp(driver,
                                          BankAPP_CommonFunctions.username,
                                          BankAPP_CommonFunctions.Password)
    BankAPP_CommonFunctions.close_popup(driver)
    BankAPP_CommonFunctions.click_menu_by_partial_link_text(
        driver, "Edit Acc", "Edit Account")
    acc_id = BankAPP_CommonFunctions.get_cust_id_frm_repo(
        "LastAdded_AccountID_CustID.txt", 1)
    searched = TC_EditAccountTest.search_account_BYID(driver, acc_id)
    print(searched)
    TC_EditAccountTest.edit_account_type(driver)

    # Click continue
    driver.find_element_by_xpath(
        "//*[@id='account']/tbody/tr[11]/td/a").click()
    driver.implicitly_wait(1)
    BankAPP_CommonFunctions.logout(driver)
コード例 #7
0
def test_5delete_customer(setup):
    print("5delete_customer called..............")
    BankAPP_CommonFunctions.login_bankApp(driver,
                                          BankAPP_CommonFunctions.username,
                                          BankAPP_CommonFunctions.Password)
    BankAPP_CommonFunctions.click_menu_by_partial_link_text(
        driver, "Delete Cust", "Delete Customer")
    TC_DeleteCustomerTest.search_cust_BYID_Delete(driver, "19943", "Yes")
    BankAPP_CommonFunctions.logout(driver)
コード例 #8
0
def test_6add_account(setup):
    print("6add_account called............")
    BankAPP_CommonFunctions.login_bankApp(driver,
                                          BankAPP_CommonFunctions.username,
                                          BankAPP_CommonFunctions.Password)
    BankAPP_CommonFunctions.close_popup(driver)
    BankAPP_CommonFunctions.click_menu_by_perform_mouse_action(
        driver, "New Acc", "new account")
    cust_id = BankAPP_CommonFunctions.get_cust_id_frm_repo(
        "LastAdded_CustID.txt", 0)
    account_type, initial_amt = TC_AddAccountTest.add_account_details(
        driver, cust_id, "Current", 3000)
    print(account_type, initial_amt)
    TC_AddAccountTest.validate_account_info(driver, account_type, initial_amt)

    # Click continue
    driver.find_element_by_xpath(
        "//*[@id='account']/tbody/tr[11]/td/a").click()
    driver.implicitly_wait(1)
    BankAPP_CommonFunctions.logout(driver)
コード例 #9
0
def test_4edit_customer(setup):
    print("4edit_customer................")
    BankAPP_CommonFunctions.login_bankApp(driver,
                                          BankAPP_CommonFunctions.username,
                                          BankAPP_CommonFunctions.Password)
    BankAPP_CommonFunctions.click_menu_by_partial_link_text(
        driver, "Edit Cust", "Edit Customer")
    cust_id_modify = BankAPP_CommonFunctions.get_cust_id_frm_repo(
        "LastAdded_CustID.txt", 0)
    bool_true = TC_EditCustmerTest.search_cust_BYID(driver, cust_id_modify)
    print("ID has Searched?:", bool_true)

    TC_EditCustmerTest.edit_address(driver, cust_id_modify)
    # Click Continue
    driver.find_element_by_xpath(
        "//*[@id='customer']/tbody/tr[14]/td/a").click()
    driver.implicitly_wait(1)
    BankAPP_CommonFunctions.logout(driver)
コード例 #10
0
def test_3add_customer(setup):
    print("3add_customer called..........")
    BankAPP_CommonFunctions.login_bankApp(driver,
                                          BankAPP_CommonFunctions.username,
                                          BankAPP_CommonFunctions.Password)
    BankAPP_CommonFunctions.click_menu_by_partial_link_text(
        driver, "New Cust", "New Customer")
    TC_AddCustomerTest.add_customer(driver, "M")
    TC_AddCustomerTest.validate_custinfo(driver)

    # Click Continue
    driver.find_element_by_xpath(
        "//*[@id='customer']/tbody/tr[14]/td/a").click()
    driver.implicitly_wait(1)
    BankAPP_CommonFunctions.logout(driver)
コード例 #11
0
 def tearDownClass(cls):
     BankAPP_CommonFunctions.close_popup(cls.driver)
     # BankAPP_CommonFunctions.logout(cls.driver)
     cls.driver.implicitly_wait(1)
コード例 #12
0
    def login_with_diff_credentials(driver, excel_path, excel_sheet, app_url):
        rows = Excelutility.get_row_count(excel_path, excel_sheet)
        # self.site_open()

        for row in range(2, rows + 1):
            print(row)
            username = Excelutility.read_data(excel_path, excel_sheet, row, 1)
            print("Current username:"******"Current Password:"******"uid").send_keys(username)
            driver.find_element_by_name("password").send_keys(password)
            time.sleep(1)
            error = "Shri"
            try:
                driver.find_element_by_xpath(
                    "/html/body/form/table/tbody/tr[3]/td[2]/input[1]").click(
                    )
                time.sleep(1)
                if BankAPP_CommonFunctions.get_modal_alert(driver):
                    error = driver.switch_to.alert.text
                    driver.switch_to.alert.accept()
                    print("Login Failed with :", error)
                    Excelutility.write_data(excel_path, excel_sheet, row, 3,
                                            "Test Failed")
                else:
                    if "Guru99 Bank Manager HomePage" in driver.title:
                        print("Login is successful")
                        Excelutility.write_data(excel_path, excel_sheet, row,
                                                3, "Test Passed")
                    else:
                        print("Failed to login")
                        Excelutility.write_data(excel_path, excel_sheet, row,
                                                3, "Test Failed")
            except Exception as e:
                print('Error on line {}'.format(sys.exc_info()[-1].tb_lineno),
                      type(e).__name__, e)
                # print("Failed to login as", error)
                Excelutility.write_data(excel_path, excel_sheet, row, 3,
                                        "Test Failed")
                driver.refresh()
                driver.get(app_url)
                driver.set_page_load_timeout(10)
            finally:
                print("Completed Iteration with excel row no :", row)

            if "User or Password is not valid" not in error:
                BankAPP_CommonFunctions.close_popup(driver)
                driver.execute_script(
                    "window.scrollBy(0,document.body.scrollHeight)")
                time.sleep(1)
                BankAPP_CommonFunctions.logout(driver)

    # def test_validationNavigation(self):
    #     self.login_with_diff_credentials(self.driver,self.Path,self.SheetName,self.url)

    # @classmethod
    # def tearDownClass(cls):
    #     cls.driver.close()


# if __name__ == "__main__":
#     unittest.main()
コード例 #13
0
    def menu_click_sequence(driver,dict_menu):
        try:
            for key in dict_menu:
                print("Key:",key)
                if key == "New Acc" or key == "Deposit" or key == "Withdrawal" or key == "Fund Transfer":
                    print(dict_menu[key])
                    BankAPP_CommonFunctions.click_menu_by_perform_mouse_action(driver,key,str(dict_menu[key]))
                else:
                    if key == "Delete Acc":
                        driver.execute_script("window.scrollBy(0,1000)", "")
                        time.sleep(2)
                    print("Value:",dict_menu[key])
                    BankAPP_CommonFunctions.click_menu_by_partial_link_text(driver,key,str(dict_menu[key]))
                BankAPP_CommonFunctions.close_popup(driver)
        except Exception as e:
            print("Exception found in menu_click_sequence method",type(e).__name__)
            print('Error in menu_click_sequence method on line {}'.format(sys.exc_info()[-1].tb_lineno),type(e).__name__,e)

    # def test_menu_click_Validation_InSequence(self):
    #     try:
    #         self.menu_click_sequence(self.driver,self.dict_menu)

            '''self.click_menu_by_partial_link_text("Manag","Manager")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("New Cust", "New Customer")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("Edit Cust", "Edit Customer")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("Delete Cust", "Delete Customer")
            # BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_perform_mouse_action("New Acc", "new account")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("Edit Acc", "Edit Account")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("Delete Acc", "Delete Account")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.driver.execute_script("window.scrollBy(0,1000)", "")
            time.sleep(2)

            self.click_menu_by_perform_mouse_action("Deposit", "Deposit")  # Amount Deposit Form
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_perform_mouse_action("Withdrawal", "Withdrawal")  # Amount Withdrawal Form
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_perform_mouse_action("Fund Transfer", "Fund transfer")  # Fund transfer
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("Change Pass", "Change Password")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("Balance Enq", "Balance Enquiry")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("Mini State", "Mini Statement")
            BankApp_CommonFunctons.close_popup(self.driver)

            self.click_menu_by_partial_link_text("Customised State", "Customized Statement")
            BankApp_CommonFunctons.close_popup(self.driver)'''

        # except Exception as e:
        #     print("Exception from Menu Click in Sequence:", type(e).__name__)
        #     print('Error on line {}'.format(sys.exc_info()[-1].tb_lineno), type(e).__name__, e)

    # @classmethod
    # def tearDownClass(cls):
    #     BankAPP_CommonFunctions.logout(cls.driver)
    #     cls.driver.close()


# if __name__ == "__main__":
#   unittest.main()