def test_edit_comment_with_ISP_input1(self): # create post go_to_posts_page_from_admin_ui_page(self) # todo: 整理page post_name = 'post_name' create_a_post(self, post_name) go_to_admin_ui_page_from_comments_page(self) go_to_comments_page_from_admin_ui_page(self) comment_author = 'Demo User' post_name = 'post_name' create_a_comment(self, comment_author, post_name) # Edit comment comment_content = "" comment_state = 'Pu' input_comment_author(self, comment_author) input_comment_post(self, post_name) input_comment_state(self, comment_state) input_comment_content(self, comment_content) save_edit_comment(self) assert 'Your changes have been saved successfully' in self.driver.find_element_by_xpath( '//*[@class= "css-ctpeu"]').text self.driver.back() # todo: back? time.sleep(1) comment_id = self.driver.find_element_by_xpath( '//*[contains(@href, "/keystone/post-comments/")]').text verify_comments_page_have_comment(self, comment_id) print('test_edit_comment_with_ISP_input ok')
def test_delete_comment_with_cancel(self): # setup go_to_posts_page_from_admin_ui_page(self) post_name = 'post_name_post_name_post_name_post_name_post_name_post_name_post_name_post_name_post_name_post_name_post_name' create_a_post(self, post_name) go_to_admin_ui_page_from_comments_page(self) go_to_comments_page_from_admin_ui_page(self) comment_author = 'Demo User' create_a_comment(self, comment_author, post_name) self.driver.back() # todo: back? # delete comment time.sleep(1) comment_id = self.driver.find_element_by_xpath( '//*[contains(@href, "/keystone/post-comments/")]').text time.sleep(1) self.driver.find_element_by_xpath( '//*[@href="/keystone/post-comments/' + comment_id + '"]').click() wait_until_edit_comment_page_is_visible(self) self.driver.find_element_by_xpath( '//*[contains(@data-button, "delete")]').click() wait_until_delete_warning_dialog(self) click_cancel_button(self) self.driver.back() time.sleep(1) verify_comments_page_have_comment(self, comment_id)
def test_edit_comment_with_ISP_input8(self): # create post go_to_posts_page_from_admin_ui_page(self) # todo: 整理page post_name = 'post_name' create_a_post(self, post_name) go_to_admin_ui_page_from_comments_page(self) go_to_comments_page_from_admin_ui_page(self) comment_author = 'Demo User' create_a_comment(self, comment_author, post_name) # Edit comment comment_content = "" comment_state = 'Archieved' input_comment_author(self, comment_author) input_comment_post(self, post_name) input_comment_state(self, comment_state) input_comment_content(self, comment_content) save_edit_comment(self) verify_edit_comment_successfully(self) self.driver.back() # todo: back? time.sleep(1) comment_id = self.driver.find_element_by_xpath( '//*[contains(@href, "/keystone/post-comments/")]').text verify_comments_page_have_comment(self, comment_id) print('test_edit_comment_with_ISP_input ok') delete_a_comment(self, comment_id)
def test_search_post_with_ISP_input2(self): post_name2 = 'post_name_post_namepost_namepost_namepost_namepost_namepost_namepost_namepost_namepost_namepost_name' create_a_post(self, post_name2) self.driver.back() time.sleep(1) self.driver.find_element_by_tag_name('input').send_keys(post_name2) self.assertTrue( len(self.driver.find_elements_by_link_text(post_name2)) > 0) print('test_search_post_with_ISP_input2 ok') delete_a_post(self, post_name2)
def test_search_post_with_ISP_input1(self): post_name1 = 'post_name' # todo: setup 錯地方? create_a_post(self, post_name1) self.driver.back() time.sleep(1) self.driver.find_element_by_tag_name('input').send_keys(post_name1) self.assertTrue( len(self.driver.find_elements_by_link_text(post_name1)) > 0) print('test_search_post_with_ISP_input1 ok') delete_a_post(self, post_name1)
def test_create_comment_and_cancel_with_post(self): go_to_posts_page_from_admin_ui_page(self) post_name = "post_name" create_a_post(self, post_name) go_to_admin_ui_page_from_comments_page(self) go_to_comments_page_from_admin_ui_page(self) comment_author = 'Demo User' click_create_comment_button(self) wait_until_create_a_new_comment_dialog_is_visible(self) input_comment_author(self, comment_author) input_comment_post(self, post_name) click_cancel_button(self) # with self.assertRaises(NoSuchElementException): # self.driver.find_element_by_xpath('//*[contains(@href, "/keystone/post-comments/")]') print("test_create_comment_and_cancel_with_post ok")
def test_create_comment_with_ISP_input3(self): go_to_posts_page_from_admin_ui_page(self) post_name = "post_name_post_name_post_name_post_npost_post_name_post_name_post_name_post_npost_post_name_post_name_post_name_post_npost" create_a_post(self, post_name) go_to_admin_ui_page_from_comments_page(self) go_to_comments_page_from_admin_ui_page(self) comment_author = 'Demo User' create_a_comment(self, comment_author, post_name) go_back_to_comments_page(self) comment_id = self.driver.find_element_by_xpath( '//*[contains(@href, "/keystone/post-comments/")]').text verify_comments_page_have_comment(self, comment_id) print("test_create_comment_with_ISP_input3 ok") # todo: teardown delete_a_comment(self, comment_id)
def test_delete_comment_with_ISP_input2(self): # setup go_to_posts_page_from_admin_ui_page(self) post_name = 'post_name' create_a_post(self, post_name) go_to_admin_ui_page_from_comments_page(self) go_to_comments_page_from_admin_ui_page(self) comment_author = 'Demo User' create_a_comment(self, comment_author, post_name) self.driver.back() # todo: back? time.sleep(1) # delete comment comment_id = self.driver.find_element_by_xpath( '//*[contains(@href, "/keystone/post-comments/")]').text delete_a_comment(self, comment_id) with self.assertRaises(NoSuchElementException): self.driver.find_element_by_link_text(comment_id) print('test_delete_comment ok')