Пример #1
0
def test_edit(base_url, selenium):
    admin = AdminLogin(selenium, base_url).open()
    admin.login_new_user()
    article_page = ArticlePage(selenium, base_url).open()
    page = article_page.click_edit(True)
    # welcome message displays
    assert page.is_first_contrib_welcome_displayed
    # CKEditor loads and is ready
    editor = page.editor()
    assert editor.ready
    # Tagit loads
    assert page.tagit_loaded
    # save button disabled
    assert page.is_save_button_disabled
    # edit in source mode, including an iframe, exit source mode
    editor.edit_source()
    content = editor.content_source()
    # iframe edit removed
    assert 'iframe' not in content
    # content edit remains
    assert 'Pumpkin' in content
    # check contents of draft
    draft_content = editor.draft_content(selenium.current_url)
    assert 'Pumpkin' in draft_content
    # save button enabled
    assert not page.is_save_button_disabled
    # discard
    page.discard()
Пример #2
0
def test_header_signin(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    # avoid the task completion popup
    page.disable_survey_popup()
    # click on sign in widget
    page.header.signin_link.click()
    # wait until it's fowarded to github
    page.wait.until(lambda s: 'https://github.com' in s.current_url)
Пример #3
0
 def open_feedback(self, locale=None):
     self.find_element(*self._feedback_link_locator).click()
     # import needs to be here to avoid circular reference
     from pages.article import ArticlePage
     feedback_page = ArticlePage(self.selenium,
                                 self.page.base_url,
                                 slug='MDN/Feedback',
                                 locale=(locale or 'en-US'))
     return feedback_page.wait_for_page_to_load()
Пример #4
0
 def open_feedback(self, locale=None):
     self.find_element(*self._feedback_link_locator).click()
     # import needs to be here to avoid circular reference
     from pages.article import ArticlePage
     feedback_page = ArticlePage(self.selenium,
                                 self.page.base_url,
                                 slug='MDN/Feedback',
                                 locale=(locale or 'en-US'))
     return feedback_page.wait_for_page_to_load()
Пример #5
0
 def open_feedback(self, locale=None):
     self.find_element(*self._feedback_link_locator).click()
     # import needs to be here to avoid circular reference
     from pages.article import ArticlePage
     url_kwargs = dict(locale=locale) if locale else dict()
     feedback_page = ArticlePage(self.selenium, self.page.base_url,
                                 **url_kwargs)
     feedback_page.URL_TEMPLATE = '/{locale}/docs/MDN/Feedback'
     return feedback_page.wait_for_page_to_load()
Пример #6
0
 def publish(self):
     from pages.article import ArticlePage
     publish_button = self.find_element(*self._save_button_locator)
     publish_button.click()
     # wait for article page to load
     published_page = ArticlePage(self.selenium, self.base_url,
                                  **self.url_kwargs)
     published_page.URL_TEMPLATE = '/{locale}/docs/' + self.DOC_SLUG
     return published_page.wait_for_page_to_load()
Пример #7
0
 def open_feedback(self, locale=None):
     self.find_element(*self._feedback_link_locator).click()
     # import needs to be here to avoid circular reference
     from pages.article import ArticlePage
     url_kwargs = dict(locale=locale) if locale else dict()
     feedback_page = ArticlePage(self.selenium,
                                 self.page.base_url,
                                 **url_kwargs)
     feedback_page.URL_TEMPLATE = '/{locale}/docs/MDN/Feedback'
     return feedback_page.wait_for_page_to_load()
Пример #8
0
 def publish(self):
     from pages.article import ArticlePage
     publish_button = self.find_element(*self._save_button_locator)
     publish_button.click()
     # wait for article page to load
     published_page = ArticlePage(
         self.selenium,
         self.base_url,
         **self.url_kwargs
     )
     published_page.URL_TEMPLATE = '/{locale}/docs/' + self.DOC_SLUG
     return published_page.wait_for_page_to_load()
Пример #9
0
 def publish(self):
     # short wait to allow save button to be enabled
     # dirtiness tracking only fires every 1.5 seconds
     time.sleep(1.6)
     from pages.article import ArticlePage
     publish_button = self.find_element(*self._save_button_locator)
     publish_button.click()
     # wait for article page to load
     published_page = ArticlePage(
         self.selenium,
         self.base_url,
         locale=self.DEFAULT_LOCALE,
         slug=self.DOC_SLUG,
     )
     return published_page.wait_for_page_to_load()
Пример #10
0
 def publish(self):
     # short wait to allow save button to be enabled
     # dirtiness tracking only fires every 1.5 seconds
     time.sleep(1.6)
     from pages.article import ArticlePage
     publish_button = self.find_element(*self._save_button_locator)
     publish_button.click()
     # wait for article page to load
     published_page = ArticlePage(
         self.selenium,
         self.base_url,
         locale=self.DEFAULT_LOCALE,
         slug=self.DOC_SLUG,
     )
     return published_page.wait_for_page_to_load()
Пример #11
0
def test_feedback_layout(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.is_article_displayed
    assert page.is_article_column_left_present
    assert page.is_article_column_content_present
    assert page.article_column_right_present
    assert page.is_article_columns_expected_layout
Пример #12
0
def test_location(base_url, selenium):
    article_page = ArticlePage(selenium, base_url).open()
    page = article_page.header.open_feedback()
    assert (ARTICLE_NAME + ARTICLE_TITLE_SUFIX
            ) == selenium.title, 'page title does not match expected'
    assert page.article_title_text == ARTICLE_NAME, 'article title is not expected'
    assert page.article_title_text in selenium.title, 'article title not in page title'
Пример #13
0
def test_article_layout(base_url, selenium):
    page = ArticlePage(selenium, base_url, path=ARTICLE_PATH).open()
    assert page.is_article_displayed
    assert page.is_article_column_left_present
    assert page.is_article_column_content_present
    assert page.article_column_right_present
    assert page.is_article_columns_expected_layout
Пример #14
0
def test_search_article_header(base_url, selenium):
    # open article page
    page = ArticlePage(selenium, base_url).open()
    # avoid the task completion popup
    page.disable_survey_popup()
    # focus on search in nav menu
    width_before = page.header.search_field_width
    page.header.search_field_focus()
    width_after = page.header.search_field_width
    assert width_before < width_after
    # search for CSS
    search = page.header.search_for_term(SEARCH_TERM)
    # search term is in search box
    assert search.search_input_value == SEARCH_TERM
    # results found
    assert search.search_result_items_length == 10
Пример #15
0
def test_location(base_url, selenium):
    article_page = ArticlePage(selenium, base_url).open()
    page = article_page.header.open_feedback()
    assert re.match(ARTICLE_NAME + r' - The MDN project \| MDN',
                    selenium.title)
    assert re.match(ARTICLE_NAME, page.article_title_text)
    assert page.article_title_text in selenium.title
Пример #16
0
 def open_feedback(self, locale, path):
     self.find_element(*self._feedback_link_locator).click()
     from pages.article import ArticlePage
     return ArticlePage(self.selenium,
                        self.page.base_url,
                        locale,
                        path=path).wait_for_page_to_load()
Пример #17
0
 def discard(self):
     from pages.article import ArticlePage
     discard_button = self.find_element(*self._discard_button_locator)
     discard_button.click()
     # wait for article page to load
     return ArticlePage(self.selenium, self.base_url,
                        **self.url_kwargs).wait_for_page_to_load()
Пример #18
0
def test_search_article_header(base_url, selenium):
    # open article page
    page = ArticlePage(selenium, base_url).open()
    # avoid the task completion popup
    page.disable_survey_popup()
    # focus on search in nav menu
    width_before = page.header.search_wrapper_width
    page.header.search_field_focus()
    width_after = page.header.search_wrapper_width
    assert width_before < width_after
    # search for CSS
    search = page.header.search_for_term(SEARCH_TERM)
    # search term is in search box
    assert search.search_input_value == SEARCH_TERM
    # results found
    assert search.search_result_items_length == 10
def test_report_bug(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.header.is_feedback_submenu_trigger_displayed
    assert not page.header.is_feedback_submenu_displayed
    page.header.show_feedback_submenu()
    assert page.header.is_report_bug_link_displayed
    assert_valid_url(page.header.report_bug_form_url, follow_redirects=True)
def test_feedback_layout(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.is_article_displayed
    assert page.is_article_column_left_present
    assert page.is_article_column_content_present
    column_container = page.article_column_container_region
    assert column_container.is_expected_stacking
Пример #21
0
def test_page_buttons_displayed_in_mm(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.is_language_menu_displayed
    assert not page.is_edit_button_displayed
    assert not page.header.is_signin_displayed
    assert not page.is_add_translation_link_available
    assert page.is_maintenance_mode_banner_displayed
    assert page.is_advanced_menu_displayed
Пример #22
0
def test_content_exp_logged_in(base_url, selenium, exp_id, locale, slug):
    data = get_experiment_data(exp_id, locale, slug)
    admin = AdminLogin(selenium, base_url).open()
    admin.login_new_user()
    page = ArticlePage(selenium, base_url, locale=locale, slug=slug).open()
    assert selenium.title == data['expected_title']
    assert selenium.current_url == page.seed_url
    assert page.has_edit_button
def test_page_links(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    # get all page links
    article_links = page.article_link_list
    for link in article_links:
        this_link = link.get_attribute('href')
        # exclude IRC, we can't handle that protocol
        if not this_link.startswith('irc'):
            assert_valid_url(this_link, follow_redirects=True)
Пример #24
0
def test_report_bug(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.header.is_feedback_submenu_trigger_displayed
    assert not page.header.is_feedback_submenu_displayed
    page.header.show_feedback_submenu()
    assert page.header.is_report_bug_link_displayed
    page.header.open_report_bug()
    # check form loaded
    assert page.header.is_report_bug_url_expected(selenium)
Пример #25
0
 def save(self):
     # short wait to allow save button to be enabled
     # dirtiness tracking only fires every 1.5 seconds
     time.sleep(1.6)
     from pages.article import ArticlePage
     save_button = self.find_element(*self._save_button_locator)
     save_button.click()
     # wait for article page to load
     return ArticlePage(self.selenium, self.base_url,
                        **self.url_kwargs).wait_for_page_to_load()
Пример #26
0
def test_content_exp_redirect(base_url, selenium, exp_id, locale, slug):
    data = get_experiment_data(exp_id, locale, slug)
    page = ArticlePage(selenium, base_url, locale=locale, slug=slug).open()
    assert selenium.title == data['expected_title']
    seed_url = page.seed_url
    expected_variant_urls = [
        "%s?%s=%s" % (seed_url, data['param'], variant)
        for variant in data['variants']
    ]
    assert selenium.current_url in expected_variant_urls
    assert not page.has_edit_button
def test_report_content(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.header.is_feedback_submenu_trigger_displayed
    assert not page.header.is_feedback_submenu_displayed
    page.header.show_feedback_submenu()
    assert page.header.is_report_content_link_displayed
    # store url of reporting page
    report_url = selenium.current_url
    page.header.open_report_content()
    # bugzilla loads in new window
    selenium.switch_to_window(selenium.window_handles[1])
    # check form loaded and has reporting URL in query
    assert page.header.is_report_content_url_expected(selenium, report_url)
Пример #28
0
def test_edit_sign_in(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    # avoid the task completion popup
    page.disable_survey_popup()
    # click edit
    page.click_edit(False)
    # check prompted for sign in
    assert 'users/signin' in selenium.current_url
Пример #29
0
def test_search_article_header(base_url, selenium):
    # open article page
    page = ArticlePage(selenium, base_url).open()
    # focus on search in nav menu
    width_before = page.header.search_field_width
    page.header.search_field_focus()
    width_after = page.header.search_field_width
    assert width_before < width_after, 'search field did not expand'
    # search for CSS
    search = page.header.search_for_term(SEARCH_TERM)
    # search term is in search box
    assert search.search_input_value == SEARCH_TERM, 'search term not preserved'
    # results found
    assert search.search_result_items_length == 10
Пример #30
0
def test_report_content(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    header = page.header
    assert header.is_feedback_submenu_trigger_displayed
    assert not header.is_feedback_submenu_displayed
    header.show_feedback_submenu()
    assert header.is_report_content_link_displayed
    # store url of reporting page
    report_url = selenium.current_url
    header.open_report_content()
    # the report content URL loads in a new window.
    selenium.switch_to_window(selenium.window_handles[1])
    page.wait.until(lambda s: 'about:blank' not in s.current_url)
    # check form loaded and has reporting URL in query
    assert header.is_report_content_url_expected(selenium, report_url)
Пример #31
0
def test_footer_displays(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.Footer.is_displayed
    assert page.Footer.is_privacy_displayed
    assert page.Footer.is_license_displayed
    assert page.Footer.is_select_language_displayed
Пример #32
0
def test_title(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert (ARTICLE_NAME + ARTICLE_TITLE_SUFIX) == selenium.title, 'page title does not match expected'
    assert page.article_title_text == ARTICLE_NAME, 'article title is not expected'
    assert page.article_title_text in selenium.title, 'article title not in page title'
Пример #33
0
def test_page_buttons_displayed(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.is_language_menu_displayed
    assert page.is_edit_button_displayed
    assert page.is_advanced_menu_displayed
Пример #34
0
def test_header_displays(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.Header.is_displayed
    assert page.Header.is_menu_displayed
Пример #35
0
def test_edit_sign_in(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    # click edit
    page.click_edit(False)
    # check prompted for sign in
    assert 'users/signin' in selenium.current_url
Пример #36
0
def test_header_feedback_submenu(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    assert page.header.is_feedback_submenu_trigger_displayed
    assert not page.header.is_feedback_submenu_displayed
    page.header.show_feedback_submenu()
    assert page.header.is_feedback_submenu_displayed
Пример #37
0
def test_header_signin(base_url, selenium):
    page = ArticlePage(selenium, base_url).open()
    # click on sign in widget
    page.header.trigger_signin()
    # assert it's fowarded to github
    assert 'https://github.com' in str(selenium.current_url)