本文整理汇总了Python中pages.desktop.page_provider.PageProvider类的典型用法代码示例。如果您正苦于以下问题:Python PageProvider类的具体用法?Python PageProvider怎么用?Python PageProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PageProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_that_article_can_be_translated
def test_that_article_can_be_translated(self, mozwebqa):
"""
Creates a new knowledge base article.
Translate article
"""
kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
article_info_dict = self._create_new_generic_article(kb_new_article)
kb_new_article.submit_article()
kb_article_history = kb_new_article.set_article_comment_box()
# translating
kb_translate_pg = kb_article_history.navigation.click_translate_article()
kb_translate_pg.click_translate_language('Esperanto (eo)')
timestamp = datetime.datetime.now()
kb_translate_pg.type_title('artikolo_titolo%s' % timestamp)
kb_translate_pg.type_slug('artikolo_limako_%s' % timestamp)
kb_translate_pg.click_submit_review()
change_comment = 'artikolo sangoj %s' % timestamp
kb_translate_pg.type_modal_describe_changes(change_comment)
kb_article_history = kb_translate_pg.click_modal_submit_changes_button()
# verifying
Assert.equal(change_comment, kb_article_history.most_recent_revision_comment)
Assert.equal('Esperanto', kb_article_history.revision_history)
# deleting
kb_article_history.delete_entire_article_document()
示例2: test_logout
def test_logout(self, mozwebqa):
home_page = PageProvider(mozwebqa).home_page(do_login=True, user='default')
Assert.true(home_page.header.is_user_logged_in, 'User not shown to be logged in')
# sign out
home_page.sign_out()
Assert.false(home_page.header.is_user_logged_in)
示例3: test_that_article_can_be_translated
def test_that_article_can_be_translated(self, mozwebqa):
"""
Creates a new knowledge base article.
Translate article
"""
kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
article_info_dict = self._create_new_generic_article(kb_new_article)
kb_new_article.submit_article()
kb_article_history = kb_new_article.set_article_comment_box()
# translating
kb_translate_pg = kb_article_history.navigation.click_translate_article()
kb_translate_pg.click_translate_language('Esperanto (eo)')
if not kb_translate_pg.is_type_title_visible:
pytest.xfail(reason='Bug 790626 - [STAGE] translating a question sometimes returns 500 page')
timestamp = datetime.datetime.now()
kb_translate_pg.type_title('artikolo_titolo%s' % timestamp)
kb_translate_pg.type_slug('artikolo_limako_%s' % timestamp)
kb_translate_pg.type_search_result_summary('artikolo_serco_rezulto_resumo_%s' % timestamp)
kb_translate_pg.click_submit_review()
change_comment = 'artikolo sangoj %s' % timestamp
kb_translate_pg.type_modal_describe_changes(change_comment)
kb_article_history = kb_translate_pg.click_modal_submit_changes_button()
# verifying
Assert.equal(change_comment, kb_article_history.most_recent_revision_comment)
Assert.equal('Esperanto', kb_article_history.revision_history)
# deleting
kb_article_history.delete_entire_article_document()
示例4: test_contributor_flow_to_support_forum_post
def test_contributor_flow_to_support_forum_post(self, mozwebqa, variables):
"""
Shows a contributor can start on the home page and move
all the way to answering a question in the forum.
"""
# 1. Start on the home page
# 2. Log in
# 3. Use the contributor bar to go to the forums.
# The questions page should list 20 posts.
# 3.1 go to the question page
user = variables['users']['default']
questions_page = PageProvider(mozwebqa).questions_page(
user['username'], user['password'])
questions_page.click_all_products()
# 3.2 ensure the size of the list is 20
Assert.greater(questions_page.questions_count, 0,
'There is not at least one question displayed.')
# 4. Click on a question. (URL is in the forum of /questions/[some number])
# 4.1 pick up an arbitrary question and click
# 4.2 check if it landed on an intended forum page
question = questions_page.questions[randrange(questions_page.questions_count)]
forum_page = question.click_question_link()
# 5. Go to the thread
# 6. Scroll to the bottom and click into the text field
# 7. Type reply
# 7.1 reply the post
reply = "reply"
forum_page.post_reply(reply)
# 7.2 check if posting a reply finishes without an error
Assert.true(forum_page.is_reply_text_present(user['username'], reply),
u'reply with "%s" text posted by %s is not present' % (
reply, user['username']))
示例5: test_cant_find_what_youre_looking_for_test
def test_cant_find_what_youre_looking_for_test(self, mozwebqa, search_term):
search_page_obj = PageProvider(mozwebqa).search_page()
search_page_obj.do_search_on_search_box(search_term)
expected_text = "Can't find what you're looking for?"
Assert.contains(expected_text, search_page_obj.ask_a_question_text)
Assert.true(search_page_obj.is_ask_a_question_present, "Ask question link not present")
示例6: test_contributor_flow_to_support_forum_post
def test_contributor_flow_to_support_forum_post(self, mozwebqa):
"""
Shows a contributor can start on the home page and move
all the way to answering a question in the forum.
"""
reply_text = "reply"
#1. Start on the home page
#2. Log in
#3. Use the contributor bar to go to the forums.
# The questions page should list 20 posts.
#3.1 go to the question page
questions_page = PageProvider(mozwebqa).questions_page(do_login=True)
questions_page.click_all_products()
#3.2 ensure the size of the list is 20
Assert.greater(questions_page.questions_count, 0,
'There is not at least one question displayed.')
#4. Click on a question. (URL is in the forum of /questions/[some number])
#4.1 pick up an arbitrary question and click
#4.2 check if it landed on an intended forum page
question = questions_page.questions[randrange(questions_page.questions_count)]
forum_page = question.click_question_link()
#5. Go to the thread
#6. Scroll to the bottom and click into the text field
#7. Type reply
#7.1 get the login-user name to check the author of the reply
username = forum_page.header.login_user_name
#7.2 reply the post
forum_page.post_reply(reply_text)
#7.3 check if posting a reply finishes without an error
is_reply_present = forum_page.is_reply_text_present(username, reply_text)
Assert.true(is_reply_present,
u'reply with "%s" text posted by %s is not present' % (reply_text, username))
示例7: test_logout_from_new_kb_article_page
def test_logout_from_new_kb_article_page(self, mozwebqa):
new_kb_page = PageProvider(mozwebqa).new_kb_article_page()
Assert.true(new_kb_page.header.is_user_logged_in, 'User not shown to be logged in')
# sign out
register_page = new_kb_page.sign_out()
register_page.is_the_current_page
Assert.true(register_page.header.is_user_logged_out)
示例8: test_that_article_can_be_previewed_before_submitting
def test_that_article_can_be_previewed_before_submitting(self, mozwebqa):
kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
article_info_dict = self._create_new_generic_article(kb_new_article)
kb_new_article.click_article_preview_button()
actual_preview_text = kb_new_article.article_preview_text
Assert.equal(article_info_dict['content'], actual_preview_text)
示例9: test_logout_from_new_kb_article_page
def test_logout_from_new_kb_article_page(self, mozwebqa, variables):
user = variables['users']['default']
new_kb_page = PageProvider(mozwebqa).new_kb_article_page(
user['username'], user['password'])
Assert.true(new_kb_page.header.is_user_logged_in, 'User not shown to be logged in')
# sign out
register_page = new_kb_page.sign_out()
register_page.is_the_current_page
Assert.true(register_page.header.is_user_logged_out)
示例10: test_that_thank_you_page_is_displayed_after_successful_registration
def test_that_thank_you_page_is_displayed_after_successful_registration(self, mozwebqa):
"""
Register a new user using random username.
Verify registration by checking the page title
"""
register_pg = PageProvider(mozwebqa).new_user_registration_page()
register_pg.register_new_user()
actual_page_title = register_pg.page_title
expected_page_title = register_pg._page_title_after_registration
Assert.contains(expected_page_title, actual_page_title)
示例11: test_no_query_adv_forum_search
def test_no_query_adv_forum_search(self, mozwebqa):
refine_search_pg = PageProvider(mozwebqa).refine_search_page()
# do test
refine_search_pg.click_support_questions_tab()
refine_search_pg.type_in_asked_by_box(refine_search_pg.get_user_name('default'))
refine_search_pg.click_search_button_support()
Assert.true(refine_search_pg.search_result_count > 0, "No search results not found")
# sign out
refine_search_pg.sign_out()
示例12: test_that_questions_problem_count_increments
def test_that_questions_problem_count_increments(self, mozwebqa):
"""Checks if the 'I have this problem too' counter increments"""
# Can't +1 your own question so will do it logged out
questions_pg = PageProvider(mozwebqa).questions_page()
view_question_pg = questions_pg.click_any_question(1)
initial_count = view_question_pg.problem_count
view_question_pg.click_problem_too_button()
view_question_pg.refresh()
post_click_count = view_question_pg.problem_count
Assert.equal(initial_count + 1, post_click_count)
示例13: test_that_article_can_be_previewed_before_submitting
def test_that_article_can_be_previewed_before_submitting(self, mozwebqa):
"""
Start a new knowledge base article.
Preview.
Verify the contents in the preview
"""
kb_new_article = PageProvider(mozwebqa).new_kb_article_page()
# create a new article
mock_article = MockArticle()
kb_new_article.set_article(mock_article)
kb_new_article.click_article_preview_button()
actual_preview_text = kb_new_article.article_preview_text
Assert.equal(mock_article["content"], actual_preview_text)
示例14: test_that_questions_sorts_correctly_by_filter_equal_to_unanswered
def test_that_questions_sorts_correctly_by_filter_equal_to_unanswered(self, mozwebqa):
"""
Goes to the /questions page,
Verifies the sort filter=unanswered works
"""
expected_sorted_text = "Unanswered"
questions_page = PageProvider(mozwebqa).questions_page()
questions_page.click_all_questions_tab()
questions_page.click_sort_by_unanswered_questions()
# if there are no questions in the list then skip the test
if not questions_page.are_questions_present:
pytest.skip("No questions present for filter=%s" % expected_sorted_text)
for question in questions_page.questions:
Assert.equal(0, question.number_of_replies)
示例15: test_that_questions_sorts_correctly_by_filter_equal_to_solved
def test_that_questions_sorts_correctly_by_filter_equal_to_solved(self, mozwebqa):
"""
Goes to the /questions page,
Verifies the sort filter=solved works
"""
expected_sorted_text = "Solved"
questions_pg = PageProvider(mozwebqa).questions_page()
questions_pg.click_sort_by_solved_questions()
# if there are no questions in the list then skip the test
if not questions_pg.are_questions_present:
pytest.skip("No questions present for filter=%s" % expected_sorted_text)
num_of_questions = questions_pg.questions_count
for counter in range(num_of_questions):
actual_sorted_text = questions_pg.sorted_list_filter_text(counter + 1)
Assert.equal(actual_sorted_text, expected_sorted_text)