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
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)
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)
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)
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()
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)
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)
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)
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)
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)
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)