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

        button_getter = ButtonGetter(driver)

        dismiss_buttons = button_getter.get_dismiss_buttons()
        dismiss_titles = self.get_dismiss_titles()

        dismiss_buttons[FOLLOWING_INDEX].click()

        time.sleep(1)

        assert dismiss_titles[FOLLOWING_INDEX].text not in self.get_dismiss_titles()
Пример #2
0
    def test_follow_succeeded(self):
        driver = self.driver

        button_getter = ButtonGetter(driver)
        page_parser = PageParser(driver)

        follow_buttons = button_getter.get_follow_buttons()

        followed_title = follow_buttons[FOLLOWING_INDEX].get_attribute(
            'data-tumblelog-name')
        follow_buttons[FOLLOWING_INDEX].send_keys(Keys.RETURN)  #click

        self.driver.get(URL + "/following")

        assert followed_title in page_parser.get_following()

        button_getter.get_unfollow_button(followed_title).click()

        time.sleep(1)

        button_getter.get_ok_button().click()

        time.sleep(1)

        self.driver.refresh()

        assert followed_title not in page_parser.get_following()
Пример #3
0
    def test_share_succeeded(self):
        driver = self.driver
        self.login()

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

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

        time.sleep(2)

        button_getter.get_permalink_button().click()
        self.assertTrue(presence_checker.is_there_tab_with_url_part(post_id))

        time.sleep(1)

        self.assertFalse(presence_checker.is_there_item_with_class('back-button'))
        self.assertFalse(presence_checker.is_there_item_with_class('embed-code'))
        button_getter.get_embed_button().click()

        time.sleep(1)

        self.assertTrue(presence_checker.is_there_item_with_class('back-button'))
        self.assertTrue(presence_checker.is_there_item_with_class('embed-code'))
        driver.find_element_by_class_name('back-button').click()

        time.sleep(1)

        self.assertFalse(presence_checker.is_there_item_with_class('back-button'))
        self.assertFalse(presence_checker.is_there_item_with_class('embed-code'))
        self.assertFalse(presence_checker.is_there_glass_container())
        self.assertFalse(presence_checker.is_there_drawer_container())

        button_getter.get_report_button().click()

        time.sleep(1)

        self.assertTrue(presence_checker.is_there_glass_container())
        self.assertTrue(presence_checker.is_there_drawer_container())
Пример #4
0
    def test_follow_succeeded(self):
        driver = self.driver
        self.login()

        button_getter = ButtonGetter(driver)

        follow_buttons = button_getter.get_follow_buttons()

        followed_title = follow_buttons[FOLLOWING_INDEX].get_attribute('data-tumblelog-name')
        follow_buttons[FOLLOWING_INDEX].click()

        self.driver.get(URL + "/following")

        assert followed_title in self.get_following()

        button_getter.get_unfollow_button(followed_title).click()

        time.sleep(1)

        driver.find_element_by_class_name("btn_1").click()

        self.driver.refresh()

        assert followed_title not in self.get_following()
Пример #5
0
    def test_reblog_succeeded(self):
        driver = self.driver
        self.login()

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

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

        old_posted_count = self.get_posted_count()

        #print('old posted count:', old_posted_count)

        button_getter.get_reblog_button(post).click()

        time.sleep(1)

        self.assertTrue(presence_checker.is_there_post_modal_container())

        self.get_reblog_text_field().send_keys(POST_NOTE)

        post_settings_button = button_getter.get_post_settings_button()

        self.assertFalse(presence_checker.is_there_post_settings_dropdown())
        post_settings_button.click()

        time.sleep(1)

        self.assertTrue(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 = self.get_posted_count()

        #print('new posted count:', new_posted_count)

        self.assertEquals(old_posted_count + 1, new_posted_count)

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

        self.assertTrue(presence_checker.is_there_reblogged_post(post_operator, post_id, POST_NOTE))
Пример #6
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)
Пример #7
0
    def test_like_succeeded(self):
        driver = self.driver

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

        time.sleep(2)

        posts = post_operator.get_posts()

        old_liked_count = page_parser.get_liked_count(URL)
        like_button = button_getter.get_like_button(posts[FIRST_POST_INDEX +
                                                          FOLLOWING_INDEX])
        post_id = post_operator.get_post_id(posts[FIRST_POST_INDEX +
                                                  FOLLOWING_INDEX])

        like_button.click()

        time.sleep(1)

        assert 'liked' in like_button.get_attribute('class')

        self.driver.get(URL + "/likes")

        assert presence_checker.is_there_post(post_operator, post_id)

        new_liked_count = page_parser.get_liked_count(URL)

        assert new_liked_count == old_liked_count + 1

        time.sleep(2)

        button_getter.get_like_button_by_post_id(post_operator,
                                                 post_id).click()

        driver.refresh()

        assert button_getter.get_like_button_by_post_id(
            post_operator, post_id) is None

        new_liked_count = page_parser.get_liked_count(URL)

        assert new_liked_count == old_liked_count
Пример #8
0
    def test_like_succeeded(self):
        driver = self.driver
        self.login()

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

        time.sleep(2)

        posts = post_operator.get_posts()

        old_liked_count = int(str(self.get_liked_count()))
        like_button = button_getter.get_like_button(posts[FIRST_POST_INDEX + FOLLOWING_INDEX])
        post_id = post_operator.get_post_id(posts[FIRST_POST_INDEX + FOLLOWING_INDEX])

        like_button.click()

        time.sleep(1)

        assert 'liked' in like_button.get_attribute('class')

        self.driver.get(URL + "/likes")

        self.assertTrue(presence_checker.is_there_post(post_operator, post_id))

        new_liked_count = int(str(self.get_liked_count()))
        
        self.assertEquals(new_liked_count, old_liked_count + 1)

        time.sleep(2)

        button_getter.get_like_button_by_post_id(post_operator, post_id).click()

        driver.refresh()

        assert button_getter.get_like_button_by_post_id(post_operator, post_id) is None

        new_liked_count = int(str(self.get_liked_count()))

        self.assertEquals(new_liked_count, old_liked_count)