Example #1
0
        def run(self, browser, logger):
            auth = AuthForm(self.browser, self.logger)
            window = BrowserWindow(self.browser,self.logger)
            navigation = Navigation(self.browser,self.logger)
            profile = Profile(self.browser,self.logger)
            vip_popup = VIPPopups(self.browser,self.logger)

            self.do_method(auth.login_with_fb_full_scale,profiling_events.login_event,auth.User1)
            navigation.goto_top_menu_item(u"Профиль")
            profile.validate_profile_view()
            self.logger.log("Profile view is validated")
            navigation.goto_tab_menu_item(u"Настройки")
            profile.validate_settings_view()
            self.logger.log("Settings view is validated")
            navigation.goto_tab_menu_item(u"Уведомления")
            profile.validate_notifications_view()
            self.logger.log("Notifications view is validated")
            navigation.goto_tab_menu_item(u"Фото")
            profile.validate_photo_view()
            self.logger.log("Photo view is validated")
            navigation.goto_tab_menu_item(u"Поклонники")
            vip_popup.validate_forbidden_nonvip()
            self.browser.back()
            navigation.goto_tab_menu_item(u"Гости")
            vip_popup.validate_forbidden_nonvip()
            self.browser.back()
            navigation.goto_tab_menu_item(u"Гороскоп")
            profile.validate_horo_view()
#            logout and login with another user to mark that user again to fix the profile marks reset
            self.logger.log("End profile navigation")
            window.close()
Example #2
0
        def run(self,browser,logger):
            self.browser = browser
            self.logger = logger
            window = BrowserWindow(browser, logger)
            auth = AuthForm(browser,logger)
            navigation = Navigation(browser,logger)
            profile = Profile(browser,logger)
            filter = Filters(browser,logger)
            marks = Marks(browser,logger)

            window.open(settings.target_url)
            #            implement URL check
            self.do_method(auth.login_with_vk_full_scale,profiling_events.login_event,auth.FilterUserNonVipVK)
            for age in self.ages_list:
                self.logger.log("For age = " + str(age) + " search age interval = " + str(self.ages_list[age]))
                profile.set_age(age)
                navigation.goto_main_top_menu_item(u"Знакомства")
                navigation.validate_in_search()
                filter.init_age_filter()
                filter.drag_right_age_search_slider_to_max()
                filter.drag_right_age_search_slider_to_min()
                filter.validate_search_users_in_search_age(filter.get_age_search_interval_list())
                if self.ages_list[age] != filter.get_age_search_interval_value():
                    raise TestFailedException("Wrong mininal age search interval")
            profile.set_age(auth.FilterUserNonVipVK.age)
            window.close()
Example #3
0
        def run(self,browser,logger):
            auth = AuthForm(self.browser, self.logger)
            window = BrowserWindow(self.browser,self.logger)
            navigation = Navigation(self.browser,self.logger)
            questionary = Questionary(self.browser,self.logger)

            self.do_method(auth.login_with_fb_full_scale,profiling_events.login_event,auth.User1)
            navigation.goto_top_menu_item(u"Профиль")
            questionary.expand()
            questionary.hide()
            questionary.expand()
            questionary.cancel()
            questionary.expand()
            questionary.uncheck_all_countries()
            questionary.save()
            questionary.validate_error_msg_wrong_data()
            questionary.fill_first_14_elements()
            questionary.save()
            questionary.validate_error_msg_answers_not_enough()
            questionary.check_dropdowns_to_input_transformation()
            questionary.fill_all()
            questionary.save()
            questionary.validate_saved_correctly()
            navigation.goto_top_menu_item(u"Профиль")
            questionary.expand()
            questionary.validate_filled_all()
            questionary.unfill_all()
            questionary.save()

            window.close()
Example #4
0
        def run(self,browser,logger):
            auth = AuthForm(browser,logger)
            filter = Filters(browser,logger)
            navigation = Navigation(browser,logger)
            window = BrowserWindow(browser, logger)

            window.open(settings.target_url)
            self.do_method(auth.login_with_vk_full_scale,profiling_events.login_event,auth.FilterUserNonVipVK)
            navigation.goto_main_top_menu_item(u"Знакомства")
            filter.init_age_filter()
            if filter.get_age_search_interval_value() < self.minimal_age_interval:
                filter.drag_left_age_search_slider_to_min()
                sleep(5)
                filter.drag_right_age_search_slider_to_max()
            filter.close_age()
            filter.select_online()
            for sex in range(self.sexes_amount):
                filter.change_sex()
                for goal in filter.get_goals():
                    filter.select_goal(goal)
                    #                    checking for validate_user_amount filter is working
                    self.logger.log("Validating users in search box")
                    filter.validate_in_search_goal(goal=goal,online=True)
            filter.change_sex()
            window.close()
Example #5
0
        def run(self, browser, logger):
            self.browser = browser
            self.logger = logger
            window = BrowserWindow(browser, logger)
            auth = AuthForm(browser,logger)
            navigation = Navigation(browser,logger)
            profile = Profile(browser,logger)
            filter = Filters(browser,logger)
            marks = Marks(browser,logger)

            window.open(settings.target_url)
            #            implement URL check
            self.do_method(auth.login_with_vk_full_scale,profiling_events.login_event,auth.FilterUserNonVipVK)
            profile.set_age(self.age_min)
            navigation.goto_main_top_menu_item(u"Знакомства")
            filter.init_age_filter()
            filter.drag_left_age_search_slider_to_max()
            sleep(5)
            for age in reversed(range(self.age_max_max-self.age_max_min)):
                filter.init_age_filter()
                filter.drag_right_age_search_slider_backward()
                sleep(5)
                filter.validate_search_users_in_search_age(filter.get_age_search_interval_list())
            profile.set_age(auth.FilterUserNonVipVK.age)
            window.close()
Example #6
0
        def run(self, browser, logger):

            marks = Marks(self.browser, self.logger)
            window = BrowserWindow(self.browser, self.logger)
            auth = AuthForm(self.browser, self.logger)

            self.do_method(auth.login_with_fb_full_scale, profiling_events.login_event)
            major_marks = marks.get_major_marks()
            self.do_method(marks.mark_major_marks_standart_comment, None, major_marks)
            window.close()
Example #7
0
        def run(self, browser, logger):

            marks = Marks(self.browser, self.logger)
            window = BrowserWindow(self.browser, self.logger)
            auth = AuthForm(self.browser, self.logger)

            self.do_method(auth.login_with_fb_full_scale, profiling_events.login_event)
            minor_marks = marks.get_minor_marks()
            for mark in minor_marks:
                self.do_method(marks.mark_and_validate_mark, None, mark)
            window.close()
Example #8
0
        def run(self, browser, logger):

            marks = Marks(self.browser, self.logger)
            window = BrowserWindow(self.browser, self.logger)
            auth = AuthForm(self.browser, self.logger)
            #       login as user1
            self.logger.log("\r\nLogin as User1\r\n")
            self.do_method(auth.login_with_fb_full_scale, profiling_events.login_event, auth.User1)
            self.do_method(window.open, None, AuthForm.User2.profile_url)
            marks.click(marks.get_mark_by_value(1))
            self.do_method(marks.validate_profile_mark_sent)
            window.close()
Example #9
0
        def run(self, browser, logger):
            # Get local session of firefox
            window = BrowserWindow(browser, logger)
            authForm = AuthForm(browser,logger)

            window.open(settings.target_url)
#            implement URL check

            self.do_method(authForm.click_social,None,"facebook")
            self.do_method(window.switch_to_popup)
            self.do_method(authForm.login_to_fb)
            self.do_method(window.switch_to_root)
            self.do_method(authForm.validate_fb_login_success)
            window.close()
Example #10
0
        def run(self, browser, logger):

            marks = Marks(self.browser, self.logger)
            window = BrowserWindow(self.browser, self.logger)
            auth = AuthForm(self.browser, self.logger)
            navigation = Navigation(self.browser, self.logger)
            #       login as user1
            self.logger.log("\r\nLogin as User1\r\n")

            self.do_method(
                auth.login_with_fb_full_scale, profiling_events.events[profiling_events.login_event], auth.User1
            )
            self.do_method(navigation.goto_side_menu_item, None, u"Оценки")
            self.do_method(
                marks.validate_new_mark_in_feed, None, AuthForm.User2.profile_url, datetime.now().strftime("%d")
            )
            window.close()
Example #11
0
        def run(self, browser, logger):
            auth = AuthForm(self.browser, self.logger)
            window = BrowserWindow(self.browser,self.logger)
            profile = Profile(self.browser,self.logger)
            marks = Marks(self.browser, self.logger)

            self.do_method(auth.login_with_vk_full_scale,profiling_events.events[profiling_events.login_event],auth.User1)
#            navigate to resetted user profile
            window.open(auth.User1.profile_url_fb)

            for i in range(profile.marks_after_reset_amount):
                marks.click(
                    marks.get_mark_by_value(i+1)
                )
                marks.validate_profile_mark_sent()
                window.open(auth.User1.profile_url_fb)
            window.close()
Example #12
0
        def run(self,browser,logger):

            window = BrowserWindow(browser, logger)
            authForm = AuthForm(browser,logger)

            window.open(settings.target_url)
#            implement URL check
#            try:
#                assert window.get_current_url() == window.get_unauthorised_url()
#            except AssertionError:
#                raise TestFailedException("Wrong URL")

            self.do_method(authForm.click_social,None,"mail.ru")
            self.do_method(window.switch_to_popup)
            self.do_method(authForm.login_to_mailru)
            self.do_method(window.switch_to_root)
            self.do_method(authForm.validate_login_success)
            window.close()
Example #13
0
        def run(self, browser, logger):
            auth = AuthForm(self.browser, self.logger)
            window = BrowserWindow(self.browser, self.logger)
            navigation = Navigation(self.browser, self.logger)
            messenger = Messenger(self.browser, self.logger)

            output_message = u"Привет!"

            self.do_method(auth.login_with_fb_full_scale, profiling_events.login_event, auth.User1)
            window.open(auth.User2.profile_url)
            navigation.goto_messenger_from_profile()
            #            No UI validation
            self._root_window = self.browser.current_window_handle
            messenger.send_and_validate_message(output_message)
            window.switch_to_popup()
            navigation.goto_side_menu_item(u"Сообщения")
            navigation.goto_tab_menu_item(u"Отправленные")
            messenger.delete_last_message_from_output_feed_fb(output_message)
            window.close()
Example #14
0
        def run(self, browser, logger):
            auth = AuthForm(self.browser, self.logger)
            window = BrowserWindow(self.browser, self.logger)
            navigation = Navigation(self.browser, self.logger)
            messenger = Messenger(self.browser, self.logger)

            print "User 1 message validation finished successfully"

            output_message = u"Привет!"
            self.do_method(
                auth.login_with_fb_full_scale, profiling_events.events[profiling_events.login_event], auth.User2
            )
            sleep(2)
            navigation.goto_side_menu_item(u"Сообщения")
            sleep(2)
            navigation.validate_in_tab(u"Новые")
            messenger.validate_last_message_in_feed_fb(output_message)
            navigation.goto_tab_menu_item(u"Входящие")
            messenger.validate_last_message_in_feed_fb(output_message)
            window.close()
Example #15
0
        def run(self, browser, logger):

            marks = Marks(self.browser, self.logger)
            window = BrowserWindow(self.browser, self.logger)
            auth = AuthForm(self.browser, self.logger)
            energy = Energy(self.browser, self.logger)

            self.do_method(auth.login_with_fb_full_scale, profiling_events.login_event)
            initial_energy_value = energy.get_profile_percent_value()
            marks_left_till_plus = marks.get_marks_left_till_energy_plus()
            marks_left = [int(s) for s in marks_left_till_plus.split() if s.isdigit()][0]

            print "Marks left = " + str(marks_left)

            for i in range(marks_left):
                print "step " + str(i)
                self.do_method(marks.marking_made_closer_to_more_energy, None, marks_left_till_plus, i)
            try:
                self.logger.log("Initial egergy value = " + str(initial_energy_value))
                print energy.get_profile_percent_value()
                assert initial_energy_value == energy.get_profile_percent_value() - 3
            except AssertionError:
                raise TestFailedException("Failed to add correct energy amount")
            window.close()
Example #16
0
        def run(self, browser, logger):
            marks = Marks(self.browser, self.logger)
            window = BrowserWindow(self.browser, self.logger)
            auth = AuthForm(self.browser, self.logger)

            self.do_method(
                auth.login_with_fb_full_scale, profiling_events.events[profiling_events.login_event], auth.User1
            )
            marked_users = [marks.get_photo2mark_href()]
            for i in range(marks.unique_amount):
                marks.like()
                href2like = marks.get_photo2mark_href()
                if href2like in marked_users:
                    print marked_users
                    print href2like
                    raise TestFailedException("Found duplicate user in main search")
                marked_users.append(href2like)
                marks.mark()
                href2like = marks.get_photo2mark_href()
                if href2like in marked_users:
                    self.logger.log("Duplicate user = "******" found in list " + str(marked_users))
                    raise TestFailedException("Found duplicate user in main search")
                marked_users.append(href2like)
            window.close()
Example #17
0
class XMLModel(Model):

    def __init__(self,browser,logger):
        self.browser = browser
        self.logger = logger
        self.window = BrowserWindow(self.browser, self.logger)

    def click(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        self.logger.log("Click Element = " + xpath)
        element = self.get_element_by_xpath(xpath)
        try:
            element.click()
        except Exception as e:
            print "Failed to simply click on element: " + e.message
            ActionChains(self.browser).move_to_element_with_offset(element, 1, 1).click().perform()

    def click_and_hold(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        raise NotImplementedError

    def click_at(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        raise NotImplementedError

    def click_at_and_hold(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        raise NotImplementedError

    def hover(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        element = self.get_element_by_xpath(xpath)
        self.logger.log("Hover element " + xpath)
        hover = ActionChains(self.browser).move_to_element(element)
        hover.perform()

    def enter_text(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        element = self.get_element_by_xpath(xpath)
        self.logger.log("Typing text = " + str(value) + " to element with xpath = " + xpath)
        element.clear()
        element.send_keys(value)

    def select_from_dropdown_by_index(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        dropdown = self.get_element_by_xpath(xpath)
        self.logger.log("Select element with index =  " + str(value))
        select = Select(dropdown)
        select.select_by_index(value)

    def select_from_dropdown_by_value(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        dropdown = self.get_element_by_xpath(xpath)
        self.logger.log("Select element with value = " + str(value))
        select = Select(dropdown)
        select.select_by_value(str(value))

    def select_from_dropdown_by_text(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        dropdown = self.get_element_by_xpath(xpath)
        self.logger.log("Select element with text = " + str(value))
        select = Select(dropdown)
        select.select_by_value(str(value))

    def get_selected_value_from_dropdown(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        dropdown = self.get_element_by_xpath(xpath)
        self.logger.log("Getting selected value from dropdown " + xpath)
        select = Select(dropdown)
        return select.first_selected_option.get_attribute("value")

    def authorize(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        auth = AuthForm(self.browser,self.logger)
        if platform == "fb-sa":
            if value == "User1":
                auth.login_with_fb_full_scale()

    def mark_user(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        pass

    def filter_city(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        pass

    def open_url(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        self.window.open(value)

    def switch_to_popup(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        self.window.switch_to_popup()

    def switch_to_root(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        self.window.switch_to_root()

    def logout(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        self.window.logout()

    def close(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        self.window.close()

    def assert_text(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        pass

    def assert_attribute(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        pass

    def assert_html(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        pass

    def assert_element(self,xpath=None,value=None,amount=None,time_delta=None,platform=None,coords=None):
        pass