Пример #1
0
    def test_reblog_succeeded(self):
        driver = self.driver

        button_getter = ButtonGetter(driver)
        presence_checker = PresenceChecker(driver)
        post_operator = PostOperator(driver)
        page_parser = PageParser(driver)

        post = post_operator.get_posts()[FIRST_POST_INDEX + FOLLOWING_INDEX]
        post_id = post_operator.get_post_id(post)

        old_posted_count = page_parser.get_posted_count()

        button_getter.get_reblog_button(post).click()

        time.sleep(1)

        assert presence_checker.is_there_post_modal_container()

        page_parser.get_reblog_text_field().send_keys(POST_NOTE)

        post_settings_button = button_getter.get_post_settings_button()

        assert not presence_checker.is_there_post_settings_dropdown()
        post_settings_button.click()

        time.sleep(1)

        assert presence_checker.is_there_post_settings_dropdown()
        post_settings_button.click()

        time.sleep(1)

        button_getter.get_reblog_applying_button().click()

        time.sleep(2)

        new_posted_count = page_parser.get_posted_count()

        assert old_posted_count + 1 == new_posted_count

        self.driver.get(
            page_parser.get_post_avatar_link().get_attribute('href'))

        assert presence_checker.is_there_reblogged_post(
            post_operator, post_id, POST_NOTE)
Пример #2
0
    def test_creation_post_with_plain_text(self):
        driver = self.driver

        button_getter = ButtonGetter(driver)
        post_operator = PostOperator(driver)
        page_parser = PageParser(driver)
        action_handler = ActionHandler(driver)

        post_title = 'Hello world'

        post_body = 'Lorem ipsum dolor sit amet'

        post_hashes = '#test'

        posted_count_before_adding_post = page_parser.get_posted_count()

        button_getter.get_create_button().click()

        time.sleep(1)

        button_getter.get_post_type_selection_button('text').click()

        time.sleep(1)

        page_parser.get_text_post_title_input_field().send_keys(post_title)
        page_parser.get_text_post_description_input_field().send_keys(
            post_body)
        page_parser.get_text_post_tag_input_field().send_keys(post_hashes)

        action_handler.click_confirm_post()

        time.sleep(1)

        driver.refresh()

        posted_count_after_adding_post = page_parser.get_posted_count()

        assert posted_count_after_adding_post == posted_count_before_adding_post + 1

        time.sleep(1)

        button_getter.get_account_button().click()

        time.sleep(1)

        button_getter.get_posts_button().click()

        added_post = post_operator.get_text_post(post_title, post_body)

        assert added_post is not None

        post_operator.get_control_menu_button(added_post).click()

        time.sleep(0.5)

        post_operator.get_delete_button(added_post).click()

        time.sleep(1)

        button_getter.get_ok_button().click()

        time.sleep(1)

        driver.refresh()

        assert post_operator.get_text_post(post_title, post_body) is None

        posted_count_after_deleting_post = page_parser.get_posted_count()

        assert posted_count_after_adding_post == posted_count_after_deleting_post + 1