def create_notification(self): self.auth_user(False) main_page = MainPage(self.driver) top_menu = main_page.top_menu top_menu.select_friends() friends = main_page.friends friends.invite__friend_to_group() self.log_out()
def test_add_reaction(self): self.auth_user() main_page = MainPage(self.driver) feed = main_page.feed reaction_number = feed.add_emotion_to_like() self.assertEqual(reaction_number, feed.get_number_emotion(), "add reaction fail")
def test_go_to_page_who_last_reaction(self): like_id = self.create_like() self.auth_user() self.open_user_wall() main_page = MainPage(self.driver) feed = main_page.feed names = feed.get_names_last_liked(like_id) links = feed.get_links_last_liked(like_id) for i in range(0, len(links)): if names[i] == UsersName.first_account_name: continue main_page.BASE_URL = links[i] main_page.open() center_menu = main_page.center_menu nickname = center_menu.get_another_nickname() self.assertEqual(nickname, UsersName.second_account_name)
def test_remove_reaction(self): self.auth_user() main_page = MainPage(self.driver) feed = main_page.feed self.create_like() feed.remove_like() self.assertEquals(REACTIONS_CLASS, feed.get_number_emotion(), "remove reaction fail")
def test_change_reaction(self): self.auth_user() main_page = MainPage(self.driver) feed = main_page.feed old_reaction = feed.get_number_emotion() reaction_number = feed.add_emotion_to_like(old_reaction) self.assertNotEquals(reaction_number, old_reaction, "change reaction fail")
def test_close_notification(self): self.create_notification() self.auth_user() main_page = MainPage(self.driver) top_menu = main_page.top_menu top_menu.select_notification() top_menu.close_notification() is_notification_close = top_menu.check_notification_close() self.assertTrue(is_notification_close, "close notification fail")
def test_show_who_last_reaction(self): like_id = self.create_like() self.auth_user() self.open_user_wall() main_page = MainPage(self.driver) feed = main_page.feed names = feed.get_names_last_liked(like_id) self.assertIn(UsersName.second_account_name, names, "second user not found")
def test_report_notification(self): self.create_notification() self.auth_user() main_page = MainPage(self.driver) top_menu = main_page.top_menu top_menu.select_notification() top_menu.report_notification() first_notification = top_menu.place_first_notification() self.assertEqual(REPORT_SUCCESS, first_notification, "report notification fail")
def create_like(self): self.auth_user(False) main_page = MainPage(self.driver) top_menu = main_page.top_menu top_menu.select_friends() friends = main_page.friends friends.select_friend() feed = main_page.feed like_id = feed.add_like() self.log_out() return like_id
def auth_user(cls, who=True): auth_page = AuthPage(cls.driver) auth_page.open() auth_form = auth_page.form auth_form.authorized(who) main_page = MainPage(cls.driver) center_menu = main_page.center_menu nickname = center_menu.get_nickname() if who: UsersName.first_account_name = nickname else: UsersName.second_account_name = nickname
def test_select_notification_tabs(self): self.auth_user() main_page = MainPage(self.driver) top_menu = main_page.top_menu top_menu.select_notification() titles = [] for i in range(0, len(NOTIFICATION_TABS_TITLE)): top_menu.choose_tab_notification(i) title = top_menu.get_tab_content_title() titles.append(title) self.assertTrue(set(NOTIFICATION_TABS_TITLE).issubset(titles))
def open_user_wall(self): main_page = MainPage(self.driver) center_menu = main_page.center_menu center_menu.select_wall()