class Test_Alarm_Alert_Count(BaseTest): logger = LogGen.loggen() mail_id = ReadConfig.sisaManager() password = ReadConfig.password() def test_alarm_alert_count(self): self.logger.info( "*********************Test_003_01_Alarm Alert Count***********************" ) self.logger.info( "**************** Verify whether Alarm Count in the alarm alert page is showing same data as in Main company profile ******************" ) self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) alarm_count_company = self.driver.find_element( By.XPATH, "//span[@id='AlarmCount']").text alarm_count_alert_page = self.driver.find_element( By.XPATH, "//label[@id='lblcount']").text if alarm_count_company in alarm_count_alert_page: assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "alarm_alert_count.png") assert False self.logout_obj.eots_logout("yes") self.logger.info( "********************* Test_003_01_Passed ***********************")
class Test_Alert_In_create_Window(BaseTest): logger = LogGen.loggen() mail_id = ReadConfig.sisaManager() password = ReadConfig.password() def test_more_filter_apply(self): self.logger.info( "*********************Test_006_01_More Filters Apply ***********************" ) self.logger.info( "**************** Verify whether Filters gets Applied on the Records ******************" ) self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() self.driver.find_element(By.XPATH, "//select[@id='ddl_alarm']").click() field_droplist = self.driver.find_elements( By.XPATH, "//select[@id='ddl_alarm']/option") self.driver.find_element( By.XPATH, "//select[@id='ddl_alarm_operators']").click() operator_droplist = self.driver.find_elements( By.XPATH, "//select[@id='ddl_alarm_operators']/option") ECS_field = "Source IP" operator = "Should" Keyword = "10.100.7.22" col = str(5) self.Alarm_obj.filter_search(field_droplist, operator_droplist, ECS_field, operator, Keyword) time.sleep(2) # Validating the Results alerts = [] length = len( self.driver.find_elements_by_xpath("//*[@id='loglist']/tr") ) # Checking the number of records exist in the table for i in range(1, length + 1): rows = self.driver.find_element_by_xpath("//*[@id='loglist']/tr[" + str(i) + "]/td[" + col + "]").text alerts.append(rows) def chkList(alerts): return len(set(alerts)) == 1 if Keyword in alerts: assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "more_filter_apply.png") assert False self.logout_obj.eots_logout("yes") self.logger.info( "********************* Test_006_01_Passed ***********************")
class Test_ddt(BaseTest): logger = LogGen.loggen() """test_case 1""" """Verify the headers present in the Overview Dashboard""" path = "C:/Users/kruthi.p/PycharmProjects/EOTS_Automation_2021/TestData/TestData.xlsx" # mail_id = ReadConfig.sisaManager() # password =ReadConfig.password() @pytest.mark.sanity def test_home_page_title(self): self.logger.info( "*********************Test_001_Overview Dashboard***********************" ) self.logger.info( "****************Verify the headers present in the Overview Dashboard ******************" ) self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.row = XLUtilis.getRowCount(self.path, "Sheet1") print(self.row) lst_result_status = [] for r in range(2, self.row + 1): self.mail_id = XLUtilis.readData(self.path, "Sheet1", r, 1) self.password = XLUtilis.readData(self.path, "Sheet1", r, 2) self.exp = XLUtilis.readData(self.path, "Sheet1", r, 3) self.login_obj.eots_login(self.mail_id, self.password) time.sleep(3) if "SISA EOT" == "SISA EOT": assert True if self.exp == "Pass": self.logger.info("****Passed*****") self.logout_obj.eots_logout("yes") lst_result_status.append("fail") elif self.exp == "Fail": self.logger.info("****Passed*****") self.logout_obj.eots_logout("yes") lst_result_status.append("Fail") else: self.driver.save_screenshot(".\\Screenshots\\" + "test_home_page_title.png") assert False self.logger.info( "********************* Test_001_Passed ***********************" ) def test_home_page_module(self): self.login_obj = LoginPage(self.driver) self.driver.find_element_by_id("Rawfilter").click()
class Test_Alert_In_create_Window(BaseTest): logger = LogGen.loggen() mail_id = ReadConfig.sisaManager() password = ReadConfig.password() def test_more_filter_close(self): self.logger.info( "*********************Test_007_01_Alarm Alert 10 Records Per page ***********************" ) self.logger.info( "**************** Verify whether More filter window is closed when clicked on close button present in More Filters ******************" ) self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() self.driver.find_element(By.XPATH, "//select[@id='ddl_alarm']").click() field_droplist = self.driver.find_elements( By.XPATH, "//select[@id='ddl_alarm']/option") self.driver.find_element( By.XPATH, "//select[@id='ddl_alarm_operators']").click() operator_droplist = self.driver.find_elements( By.XPATH, "//select[@id='ddl_alarm_operators']/option") ECS_field = "Source IP" operator = "Should" Keyword = "10.100.7.22" col = str(5) self.Alarm_obj.filter_search(field_droplist, operator_droplist, ECS_field, operator, Keyword) self.Alarm_obj.close() ele_close = self.driver.find_element( By.XPATH, "//button[@type='button' and text()='Close']") if ele_close.is_displayed() and ele_close.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "close_button_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info( "********************* Test_007_01_Passed ***********************")
class Test_Alarm_Alert_Page_Titles(BaseTest): logger = LogGen.loggen() mail_id = ReadConfig.sisaManager() password = ReadConfig.password() def test_alarm_alert_page_title(self): self.logger.info( "*********************Test_001_Alarm Alert Page Title***********************" ) self.logger.info( "****************Verify whether Alarm Alert list page is opened when clicked on Alarm Alert Menu ******************" ) self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() exp_res = "Alarm Alerts List" act_res = self.driver.find_element( By.XPATH, "//h3[@class='panel-title inline-block']").text if exp_res == act_res: assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "alarm_alert_page_title.png") assert False self.logout_obj.eots_logout("yes") self.logger.info( "********************* Test_001_Passed ***********************") def test_alarm_alert_create_ticket(self): self.logger.info( "*********************Test_002_Alarm Alert_Create_Tickets_Page Title***********************" ) self.logger.info( "****************Verify whether Ticket creation page is opened when clicked on Create Ticket ******************" ) self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.checkbox() time.sleep(2) self.Alarm_obj.create_tickets() time.sleep(2) exp_res = "Create Ticket for Alarms" act_res = self.driver.find_element( By.XPATH, "//span[@id='ui-id-2' and text()='Create Ticket for Alarms']").text self.Alarm_obj.create_ticket_close() if exp_res == act_res: assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "alarm_alert_create_ticket.png") assert False self.logout_obj.eots_logout("yes") self.logger.info( "********************* Test_002_Passed ***********************") def test_alarm_alert_view_message_title(self): self.logger.info( "*********************Test_003_Alarm Alert View Message Page Title***********************" ) self.logger.info( "****************Verify whether View Message is window is opened when clicked on View Message ******************" ) self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.view_message() exp_res = "Message" act_res = self.driver.find_element( By.XPATH, "//span[@id='ui-id-1' and text()='Message']").text self.Alarm_obj.view_close() if exp_res == act_res: assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "alarm_alert_view_message_title.png") assert False self.logout_obj.eots_logout("yes") self.logger.info( "********************* Test_003_Passed ***********************")
class Test_Element_Presence(BaseTest): logger= LogGen.loggen() mail_id = ReadConfig.sisaManager() password = ReadConfig.password() def test_export_to_excel_presence(self): self.logger.info("*********************Test_002_01_Export to Excel button visibility***********************") self.logger.info( "****************Verify whether Import button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() time.sleep(3) ele_export_all_to_excel = self.driver.find_element(By.XPATH, "//button[@id='btnExcel']") if ele_export_all_to_excel.is_displayed() and ele_export_all_to_excel.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "export_to_excel_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_01_Passed ***********************") def test_create_ticket_presence(self): self.logger.info("*********************Test_002_02_Create Tickets button visibility***********************") self.logger.info( "****************Verify whether Create Tickets button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() time.sleep(3) ele_create_ticket = self.driver.find_element(By.XPATH, "//button[@id='btnTicket']") if ele_create_ticket.is_displayed() and ele_create_ticket.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "create_ticket_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_02_Passed ***********************") def test_import_presence(self): self.logger.info("*********************Test_002_03_Import button visibility***********************") self.logger.info( "****************Verify whether Import button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() time.sleep(3) ele_import = self.driver.find_element(By.XPATH, "//button[@type='submit' and text()='Import']") if ele_import.is_displayed() and ele_import.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "import_button_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_03_Passed ***********************") def test_delete_presence(self): self.logger.info("*********************Test_002_04_Delete button visibility**********************") self.logger.info( "****************Verify whether delete button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() time.sleep(3) ele_delete = self.driver.find_element(By.XPATH, "//button[@type='submit' and text()='Delete']") if ele_delete.is_displayed() and ele_delete.is_enabled(): assert False else: self.driver.save_screenshot(".\\Screenshots\\" + "Delete_button_presence.png") assert True self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_04_Passed ***********************") def test_save_apply_presence(self): self.logger.info("*********************Test_002_05_Save and Apply button visibility***********************") self.logger.info( "****************Verify whether save and apply button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() time.sleep(3) ele_save_apply = self.driver.find_element(By.XPATH, "//button[@type='submit' and text()='Save & Apply']") if ele_save_apply.is_displayed() and ele_save_apply.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "save_and_apply_button_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_05_Passed ***********************") def test_apply_presence(self): self.logger.info("*********************Test_002_06_Apply button visibility***********************") self.logger.info( "****************Verify whether Apply button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() time.sleep(3) ele_apply = self.driver.find_element(By.XPATH, "//button[@type='submit' and text()='Apply']") if ele_apply.is_displayed() and ele_apply.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "apply_button_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_06_Passed ***********************") def test_clear_presence(self): self.logger.info("*********************Test_002_07_Clear button visibility***********************") self.logger.info( "****************Verify whether Clear button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() time.sleep(3) ele_clear = self.driver.find_element(By.XPATH, "//button[@type='button' and text()='Clear']") if ele_clear.is_displayed() and ele_clear.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "clear_button_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_07_Passed ***********************") def test_close_presence(self): self.logger.info("*********************TTest_002_08_Close button visibility***********************") self.logger.info( "****************Verify whether Close button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() time.sleep(3) ele_close = self.driver.find_element(By.XPATH, "//button[@type='button' and text()='Close']") if ele_close.is_displayed() and ele_close.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "close_button_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_08_Passed ***********************") @pytest.mark.sanity def test_Ticket_close_presence(self): self.logger.info("*********************TTest_002_09_Close button visibility***********************") self.logger.info( "****************Verify whether Close button is available and is enabled when clicked on More filters ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.checkbox() time.sleep(1) self.Alarm_obj.create_tickets() time.sleep(3) target = self.driver.find_element(By.XPATH,"//*[@id='logticketlist']/tr[10]") self.driver.execute_script('arguments[0].scrollIntoView(true);',target) ele_close = self.driver.find_element(By.XPATH,"/html/body/div[9]/div[3]/div/button[1]") if ele_close.is_displayed() and ele_close.is_enabled(): assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "close_button_presence.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_002_09_Passed ***********************")
class Test_Alert_In_create_Window(BaseTest): logger = LogGen.loggen() mail_id = ReadConfig.sisaManager() password = ReadConfig.password() TestDatapath = "C:/Users/kruthi.p/PycharmProjects/EOTS_Automation_2021/TestData/TestData.xlsx" def test_more_filter_save_apply(self): self.logger.info( "*********************Test_013_Alarm Alert 10 Records Per page ***********************" ) self.logger.info( "**************** Verify whether More filter window is closed when clicked on close button present in More Filters ******************" ) self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.row = XLUtilis.getRowCount(self.TestDatapath, "Sheet1") print(self.row) lst_result_status = [] self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id, self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) self.Alarm_obj.more_filter() self.driver.find_element(By.XPATH, "//select[@id='ddl_alarm']").click() field_droplist = self.driver.find_elements( By.XPATH, "//select[@id='ddl_alarm']/option") self.driver.find_element( By.XPATH, "//select[@id='ddl_alarm_operators']").click() operator_droplist = self.driver.find_elements( By.XPATH, "//select[@id='ddl_alarm_operators']/option") for r in range(2, self.row + 1): self.ECS_field = XLUtilis.readData(self.TestDatapath, "Sheet1", r, 1) self.operator = XLUtilis.readData(self.TestDatapath, "Sheet1", r, 2) self.Keyword = XLUtilis.readData(self.TestDatapath, "Sheet1", r, 3) self.col = (XLUtilis.readData(self.TestDatapath, "Sheet1", r, 4)) self.Alarm_obj.filter_search(field_droplist, operator_droplist, self.ECS_field, self.operator, "10.100.7.22") self.Alarm_obj.apply() alerts = [] length = len( self.driver.find_elements_by_xpath("//*[@id='loglist']/tr") ) # Checking the number of records exist in the table for i in range(1, length + 1): rows = self.driver.find_element_by_xpath("//*[@id='loglist']/tr[" + str(i) + "]/td[" + str(self.col) + "]").text alerts.append(rows) def chkList(alerts): return len(set(alerts)) == 1 if self.Keyword in alerts: assert True else: self.driver.save_screenshot(".\\Screenshots\\" + "more_filter_apply.png") assert False self.logout_obj.eots_logout("yes") self.logger.info( "********************* Test_009_Passed ***********************")
class Test_Alarm_Alert_records_per_page(BaseTest): logger= LogGen.loggen() mail_id = ReadConfig.sisaManager() password = ReadConfig.password() def test_alarm_alert_10_records_per_page(self): self.logger.info("*********************Test_004_01_Alarm Alert 10 Records Per page ***********************") self.logger.info("**************** Verify whether only 10 records are shown in the table when records per page is selected as 10 ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id,self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) el =self.driver.find_element(By.XPATH,"//select[@name='dt_basic_length']") for option in el.find_elements_by_tag_name('option'): if option.text=='10': option.click() break table_length =len(self.driver.find_elements(By.XPATH,"//*[@id='loglist']/tr")) print(table_length) if table_length <=10: assert True else: self.driver.save_screenshot(".\\Screenshots\\"+ "alarm_alert_10_records_per_page.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_004_01_Passed ***********************") def test_alarm_alert_20_records_per_page(self): self.logger.info("*********************Test_004_02_Alarm Alert 20 Records Per page ***********************") self.logger.info("**************** Verify whether only 20 records are shown in the table when records per page is selected as 10 ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id,self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) el =self.driver.find_element(By.XPATH,"//select[@name='dt_basic_length']") for option in el.find_elements_by_tag_name('option'): if option.text=='20': option.click() break table_length =len(self.driver.find_elements(By.XPATH,"//*[@id='loglist']/tr")) print(table_length) if table_length <=20: assert True else: self.driver.save_screenshot(".\\Screenshots\\"+ "alarm_alert_20_records_per_page.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_004_02_Passed ***********************") def test_alarm_alert_30_records_per_page(self): self.logger.info("*********************Test_004_03_Alarm Alert 30 Records Per page ***********************") self.logger.info("**************** Verify whether only 30 records are shown in the table when records per page is selected as 10 ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id,self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) el =self.driver.find_element(By.XPATH,"//select[@name='dt_basic_length']") for option in el.find_elements_by_tag_name('option'): if option.text=='30': option.click() break table_length =len(self.driver.find_elements(By.XPATH,"//*[@id='loglist']/tr")) print(table_length) if table_length <=30: assert True else: self.driver.save_screenshot(".\\Screenshots\\"+ "alarm_alert_30_records_per_page.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_004_03_Passed ***********************") def test_alarm_alert_40_records_per_page(self): self.logger.info("*********************Test_004_04_Alarm Alert 40 Records Per page ***********************") self.logger.info("**************** Verify whether only 40 records are shown in the table when records per page is selected as 10 ******************") self.login_obj = LoginPage(self.driver) self.logout_obj = LogoutPage(self.driver) self.Alarm_obj = AlarmAlert(self.driver) self.login_obj.eots_login(self.mail_id,self.password) self.Alarm_obj.alarm_alert_click() time.sleep(2) Drop_down_value =[10] self.driver.find_element(By.XPATH,"//select[@name='dt_basic_length']").click() droplist=self.driver.find_elements(By.XPATH,"//select[@name='dt_basic_length']/option") self.Alarm_obj.records_per_page(droplist,40) table_length =len(self.driver.find_elements(By.XPATH,"//*[@id='loglist']/tr")) print(table_length) if table_length ==40: assert True else: self.driver.save_screenshot(".\\Screenshots\\"+ "alarm_alert_40_records_per_page.png") assert False self.logout_obj.eots_logout("yes") self.logger.info("********************* Test_004_04_Passed ***********************")