def test_g_tmode_be_live_invalid_url(self): wh_url = datagen.get_webhook_url_invalid() try: self.webhook_page.test_webhook_url(wh_url) self.webhook_page.close_test_wh() except Exception,e: self.driver.refresh() self.fail("test_tmode_be_live_invalid_url failed due to exception: "+ e.message)
def verify_response(self, wh_url): url = datagen.get_webhook_url_invalid() if wh_url == url: helper.wait_element_visible(self.driver,*WebHookLocator.wh_Test_ecode) return_code = self.driver.find_element(*WebHookLocator.wh_Test_ecode) assert return_code.text != '200' else: helper.wait_element_visible(self.driver,*WebHookLocator.wh_Test_scode) return_code = self.driver.find_element(*WebHookLocator.wh_Test_scode) assert return_code.text == '200'
def edit_webhook(self): helper.save_screen_shot(self.driver,"edit_webhook") helper.wait_element( self.driver, *WebHookLocator.webHookList_List) helper.wait_element_visible( self.driver, *WebHookLocator.webHookList_List) wh_rows = self.driver.find_elements(*WebHookLocator.webHookList_Rows) wh_url = datagen.get_webhook_url_invalid() for row in wh_rows: if row.text.find(wh_url) >= 0: helper.wait_element(self.driver,*WebHookLocator.edit_wb_Icon) helper.wait_element_visible(self.driver,*WebHookLocator.edit_wb_Icon) edit = row.find_element_by_class_name("icon-edit") edit.click() helper.save_screen_shot(self.driver,"edit_webhook_editing") time.sleep(1) selectBtn = row.find_elements_by_class_name("selectBtn") for select in selectBtn: select.click() helper.save_screen_shot(self.driver,"edit_webhook_editing2") time.sleep(1) selectoptions = row.find_elements_by_class_name("virtualCheckbox") for option in selectoptions: option.click() helper.save_screen_shot(self.driver,"edit_webhook_editing3") time.sleep(1) save = row.find_element_by_class_name("btnDashboard") save.click() helper.save_screen_shot(self.driver,"edit_webhook_editing4") helper.wait_element_visible(self.driver,*WebHookLocator.webhook_event_alert) warning = self.driver.find_element(*WebHookLocator.webhook_event_alert) warning.click() helper.save_screen_shot(self.driver,"edit_webhook_alert") time.sleep(1) selectBtn = row.find_elements_by_class_name("selectBtn") for select in selectBtn: select.click() time.sleep(1) selectoptions = row.find_elements_by_class_name("virtualCheckbox") for option in selectoptions: option.click() continue time.sleep(1) helper.save_screen_shot(self.driver,"edit_webhook_before_save") save = row.find_element_by_class_name("btnDashboard") save.click() helper.save_screen_shot(self.driver,"edit_webhook_after_save") time.sleep(1)
def test_i_tmode_remove_live_event(self): wh_url = datagen.get_webhook_url_invalid() self.webhook_page.delete_webhook(wh_url)
def test_f_tmode_add_live_url(self): wh_url = datagen.get_webhook_url_invalid() self.webhook_page.switchTo_TestMode() self.webhook_page.add_webhook(wh_url) assert self.webhook_page.verify_webhook_url(wh_url)
def test_a_add_live_url(self): # 添加任意存在且可链接的url wh_url = datagen.get_webhook_url_invalid() self.webhook_page.add_webhook(wh_url) assert self.webhook_page.verify_webhook_url(wh_url)