def create_a_comment(self, comment_author, post_name): 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_create_submit_button(self) wait_until_edit_comment_page_is_visible(self)
def test_create_user_with_same_email(self): go_to_users_page_from_admin_ui_page(self) # create user click_create_user_button(self) wait_until_create_a_new_user_dialog_is_visible(self) user_first_name = 'cheng an' user_last_name = 'chu' uuid1 = uuid.uuid1() user_email = str(uuid1) + '*****@*****.**' user_password = '******' user_password_confirm = 'asdfasdfabaswef' input_user_first_name(self, user_first_name) input_user_last_name(self, user_last_name) input_user_email(self, user_email) input_user_password(self, user_password) input_user_password_confirm(self, user_password_confirm) click_create_submit_button(self) wait_until_edit_user_page_is_visible(self) go_to_users_page_from_edit_user_page(self) # create user with same email click_create_user_button(self) wait_until_create_a_new_user_dialog_is_visible(self) user_first_name = 'cheng an' user_last_name = 'chu' user_password = '******' user_password_confirm = 'asdfasdfabaswef' input_user_first_name(self, user_first_name) input_user_last_name(self, user_last_name) input_user_email(self, user_email) input_user_password(self, user_password) input_user_password_confirm(self, user_password_confirm) click_create_submit_button(self) wait_until_name_error_message_is_visible(self) assert 'MongoError: E11000 duplicate key error collection: admin.users index: email_1 dup key: { email: ' + "\"" + user_email + "\"" + ' }' in self.driver.find_element_by_xpath( '//*[@data-alert-type="danger"]').text click_close_button(self) wait_until_users_page_is_visible(self) print('test_create_user_with_same_email ok')
def test_create_user_with_wrong_password_confirm(self): go_to_users_page_from_admin_ui_page(self) # create user click_create_user_button(self) wait_until_create_a_new_user_dialog_is_visible(self) user_first_name = 'cheng an' user_last_name = 'chu' uuid1 = uuid.uuid1() user_email = str(uuid1) + '*****@*****.**' user_password = '******' user_password_confirm = 'sadfsdfsdfsafasf' input_user_first_name(self, user_first_name) input_user_last_name(self, user_last_name) input_user_email(self, user_email) input_user_password(self, user_password) input_user_password_confirm(self, user_password_confirm) click_create_submit_button(self) wait_until_name_error_message_is_visible(self) assert 'Passwords must match.' in self.driver.find_element_by_xpath( '//*[@data-alert-type="danger"]').text click_close_button(self) print('test_create_user_with_wrong_password_confirm ok')
def test_create_user_successfully(self): go_to_users_page_from_admin_ui_page(self) click_create_user_button(self) wait_until_create_a_new_user_dialog_is_visible(self) user_first_name = 'cheng an' user_last_name = 'chu' uuid1 = uuid.uuid1() user_email = str(uuid1) + '*****@*****.**' user_password = '******' user_password_confirm = 'asdfasdfabaswef' input_user_first_name(self, user_first_name) input_user_last_name(self, user_last_name) input_user_email(self, user_email) input_user_password(self, user_password) input_user_password_confirm(self, user_password_confirm) click_create_submit_button(self) wait_until_edit_user_page_is_visible(self) self.driver.back() time.sleep(1) self.assertTrue( self.driver.find_element_by_link_text(user_first_name + ' ' + user_last_name) is not None) print('test_create_user_successfully ok')
def create_a_category(self, category_name): click_create_category_button(self) wait_until_create_a_new_category_dialog_is_visible(self) input_category_name(self, category_name) click_create_submit_button(self) wait_until_edit_category_page_is_visible(self)