Esempio n. 1
0
 def test_can_create_news_child_pages(self, admin_browser):
     """Check that when an news index child page is created it appears in the website."""
     create_news_child_page(admin_browser, NEWS_PAGE['page_type'],
                            NEWS_PAGE['title'])
     view_live_page(admin_browser, NEWS_PAGE['title'])
     assert not admin_browser.is_text_present('Home')
     assert admin_browser.title == NEWS_PAGE['title']
Esempio n. 2
0
 def test_can_create_about_child_pages(self, admin_browser, child_page):
     """Check that when an about child page is created it appears in the website."""
     create_about_child_page(admin_browser, child_page['page_type'],
                             child_page['title'])
     view_live_page(admin_browser, child_page['title'])
     assert not admin_browser.is_text_present('Home')
     assert admin_browser.is_text_present(child_page['title'])
Esempio n. 3
0
 def test_feed_image_shows_on_index_page(self, admin_browser):
     """Check that when a user adds a feed image it also becomes the header image."""
     admin_browser.find_by_text(CASE_STUDY_PAGE['title']).click()
     self.upload_an_image(admin_browser)
     publish_page(admin_browser)
     view_live_page(admin_browser, self.CASE_STUDY_INDEX_PAGE_TITLE)
     header_image = admin_browser.find_by_xpath(
         '//div[@class="case-study__media background-cover"]')
     assert 'pigeons' in header_image.outer_html
Esempio n. 4
0
 def test_can_create_case_study_page(self, admin_browser):
     """Check that a Case Study page can be created as a child of the Case Study Index page."""
     self.setup_case_study_index_page(admin_browser)
     admin_browser.find_by_xpath('//td[@class="no-children"]').click()
     enter_page_content(admin_browser, 'English', 'title_en',
                        CASE_STUDY_PAGE['title'])
     enter_page_content(admin_browser, 'Promote', 'slug_en',
                        slugify(CASE_STUDY_PAGE['title']))
     publish_page(admin_browser)
     view_live_page(admin_browser, CASE_STUDY_PAGE['title'])
     assert admin_browser.is_text_present(CASE_STUDY_PAGE['title'])
Esempio n. 5
0
 def test_can_edit_news_child_page_with_header_text(self, admin_browser,
                                                    header):
     """Check that an news index child page content editor can add a header."""
     admin_browser.find_by_text(NEWS_PAGE['title'])[0].click()
     admin_browser.find_by_text('English')[0].click()
     find_and_click_toggle_button(admin_browser, 0)
     find_and_click_add_button(admin_browser, header['button'].lower())
     fill_content_editor_block(admin_browser, header['button'].lower(),
                               " input", header['content'])
     publish_page(admin_browser)
     view_live_page(admin_browser, NEWS_PAGE['title'])
     assert admin_browser.is_text_present(header['content'])
Esempio n. 6
0
 def test_can_edit_about_page_with_header_text(self, admin_browser, header):
     """Check that an existing About page content editor can add a header."""
     admin_browser.find_by_text('About').click()
     admin_browser.find_by_text('English').click()
     element_count = admin_browser.find_by_id(
         'content_editor_en-count').value
     scroll_to_bottom_of_page(admin_browser)
     reveal_content_editor(admin_browser, header['button'], element_count)
     admin_browser.find_by_text(
         header['button'])[int(element_count)].click()
     admin_browser.find_by_id(header['id'].format(element_count)).fill(
         header['content'])
     publish_page(admin_browser)
     view_live_page(admin_browser, 'About')
     assert admin_browser.is_text_present(header['content'])
Esempio n. 7
0
def edit_page_header(admin_browser, page_title, cms_field, cms_content):
    """Edit a page by adding content via the CMS.

    Args:
        page_title (str): The title of the page you want to edit.
        cms_field (str): The name of the CMS field you want to enter content into.
        cms_content (str): The text content you want to add to the CMS field.

    TODO:
        Rename this function to avoid confusion with content editor tests.

    """
    admin_browser.find_by_text(page_title).click()
    enter_page_content(admin_browser, 'English', cms_field, cms_content)
    publish_page(admin_browser)
    view_live_page(admin_browser, page_title)
Esempio n. 8
0
 def test_can_edit_case_study_page_with_header_text(self, admin_browser,
                                                    header):
     """Check that an About child page content editor can add a header."""
     admin_browser.find_by_text(CASE_STUDY_PAGE['title']).click()
     admin_browser.find_by_text('English').click()
     scroll_to_bottom_of_page(admin_browser)
     element_count = admin_browser.find_by_id(
         'content_editor_en-count').value
     reveal_content_editor(admin_browser, header['button'], element_count)
     admin_browser.find_by_text(
         header['button'])[int(element_count)].click()
     admin_browser.find_by_id(header['id'].format(element_count)).fill(
         header['content'])
     publish_page(admin_browser)
     view_live_page(admin_browser, CASE_STUDY_PAGE['title'])
     assert admin_browser.is_text_present(header['content'])