def setUp(self): default_setup(self) setup_auth(self) self.people_page = PeoplePage(self.driver) self.profile_page = ProfilePage(self.driver) self.people_page.open() self.people_page.subscribe()
def setUp(self): default_setup(self) setup_auth(self) self.profile_page = ProfilePage(self.driver) self.profile_page.create_playlist(self.playlist_name) self.film_page = FilmPage(self.driver) self.film_page.add_film_in_playlist(self.playlist_name)
class UnsubscribeTests(unittest.TestCase): expected_friend = 'vileven' def setUp(self): default_setup(self) setup_auth(self) self.people_page = PeoplePage(self.driver) self.profile_page = ProfilePage(self.driver) self.people_page.open() self.people_page.subscribe() def tearDown(self): self.driver.quit() def test_unsubscribe_from_profile(self): self.profile_page.open_subscribers() self.profile_page.unsubscribe_from_profile() friend_list = self.profile_page.get_subscribe_list() self.assertNotIn(self.expected_friend, friend_list) def test_unsubscribe(self): self.people_page.open() self.people_page.unsubscribe() self.profile_page.open_subscribers() friend_list = self.profile_page.get_subscribe_list() self.assertNotIn(self.expected_friend, friend_list)
class DeleteFilmFromPlaylistTests(unittest.TestCase): playlist_name = "playlist" expected_notification_delete_playlist = "Фильм удален" def setUp(self): default_setup(self) setup_auth(self) self.profile_page = ProfilePage(self.driver) self.profile_page.create_playlist(self.playlist_name) self.film_page = FilmPage(self.driver) self.film_page.add_film_in_playlist(self.playlist_name) self.profile_page.open() def tearDown(self): self.profile_page.delete_last_playlist() self.driver.quit() def test_delete_playlist_notification(self): self.profile_page.delete_film_from_playlist() notification_text = self.profile_page.get_notification_text() self.assertEqual(notification_text, self.expected_notification_delete_playlist)
class UsernameChangeSuccessTests(unittest.TestCase): new_login = "******" def setUp(self): default_setup(self) setup_auth(self) self.setting_page = SettingPage(self.driver) self.profile_page = ProfilePage(self.driver) self.setting_page.open() def tearDown(self): self.setting_page.open() self.setting_page.change_username(self.LOGIN) self.driver.quit() def test_change_password(self): self.setting_page.change_username(self.new_login) self.setting_page.submit() current_login = self.profile_page.get_username() self.assertEqual(current_login, self.new_login)
def test_open_profile_from_main_page(self, clients_page, browser): ProfilePage(browser).show_profile()
class PlaylistCreateSuccessTests(unittest.TestCase): playlist_name = "playlist" expected_notification_success = "Плэйлист успешно создан!" def setUp(self): default_setup(self) setup_auth(self) self.profile_page = ProfilePage(self.driver) self.profile_page.open_playlist() def tearDown(self): self.profile_page.delete_last_playlist() self.driver.quit() def test_create_playlist_notification(self): self.profile_page.set_playlist(self.playlist_name) self.profile_page.submit_playlist() notification_text = self.profile_page.get_notification_text() self.assertEqual(notification_text, self.expected_notification_success) def test_create_playlist_name(self): self.profile_page.set_playlist(self.playlist_name) self.profile_page.submit_playlist() self.profile_page.get_notification_text() name = self.profile_page.get_last_playlist_name() self.assertEqual(name, self.playlist_name) def test_create_playlist_count(self): count_playlists_before_adding = self.profile_page.get_count_playlist() self.profile_page.set_playlist(self.playlist_name) self.profile_page.submit_playlist() self.profile_page.get_notification_text() count_playlists_after_adding = self.profile_page.get_count_playlist() self.assertLess(count_playlists_before_adding, count_playlists_after_adding)
def setUp(self): default_setup(self) setup_auth(self) self.people_page = PeoplePage(self.driver) self.profile_page = ProfilePage(self.driver)
class PlaylistCreateWrongTests(unittest.TestCase): empty_playlist_name = "" expected_notification_empty_name = "Пустое название!" def setUp(self): default_setup(self) setup_auth(self) self.profile_page = ProfilePage(self.driver) self.profile_page.open_playlist() def tearDown(self): self.driver.quit() def test_create_playlist_notification(self): self.profile_page.set_playlist(self.empty_playlist_name) self.profile_page.submit_playlist() notification_text = self.profile_page.get_notification_text() self.assertEqual(notification_text, self.expected_notification_empty_name) def test_create_playlist_count(self): count_playlists_before_adding = self.profile_page.get_count_playlist() self.profile_page.set_playlist(self.empty_playlist_name) self.profile_page.submit_playlist() self.profile_page.get_notification_text() count_playlists_after_adding = self.profile_page.get_count_playlist() self.assertEqual(count_playlists_before_adding, count_playlists_after_adding)
def get_profile_login(t): profile_page = ProfilePage(t.driver) profile_page.open() return profile_page.get_username()
def test_profile_page(self, login_fb): profile_page = ProfilePage(login_fb) profile_page.click_on_profile_button() profile_page.open_more_combobox() profile_page.select_sports_option() profile_page.is_displayed_sports_title()
def setUp(self): default_setup(self) setup_auth(self) self.profile_page = ProfilePage(self.driver) self.profile_page.open_playlist()
class AddFilmInPlaylistWrongTests(unittest.TestCase): playlist_name = "playlist" expected_notification_exist = "Вы уже добавили этот фильм в плэйлист" def setUp(self): default_setup(self) setup_auth(self) self.profile_page = ProfilePage(self.driver) self.profile_page.create_playlist(self.playlist_name) self.film_page = FilmPage(self.driver) self.film_page.add_film_in_playlist(self.playlist_name) def tearDown(self): self.profile_page.open_playlist() self.profile_page.delete_last_playlist() self.driver.quit() def test_add_film_in_playlist_notification(self): self.film_page.select_playlist(self.playlist_name) self.film_page.submit_to_add_in_playlist() notification = self.film_page.get_notification_text() self.assertEqual(notification, self.expected_notification_exist) def test_add_film_in_playlist_count(self): self.profile_page.open() count_film_before = self.profile_page.get_count_film_in_playlist() self.film_page.open() self.film_page.add_film_in_playlist(self.playlist_name) self.profile_page.open() count_film_after = self.profile_page.get_count_film_in_playlist() self.assertEqual(count_film_before, count_film_after)
def profile_page(clients_page, browser): page = ProfilePage(browser) page.show_profile() return page
def setUp(self): default_setup(self) setup_auth(self) self.setting_page = SettingPage(self.driver) self.profile_page = ProfilePage(self.driver) self.setting_page.open()
class PlaylistDeleteTests(unittest.TestCase): playlist_name = "playlist" expected_notification_delete_playlist = "Плейлист удалён" def setUp(self): default_setup(self) setup_auth(self) self.profile_page = ProfilePage(self.driver) self.profile_page.create_playlist(self.playlist_name) def tearDown(self): self.driver.quit() def test_delete_playlist_notification(self): self.profile_page.delete_last_playlist() notification_text = self.profile_page.get_notification_text() self.assertEqual(notification_text, self.expected_notification_delete_playlist) def test_delete_playlist_count(self): count_playlists_before_delete = self.profile_page.get_count_playlist() self.profile_page.delete_last_playlist() self.profile_page.get_notification_text() count_playlists_after_delete = self.profile_page.get_count_playlist() self.assertGreater(count_playlists_before_delete, count_playlists_after_delete)
def test_profile_page(self): profile_page = ProfilePage(self.driver) profile_page.click_on_profile_button()
def delete_user(t): profile_page = ProfilePage(t.driver) profile_page.open() profile_page.delete_user()
def click_on_profile_button(self): profile_button = self.driver.find_element(*self.PROFILE_BUTTON).click() return ProfilePage(self.driver)