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)
Esempio n. 2
0
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)
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)
Esempio n. 4
0
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)