예제 #1
0
class LoginPage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)
        self.touchActions = TouchAction(driver)

    def testLogin(self, login, password):
        self.actions._type(LoginPageLocators._username_input, login)
        self.driver.implicitly_wait(5)
        self.actions._type(LoginPageLocators._password_input, password)
        self.driver.implicitly_wait(5)
        self.actions._click(LoginPageLocators._signin_button)



    def invalidusername(self):
        try:
            self.actions._wait_for_element(LoginPageLocators._wrong_username)
        except:
            print('exception')
            return False
        else:
            print("Login failed!")
            return True

    def invalidpass(self):
        try:
            self.actions._wait_for_element(LoginPageLocators._wrong_pass)
        except:
            print('exception')
            return False
        else:
            print("Incorrect user ID or password!")
            return True
예제 #2
0
class SettingsPage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)

    #def basicinfo(self):
        #self.actions._click()

    def account(self):
        self.actions._wait_for_element(Settings._account_button)
        self.actions._click(Settings._account_button)
예제 #3
0
class MyprofilePage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)

    def go_to_settings(self):
        self.actions._click(MyProfile._settings_button)

    def check_credits(self):
        self.actions._wait_for_element(MyProfile._credits_number)
        creditstotal = self.actions._get_text(MyProfile._credits_number)
        print(creditstotal)
예제 #4
0
class NonVisibleWidgets(MakesmithInitFuncs):
    """

    NonVisibleWidgets is a home for widgets which do not have a visible representation like
    the serial connection, but which still need to be tied in to the rest of the program.

    """

    serialPort = SerialPort()
    gcodeFile = GCodeFile()
    importFile = ImportFile()
    actions = Actions()
    triangularCalibration = TriangularCalibration()
    opticalCalibration = OpticalCalibration()
    messageProcessor = MessageProcessor()
    mcpProcessor = WebMCPProcessor()
    consoleProcessor = ConsoleProcessor()
    camera = WebcamVideoStream()

    def setUpData(self, data):
        """

        The setUpData function is called when a widget is first created to give that widget access
        to the global data object. This should be replaced with a supper classed version of the __init__
        function.

        """

        self.data = data
        # print "Initialized: " + str(self)

        data.serialPort = (self.serialPort
                           )  # add the serial port widget to the data object
        data.gcodeFile = self.gcodeFile
        data.importFile = self.importFile
        data.actions = self.actions
        data.triangularCalibration = self.triangularCalibration
        data.opticalCalibration = self.opticalCalibration
        data.messageProcessor = self.messageProcessor
        data.mcpProcessor = self.mcpProcessor
        data.consoleProcessor = self.consoleProcessor
        data.camera = self.camera

        self.serialPort.setUpData(data)
        self.gcodeFile.setUpData(data)
        self.importFile.setUpData(data)
        self.actions.setUpData(data)
        self.triangularCalibration.setUpData(data)
        self.opticalCalibration.setUpData(data)
        self.messageProcessor.setUpData(data)
        self.mcpProcessor.setUpData(data)
        self.consoleProcessor.setUpData(data)
        self.camera.setUpData(data)
        self.camera.getSettings()
예제 #5
0
class AccountPage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)

    def signout(self):
        self.actions._click(Account._signout_button)
        try:
            self.actions._wait_for_element(WelcomePageLocators._login_button)
            self.actions._is_displayed(WelcomePageLocators._login_button)
        except:
            print('exception')
            return False
        else:
            print("Logout Success!")
            return True

    def hideaccount(self):
        self.actions._click(Account._hideaccount_button)

    def backtosettings(self):
        self.actions._click(Account._back_button)
예제 #6
0
class MenuPage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)

    def go_to_Me(self):
        self.actions._wait_for_element(MenuLocators._me_button)
        self.actions._click(MenuLocators._me_button)
        self.actions._is_displayed(MyProfile._settings_button)
예제 #7
0
class Controller(MakesmithInitFuncs):
    """

    NonVisibleWidgets is a home for widgets which do not have a visible representation like
    the serial connection, but which still need to be tied in to the rest of the program.

    """

    actions = Actions()
    gracefulKiller = GracefulKiller()
    logger = Logger()
    config = Config()
    watchdog = WatchDog()
    ui_queue = queue.Queue()
    message_queue = LoggingQueue(logger)

    def setUpData(self, data):
        """

        The setUpData function is called when a widget is first created to give that widget access
        to the global data object. This should be replaced with a supper classed version of the __init__
        function.

        """

        self.data = data


        self.data.actions = self.actions
        self.data.gracefulKiller = self.gracefulKiller
        self.data.logger = self.logger
        self.data.config = self.config
        self.data.ui_queue = self.ui_queue
        self.data.message_queue = self.message_queue
        self.data.watchdog = self.watchdog

        self.actions.setUpData(data)
        self.gracefulKiller.setUpData(data)
        self.logger.setUpData(data)
        self.config.setUpData(data)
        self.watchdog.setUpData(data)

        self.watchdog.checkForRunningContainer()
예제 #8
0
class ChatPage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)
        self.driver.TouchAction = TouchAction(driver)


    def backfromchat(self):

        #self.actions._wait_for_element(Chat._back_from_chat)
        self.actions._click(Chat._back_from_chat)
        self.driver.TouchAction.long_press(x=88, y=181).release().perform()

    def chat_text(self):
        self.actions._wait_for_element(Chat._chat_text)
        self.actions._is_displayed(Chat._chat_text)
예제 #9
0
class WelcomePage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)
        self.driver.TouchAction = TouchAction(driver)

    def clickSignUp(self):
        self.actions._click(WelcomePageLocators._login_button)

    def clickLogin(self):
        self.actions._wait_for_element(WelcomePageLocators._joinus_button)
        self.actions._click(WelcomePageLocators._joinus_button)
        self.driver.implicitly_wait(5)
        self.driver.TouchAction.tap(biometric_cancel[0], biometric_cancel[1],
                                    biometric_cancel[2],
                                    biometric_cancel[3]).perform()
예제 #10
0
class FilterPage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)
        self.driver.TouchAction = TouchAction(driver)

    def filter(self):
        self.actions._wait_for_element(SwipeFilterLocator._save_button)

    def tapmen(self):
        self.driver.TouchAction.tap(Filter_Swipe.filter_men[0],
                                    Filter_Swipe.filter_men[1],
                                    Filter_Swipe.filter_men[2],
                                    Filter_Swipe.filter_men[3]).perform()

    def tapwomen(self):
        self.driver.TouchAction.tap(Filter_Swipe.filter_women[0],
                                    Filter_Swipe.filter_women[1],
                                    Filter_Swipe.filter_women[2],
                                    Filter_Swipe.filter_women[3]).perform()

    def tapboth(self):
        self.driver.TouchAction.tap(Filter_Swipe.filter_both[0],
                                    Filter_Swipe.filter_both[1],
                                    Filter_Swipe.filter_both[2],
                                    Filter_Swipe.filter_both[3]).perform()

    def taplocation(self):
        self.driver.TouchAction.tap(Filter_Swipe.filter_location[0],
                                    Filter_Swipe.filter_location[1],
                                    Filter_Swipe.filter_location[2],
                                    Filter_Swipe.filter_location[3]).perform()
        self.driver.implicitly_wait(5)

    def save(self):
        self.actions._find(SwipeFilterLocator._save_button)
        self.actions._click(SwipeFilterLocator._save_button)
예제 #11
0
 def __init__(self, driver):
     self.driver = driver
     self.actions = Actions(driver)
예제 #12
0
class NonVisibleWidgets(MakesmithInitFuncs):
    """

    NonVisibleWidgets is a home for widgets which do not have a visible representation like
    the serial connection, but which still need to be tied in to the rest of the program.

    """

    serialPort = SerialPort()
    gcodeFile = GCodeFile()
    importFile = ImportFile()
    actions = Actions()
    triangularCalibration = TriangularCalibration()
    opticalCalibration = OpticalCalibration()
    holeyCalibration = HoleyCalibration()
    holeyKinematics = HoleyKinematics()
    messageProcessor = MessageProcessor()
    mcpProcessor = WebMCPProcessor()
    consoleProcessor = ConsoleProcessor()
    camera = WebcamVideoStream()
    gpioActions = GPIOActions()
    boardManager = BoardManager()
    releaseManager = ReleaseManager()
    helpManager = HelpManager()

    #gcodeOptimizer = GCodeOptimizer()

    def setUpData(self, data):
        """

        The setUpData function is called when a widget is first created to give that widget access
        to the global data object. This should be replaced with a supper classed version of the __init__
        function.

        """

        self.data = data
        # print "Initialized: " + str(self)

        data.serialPort = (self.serialPort
                           )  # add the serial port widget to the data object
        data.gcodeFile = self.gcodeFile
        data.importFile = self.importFile
        data.actions = self.actions
        data.triangularCalibration = self.triangularCalibration
        data.holeyCalibration = self.holeyCalibration
        data.holeyKinematics = self.holeyKinematics
        data.opticalCalibration = self.opticalCalibration
        data.messageProcessor = self.messageProcessor
        data.mcpProcessor = self.mcpProcessor
        data.consoleProcessor = self.consoleProcessor
        data.camera = self.camera
        data.gpioActions = self.gpioActions
        data.boardManager = self.boardManager
        data.releaseManager = self.releaseManager
        data.helpManager = self.helpManager
        #data.gcodeOptimizer = self.gcodeOptimizer

        if hasattr(sys, '_MEIPASS'):
            data.platform = "PYINSTALLER"
            data.platformHome = sys._MEIPASS

        data.pyInstallPlatform = platform.system().lower()

        if data.pyInstallPlatform == "windows":
            if platform.machine().endswith('64'):
                data.pyInstallPlatform = "win64"
            if platform.machine().endswith('32'):
                data.pyInstallPlatform = "win32"

        if data.pyInstallPlatform == "linux":
            _platform = distro.linux_distribution()[0].lower()
            print("##")
            print(_platform)
            print("##")
            if _platform.find("raspbian") != -1:
                data.pyInstallPlatform = 'rpi'
        print("----")
        print(data.pyInstallPlatform)

        if getattr(sys, 'frozen', False):
            if hasattr(sys, '_MEIPASS'):
                if sys._MEIPASS.find("_MEI") == -1:
                    data.pyInstallType = "singledirectory"
                else:
                    data.pyInstallType = "singlefile"
        else:
            data.pyInstallType = "singledirectory"

        print(data.pyInstallType)
        print("----")

        self.serialPort.setUpData(data)
        self.gcodeFile.setUpData(data)
        self.importFile.setUpData(data)
        self.actions.setUpData(data)
        self.triangularCalibration.setUpData(data)
        self.holeyCalibration.setUpData(data)
        self.holeyKinematics.setUpData(data)
        self.opticalCalibration.setUpData(data)
        self.messageProcessor.setUpData(data)
        self.mcpProcessor.setUpData(data)
        self.consoleProcessor.setUpData(data)
        self.camera.setUpData(data)
        self.camera.getSettings()
        self.gpioActions.setUpData(data)
        self.gpioActions.setup()
        self.boardManager.setUpData(data)
        self.boardManager.initializeNewBoard()
        self.releaseManager.setUpData(data)
        self.helpManager.setUpData(data)
        #self.gcodeOptimizer.setUpData(data)

        #set up kinematics with current settings
        self.holeyKinematics.initializeSettings()
예제 #13
0
class SwipePage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)
        self.driver.TouchAction = TouchAction(driver)

    def cometoswip(self):
        self.driver.implicitly_wait(5)
        self.actions._is_displayed(MenuLocators._me_button)

    def successlogin(self):
        self.actions._wait_for_element(SwipePageLocators._filter_button)
        try:
            self.actions._is_displayed(SwipePageLocators._filter_button)
        except:
            print('exception')
            return False
        else:
            print("Login Success!")
            return True

    def filtersaved(self):
        self.actions._wait_for_element(SwipePageLocators._filter_button)
        try:
            self.actions._is_displayed(SwipePageLocators._filter_button)
        except:
            print('exception')
            return False
        else:
            print("Filter was Changed!")
            return True

    def gotofilter(self):

        self.actions._wait_for_element(SwipePageLocators._filter_button)
        self.actions._click(SwipePageLocators._filter_button)

    def GetPageSize(self):
        x = self.driver.get_window_size()['width']
        y = self.driver.get_window_size()['height']
        return (x, y)

    def scroll_down_to_block_or_report(self):
        self.driver.TouchAction.long_press(x=524, y=1760).move_to(
            x=524, y=400).release().perform()

        try:
            self.actions._is_displayed(SwipePageLocators._block_button)
            self.actions._click(SwipePageLocators._block_button)
            print("block button found")

        except:
            self.scroll_down_to_block_or_report()

    def report_abuse(self):
        self.actions._click(SwipePageLocators._report_abuse_button)

    def find_ID(self):
        self.actions._wait_for_element(IDlocators._user_Id)
        return self.actions._get_text(IDlocators._user_Id)

    def scroll_down_to_gift_card(self):
        self.driver.TouchAction.long_press(x=524, y=1760).move_to(
            x=524, y=400).release().perform()

        try:
            self.actions._is_displayed(SwipePageLocators._gift_card_button)
            print("GIft button found")

        except:
            print("Gift button is not found")
            self.scroll_down_to_gift_card()

    def scroll_down_to_location(self):
        self.driver.TouchAction.long_press(x=524, y=1760).move_to(
            x=524, y=400).release().perform()

        try:
            self.actions._is_displayed(SwipePageLocators._location_value)
            print("uraaaa gtanq")
        except:
            print('Location is not found')
            self.scroll_down_to_location()

    def location_text(self):
        return self.actions._get_text(SwipePageLocators._location_value)

    def swipe_left(self):
        self.actions._wait_for_element(SwipePageLocators._filter_button)
        self.driver.TouchAction.long_press(x=524, y=1760).move_to(
            x=400, y=1760).release().perform()
        print("Don't like!")

    def swipe_right(self):
        self.actions._wait_for_element(SwipePageLocators._filter_button)
        self.driver.TouchAction.long_press(x=524, y=1760).move_to(
            x=700, y=1760).release().perform()
        print("Like!")

    def tap_dislike_button(self):
        self.actions._wait_for_element(SwipePageLocators._dislike_button)
        self.actions._click(SwipePageLocators._dislike_button)
        print("Dislike!")

    def tap_like_button(self):
        self.actions._wait_for_element(SwipePageLocators._like_button)
        self.actions._click(SwipePageLocators._like_button)
        print("Like")

    def check_name_age(self):
        self.actions._wait_for_element(SwipePageLocators._user_name)
        self.actions._wait_for_element(SwipePageLocators._user_age)
        return self.actions._get_text(
            SwipePageLocators._user_name) + self.actions._get_text(
                SwipePageLocators._user_age)

    def undo(self):
        try:
            self.actions._wait_for_element(SwipePageLocators._undo_button)
            self.actions._click(SwipePageLocators._undo_button)
            self.actions._is_displayed(SwipePageLocators._photo_)
            self.driver.implicitly_wait(3)
            print("UNDO")
        except:
            print('Locator is not found, user is NOT PRIME')

    def tap_on_giftcard(self):
        self.actions._wait_for_element(SwipePageLocators._gift_card_button)
        self.actions._click(SwipePageLocators._gift_card_button)
        self.actions._wait_for_element(GiftLocators._friendship_gift_category)
예제 #14
0
def before_all(context):
    context.browser = Browser()
    context.actions = Actions()
    context.api_actions = ApiActions()
    context.variuos_functions = VariousFunctions()
예제 #15
0
class GiftPage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)
        self.driver.TouchAction = TouchAction(driver)

    def choose_gift_category_romantic(self):
        self.actions._wait_for_element(GiftLocators._romatic_gift_category)
        self.actions._click(GiftLocators._romatic_gift_category)
        self.actions._wait_for_element(
            GiftLocators._romantic_gift_selector_rose)

    def choose_romantic_gift(self):
        self.actions._wait_for_element(
            GiftLocators._romantic_gift_selector_kiss)
        self.actions._click(GiftLocators._romantic_gift_selector_kiss)
        self.actions._wait_for_element(
            GiftLocators._send_gift_screen_paid_button)

    def send_gift(self):
        self.actions._wait_for_element(
            GiftLocators._send_gift_screen_paid_button)
        self.actions._click(GiftLocators._send_gift_screen_paid_button)
        self.driver.implicitly_wait(7)

    def romantic_gift_is_visible_kiss(self):
        self.actions._wait_for_element(
            GiftLocators._romantic_gift_selector_kiss)
        self.actions._is_displayed(GiftLocators._romantic_gift_selector_kiss)

    def gift_credits_number(self):
        self.actions._wait_for_element(GiftLocators._gift_credits)
        credits = self.actions._get_text(GiftLocators._gift_credits)
        print(credits)
예제 #16
0
 def __init__(self, driver):
     self.driver = driver
     self.actions = Actions(driver)
     self.driver.TouchAction = TouchAction(driver)
예제 #17
0
class LocationPage:
    def __init__(self, driver):
        self.driver = driver
        self.actions = Actions(driver)

    def writelocation(self, city):
        #self.actions._wait_for_element(SwipeLocationLocators._search_box)
        self.actions._type(SwipeLocationLocators._search_box, city)
        self.driver.implicitly_wait(5)

    def chooselocation(self, city_name):
        self.actions._wait_for_element_dynamic(SwipeLocationLocators._line_results, city_name)
        self.actions._click_dynamic(SwipeLocationLocators._line_results, city_name)

    def findfirstline(self):
        self.actions._find(SwipeLocationLocators._line_results)

    def tapfirstline(self):
        self.actions._wait_for_element(SwipeLocationLocators._line_results)
        self.actions._click(SwipeLocationLocators._line_results)