class AddToGroup(unittest.TestCase):
    def setUp(self):
        self.driver = Driver()
        self.driver.get(strings.Urls.editor_url)
        self.driver.add_cookie(
            strings.Cookies.editor_test_blog_password_cookie)

    @capture_screenshot
    def test_edit_existing_article(self):
        login_screen = LoginScreen(self.driver)
        login_screen.login(strings.LoginCredentials.editorUsername,
                           strings.LoginCredentials.editorPassword)
        editor_dashboard = EditorDashboard(self.driver)
        editor_dashboard.search_for_article("Editable Article (DO NOT DELETE)")
        editor_dashboard.click_existing_article(
            "Editable Article (DO NOT DELETE)")
        compose_tab = ComposeTab(self.driver)
        updated_text = compose_tab.add_new_story_content("THIS IS AN EDIT. ")
        editor_dashboard.saved()
        compose_tab.click_finalize()
        finalize_tab = FinalizeTab(self.driver)
        editor_dashboard.saved()
        finalize_tab.click_publish_changes()
        finalize_tab.click_confirm_publish_changes()
        editor_dashboard.view_published_entry("story")
        published_entry = PublishedEntry(self.driver)
        published_entry.body_text_present(updated_text)

    def tearDown(self):
        self.driver.instance.quit()
Exemplo n.º 2
0
class AddBodyGallery(unittest.TestCase):
    def setUp(self):
        self.driver = Driver()
        self.driver.get(strings.Urls.editor_url)
        self.driver.add_cookie(
            strings.Cookies.editor_test_blog_password_cookie)

    @capture_screenshot
    def test_add_body_gallery(self):
        login_screen = LoginScreen(self.driver)
        login_screen.login(strings.LoginCredentials.editorUsername,
                           strings.LoginCredentials.editorPassword)
        editor_dashboard = EditorDashboard(self.driver)
        editor_dashboard.create_new_story()
        compose_tab = ComposeTab(self.driver)
        compose_tab.type_headline("Article Headline")
        compose_tab.type_dek("Article Dek")
        compose_tab.click_insert_dropdown_item("Gallery")
        add_gallery_modal = ComposeTab.AddGalleryModal(self.driver)
        add_gallery_modal.click_new_gallery()
        create_gallery_menu = ComposeTab.CreateGalleryMenu(self.driver)
        create_gallery_menu.enter_gallery_title("Article Gallery")
        create_gallery_menu.click_gallery_image_dropdown()
        create_gallery_menu.upload_gallery_images("assets/ah-jpg.jpg",
                                                  "assets/dc-ah-banner.jpg")
        create_gallery_menu.click_insert_gallery()
        compose_tab.body_item_displayed("gallery")
        editor_dashboard.saved()
        compose_tab.click_finalize()
        finalize_tab = FinalizeTab(self.driver)
        finalize_tab.click_publish_button()
        finalize_tab.click_confirm_publish_now()
        editor_dashboard.view_published_entry("story")
        published_entry = PublishedEntry(self.driver)
        published_entry.body_gallery_displayed()

    def tearDown(self):
        self.driver.instance.quit()
class CreateNewStory(unittest.TestCase):
    def setUp(self):
        self.driver = Driver()
        self.driver.get(strings.Urls.editor_url)
        self.driver.add_cookie(
            strings.Cookies.editor_test_blog_password_cookie)

    @capture_screenshot
    def test_create_new_story(self):
        login_screen = LoginScreen(self.driver)
        login_screen.login(strings.LoginCredentials.editorUsername,
                           strings.LoginCredentials.editorPassword)
        editor_dashboard = EditorDashboard(self.driver)
        editor_dashboard.create_new_story()
        compose_tab = ComposeTab(self.driver)
        compose_tab.type_headline("Article Headline")
        compose_tab.type_dek("Article Dek")
        compose_tab.click_select_art()
        lead_art_dropdown = ComposeTab.LeadArtDropdown(self.driver)
        lead_art_dropdown.upload_lead_art("assets/ah-jpg.jpg")
        add_image_modal = ComposeTab.AddImageModal(self.driver)
        add_image_modal.click_insert_image()
        compose_tab.add_story_content("This is the first line of a story.")
        editor_dashboard.saved()
        compose_tab.click_finalize()
        finalize_tab = FinalizeTab(self.driver)
        editor_dashboard.saved()
        finalize_tab.click_publish_button()
        finalize_tab.click_confirm_publish_now()
        editor_dashboard.view_published_entry("story")
        published_entry = PublishedEntry(self.driver)
        published_entry.story_items_displayed(
            "Article Headline", "Article Dek",
            "This is the first line of a story.")

    def tearDown(self):
        self.driver.instance.quit()