Esempio n. 1
0
 def click_first_result(self) -> UserInfoView:
     time.sleep(3)
     element = BaseButton(
         driver=self.driver,
         locator_value=
         '//androidx.recyclerview.widget.RecyclerView/android.view.ViewGroup[1]',
         locator_by=MobileBy.XPATH)
     element.click()
     return UserInfoView(self.driver)
Esempio n. 2
0
 def __init__(self, driver: Remote):
     super(SearchInput,
           self).__init__(driver=driver,
                          locator_value='com.truecaller:id/search_field')
     self.camera_pop_up = BaseButton(
         driver=self.driver,
         locator_value=
         "//*[contains(@text,'Point your camera at any phone')]",
         locator_by=MobileBy.XPATH)
Esempio n. 3
0
 def __init__(self, driver: Remote):
     self.driver = driver
     self.next_button = BaseButton(
         driver=self.driver, locator_value='com.truecaller:id/nextButton')
     self.continue_button = BaseButton(driver=self.driver,
                                       locator_value='android:id/button1')
     self.cancel_button = BaseButton(driver=self.driver,
                                     locator_value='android:id/button2')
     self.next = BaseButton(driver=self.driver,
                            locator_value='com.truecaller:id/next')
Esempio n. 4
0
 def __init__(self, driver: Remote):
     super(CreateProfileView, self).__init__(driver)
     self.type_name_button = BaseButton(
         driver=self.driver,
         locator_value='com.truecaller:id/manualInputButton')
     self.first_name_input = BaseInput(
         driver=self.driver, locator_value='com.truecaller:id/firstName')
     self.last_name_input = BaseInput(
         driver=self.driver, locator_value='com.truecaller:id/lastName')
     self.later_button = BaseButton(driver=self.driver,
                                    locator_value="//*[@text='LATER']",
                                    locator_by=MobileBy.XPATH,
                                    return_view=CallsView)
Esempio n. 5
0
 def __init__(self, driver: Remote):
     super(StartView, self).__init__(driver)
     self.get_started_button = self.next_button
     self.allow_button = BaseButton(
         driver=self.driver,
         locator_value=
         'com.android.packageinstaller:id/permission_allow_button')
     self.number_button = BaseButton(
         driver=self.driver,
         locator_value='com.truecaller:id/wizard_subscription_name',
         return_view=CreateProfileView)
     self.agree_button = BaseButton(
         driver=self.driver, locator_value='com.truecaller:id/agreeButton')
Esempio n. 6
0
class CreateProfileView(BaseView):
    def __init__(self, driver: Remote):
        super(CreateProfileView, self).__init__(driver)
        self.type_name_button = BaseButton(
            driver=self.driver,
            locator_value='com.truecaller:id/manualInputButton')
        self.first_name_input = BaseInput(
            driver=self.driver, locator_value='com.truecaller:id/firstName')
        self.last_name_input = BaseInput(
            driver=self.driver, locator_value='com.truecaller:id/lastName')
        self.later_button = BaseButton(driver=self.driver,
                                       locator_value="//*[@text='LATER']",
                                       locator_by=MobileBy.XPATH,
                                       return_view=CallsView)

    def fill_profile(self) -> None:
        if not self.next.is_visible():
            self.type_name_button.wait_for_element(timeout=30)
            self.type_name_button.click()
            self.first_name_input.set_value('Test')
            self.last_name_input.set_value('Name')
            self.next_button.click()
        for _ in range(3):
            self.next.click()
        self.cancel_button.click()
        time.sleep(1)
        self.cancel_button.click()
        self.next.click()
        self.later_button.click()
Esempio n. 7
0
class StartView(BaseView):
    def __init__(self, driver: Remote):
        super(StartView, self).__init__(driver)
        self.get_started_button = self.next_button
        self.allow_button = BaseButton(
            driver=self.driver,
            locator_value=
            'com.android.packageinstaller:id/permission_allow_button')
        self.number_button = BaseButton(
            driver=self.driver,
            locator_value='com.truecaller:id/wizard_subscription_name',
            return_view=CreateProfileView)
        self.agree_button = BaseButton(
            driver=self.driver, locator_value='com.truecaller:id/agreeButton')

    def allow_permissions(self) -> None:
        if self.cancel_button.is_visible():
            self.cancel_button.click()
        if self.continue_button.is_visible():
            self.continue_button.click()
        if self.allow_button.is_visible():
            for _ in range(4):
                self.allow_button.click()
Esempio n. 8
0
class SearchInput(BaseInput):
    def __init__(self, driver: Remote):
        super(SearchInput,
              self).__init__(driver=driver,
                             locator_value='com.truecaller:id/search_field')
        self.camera_pop_up = BaseButton(
            driver=self.driver,
            locator_value=
            "//*[contains(@text,'Point your camera at any phone')]",
            locator_by=MobileBy.XPATH)

    def set_value(self, value: str) -> None:
        if self.camera_pop_up.is_visible():
            try:
                action = TouchAction(self.driver)
                action.tap(None, 241, 720).perform()
            except InvalidElementStateException:
                pass
        super(SearchInput, self).set_value(value=value)
Esempio n. 9
0
 def __init__(self, driver: Remote):
     super(CallsView, self).__init__(driver)
     self.truecaller_logo = BaseButton(
         driver=self.driver,
         locator_value='com.truecaller:id/truecaller_logo',
         return_view=SearchView)