Ejemplo n.º 1
0
    def test_switching_categories_succeeded(self):
        driver = self.driver

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

        button_getter.get_discover_button().click()

        for button in button_getter.get_discover_types_buttons():
            if (button.is_displayed()):
                button.click()
                time.sleep(2)
                assert len(post_operator.get_posts()) >= MIN_NUMBER_OF_POSTS
Ejemplo n.º 2
0
    def test_popular_queries_succeeded(self):
        driver = self.driver

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

        button_getter.get_discover_button().click()

        discover_search_buttons = button_getter.get_discover_search_buttons()
        button_index = randint(0, len(discover_search_buttons) - 1)

        query = discover_search_buttons[button_index].text

        discover_search_buttons[button_index].click()

        assert query.lower().replace(' ','%20') in driver.current_url.lower()

        assert len(post_operator.get_posts()) >= MIN_NUMBER_OF_POSTS
Ejemplo n.º 3
0
class ActionHandler(ActionHandlerGeneral):
    def __init__(self, driver):
        self.page_parser = PageParser(driver)
        self.button_getter = ButtonGetter(driver)

    def type_and_confirm_language(self, language):
        language_selector = self.page_parser.get_language_selector()
        language_selector.send_keys(language)
        language_selector.send_keys(Keys.RETURN)

    def type_language(self, language):
        language_selector = self.page_parser.get_language_selector()
        language_selector.send_keys(language)

    def confirm_language(self):
        language_selector = self.page_parser.get_language_selector()
        language_selector.send_keys(Keys.RETURN)

    def click_delete_account_button(self):
        self.button_getter.get_delete_account_button().click()
Ejemplo n.º 4
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
Ejemplo n.º 5
0
 def __init__(self, driver):
     self.page_parser = PageParser(driver)
     self.button_getter = ButtonGetter(driver)
Ejemplo n.º 6
0
    def test_changing_settings_succeeded(self):
        driver = self.driver

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

        action_handler.click_account_button()

        time.sleep(1)

        action_handler.click_account_settings_button(URL)
        action_handler.type_and_confirm_language('Deutsch')

        time.sleep(3)

        assert 'Account-Einstellungen' in driver.title

        action_handler.type_and_confirm_language('English')

        time.sleep(3)

        assert 'Account Settings' in driver.title

        action_handler.click_delete_account_button()

        time.sleep(2)

        assert 'delete' in driver.current_url

        action_handler.click_footer_link()

        time.sleep(2)

        button_getter.get_dashboard_settings_button().click()

        assert 'dashboard' in driver.current_url

        button_getter.get_notifications_settings_button().click()

        assert 'notifications' in driver.current_url

        switcher = button_getter.get_notifications_switcher()

        action_handler.switch(switcher)
        time.sleep(1)
        action_handler.switch(switcher)

        button_getter.get_apps_settings_button().click()

        assert 'apps' in driver.current_url

        button_getter.get_android_button().click()
        button_getter.get_ios_button().click()

        assert presence_checker.is_there_tab_with_url_part('itunes.apple.com')
        assert presence_checker.is_there_tab_with_url_part('play.google.com')

        button_getter.get_labs_settings_button().click()

        assert 'labs' in driver.current_url

        labs_switcher = button_getter.get_labs_switcher()

        action_handler.switch(labs_switcher)
        time.sleep(1)
        action_handler.switch(labs_switcher)