def test_c16(self): log.info("Add contact by contact book: '{}'".format( config.UKRAINE_FIRSTNAME + ' ' + config.UKRAINE_LASTNAME)) contacts = ByContactsScreen(self.driver) menu = Menu(self.driver) menu.go_to(menu.wenums.CONTACTS, [menu.wenums.NEW_CONTACT, menu.wenums.BY_CONTACTS], menu.wenums.CONTACTS) contacts.tap_add_contact(self.FRIEND) log.info("Verify friend request sent") Verify.true(contacts.requested_check(), "No request sent") menu.long_press_wheel() manage = Manager(self.driver) manage.log_out() nynja_login_screen = LoginScreen(self.driver) nynja_home_screen = HomeScreen(self.driver) nynja_login_screen.set_full_number(self.COUNTRY_CODE, self.PHONE_NUMBER) nynja_login_screen.tap_confirm_btn() nynja_login_screen.set_sms() log.info("Authorised by friend: '{}'".format(self.PHONE_NUMBER)) Verify.true(nynja_home_screen.is_home_screen_displayed(), "Home Screen is not displayed") # TODO: Update contact = self.driver.find_elements_by_xpath( '//XCUIElementTypeCell' '[@name="contact_request_profile_contact_cell"]') log.info('Contacts cell collected') if not contact: raise NoSuchElementException for elem in contact: log.info('We are in elements') if elem.find_element_by_xpath('//XCUIElementTypeStaticText').get_attribute('name') == \ config.CHINA_FIRSTNAME + ' ' + config.CHINA_LASTNAME: log.info('China user find') accept_friend = elem.find_element_by_id('Accept') el = Element(self.driver) el.tap_element(accept_friend) manage.log_out() nynja_login_screen.set_full_number(config.CHINA_COUNTRY_CODE, config.CHINA_NUMBER) nynja_login_screen.tap_confirm_btn() nynja_login_screen.set_sms() log.info("Authorised by main account: '{}'".format( config.CHINA_NUMBER)) Verify.true(nynja_home_screen.is_home_screen_displayed(), "Home Screen is not displayed")
def test_c18(self): log.info("Add Username") home = HomeScreen(self.driver) profile = MyUsernameScreen(self.driver) menu = Menu(self.driver) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.EDIT_PROFILE, menu.wenums.MY_USERNAME], menu.wenums.CHATS) profile.set_username(self.NEW_USERNAME) profile.tap_done_btn() home.is_home_screen_displayed() log.info("Verify username is added successfully.") Verify.true(home.is_profile_updated(self.NEW_USERNAME), "The names are not updated")
def test_c19(self): log.info("Keep old Username after update") home = HomeScreen(self.driver) profile = MyUsernameScreen(self.driver) menu = Menu(self.driver) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.EDIT_PROFILE, menu.wenums.MY_USERNAME], menu.wenums.CHATS) profile.set_username(self.NEW_USERNAME) profile.tap_keep_btn() home.is_home_screen_displayed() log.info("Verify username is not updated") Verify.true(home.is_profile_updated(self.ACTUAL_USERNAME), "The username updated")
def test_c23(self): log.info("Edit First and Last names") menu = Menu(self.driver) home = HomeScreen(self.driver) profile = MyNameScreen(self.driver) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.EDIT_PROFILE, menu.wenums.MY_NAME], menu.wenums.CHATS) profile.set_first_name(self.NEW_FIRST_NAME) profile.set_last_name(self.NEW_LAST_NAME) profile.tap_done_btn() home.is_home_screen_displayed() log.info("Verify first and last names are updated successfully.") Verify.true(home.is_profile_updated(self.NEW_FIRST_NAME), "The names are not updated")
def test_c20(self): log.info("Edit Username") home = HomeScreen(self.driver) profile = MyUsernameScreen(self.driver) menu = Menu(self.driver) self.driver.find_element(*(By.ID, self.OLD_USERNAME)) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.EDIT_PROFILE, menu.wenums.MY_USERNAME], menu.wenums.CHATS) profile.set_username(self.EDIT_USERNAME) profile.tap_done_btn() home.is_home_screen_displayed() log.info("Verify username is updated successfully.") Verify.true(home.is_profile_updated(self.EDIT_USERNAME), "The names are not updated")
def test_c26409(self): log.info("Close avatar preview") home = HomeScreen(self.driver) home.tap_avatar() home.close_avatar() log.info("Verify Preview was closed") Verify.true(home.is_home_screen_displayed(), "Preview was not closed")
def test_c17(self): log.info("Accept friend request from : '{}'".format( config.CHINA_NUMBER)) manage = Manager(self.driver) manage.log_out() nynja_login_screen = LoginScreen(self.driver) nynja_home_screen = HomeScreen(self.driver) nynja_login_screen.set_full_number(self.COUNTRY_CODE, self.PHONE_NUMBER) nynja_login_screen.tap_confirm_btn() nynja_login_screen.set_sms() log.info("Authorised by friend: '{}'".format(self.PHONE_NUMBER)) Verify.true(nynja_home_screen.is_home_screen_displayed(), "Home Screen is not displayed") contact = self.driver.find_elements_by_xpath( '//XCUIElementTypeCell' '[@name="contact_request_profile_contact_cell"]') log.info('Contacts cell collected') if not contact: raise NoSuchElementException for elem in contact: log.info('We are in elements') if elem.find_element_by_xpath('//XCUIElementTypeStaticText').get_attribute('name') == \ config.CHINA_FIRSTNAME + ' ' + config.CHINA_LASTNAME: log.info('China user find') accept_friend = elem.find_element_by_id('Accept') el = Element(self.driver) el.tap_element(accept_friend) manage.log_out() nynja_login_screen.set_full_number(config.CHINA_COUNTRY_CODE, config.CHINA_NUMBER) nynja_login_screen.tap_confirm_btn() nynja_login_screen.set_sms() log.info("Authorised by main account: '{}'".format( config.CHINA_NUMBER)) Verify.true(nynja_home_screen.is_home_screen_displayed(), "Home Screen is not displayed")
def test_c13(self): log.info("Login to Nynja APP, set phone number '{}'".format( self.PHONE_NUMBER)) login = LoginScreen(self.driver) home = HomeScreen(self.driver) login.set_full_number(self.COUNTRY_CODE, self.PHONE_NUMBER) login.tap_confirm_btn() login.set_sms() log.info("Verify user is authorized successfully.") Verify.true(home.is_home_screen_displayed(), "Home Screen is not displayed")
def test_c12(self): login = LoginScreen(self.driver) home = HomeScreen(self.driver) log.info("Registration with valid data: '{}'".format(self.PHONE_NUMBER)) if not self.driver.find_elements(*RegistrationPageLocators.CHECK_PAGE): login.set_full_number(self.COUNTRY_CODE_NUMBER, self.PHONE_NUMBER) login.tap_confirm_btn() login.set_sms() login.set_first_name(self.FIRST_NAME) login.set_last_name(self.LAST_NAME) login.tap_done_btn() log.info("Verify user is registered successfully.") Verify.true(home.is_home_screen_displayed(), "Home Screen is not displayed") manage = Manager(self.driver) manage.log_out()