import allure import pytest from assertpy import assert_that # from src.helpers.test_data_loader import DataLoader @pytest.mark.usefixtures("one_time_set_up") class TestSettings: # artist_name = DataLoader.get_artist() @allure.title("Settings - What's New") @allure.description("User should be able to see Release Notes Settings page") @allure.testcase("https://data-analytics.atlassian.net/browse/AMA-1901") @pytest.mark.smoke def test_settings_release_notes(self): self.login_page.login_as_super_user() self.welcome_page.click_skip_btn() self.artist_selector_page.select_an_artist_by_position(1) self.navigation_page.click_settings_tab() assert_that(self.settings_page.is_settings_page_opened(), "Settings page should be opened").is_true() self.settings_page.check_app_version() self.settings_page.bn_whats_new.click() assert_that(self.settings_page.are_release_notes_opened(), "Release Notes are not shown").is_true() @allure.title("Settings - Send feedback") @allure.description("User should be able to send feedback from Settings page") @allure.testcase("https://data-analytics.atlassian.net/browse/AMA-1903") @pytest.mark.regression def test_settings_feedback(self): self.login_page.login_as_super_user() self.welcome_page.click_skip_btn() self.artist_selector_page.select_an_artist_by_position(1) self.navigation_page.click_settings_tab() assert_that(self.settings_page.is_settings_page_opened(), "Settings page should be opened").is_true() self.settings_page.bn_send_feedback.click() assert_that(self.settings_page.is_feedback_form_opened(), "Feedback form should be present").is_true() self.settings_page.in_feedback_form.click() self.settings_page.in_feedback_form.send_text("Feedback Form automation testing") self.settings_page.bn_feedback_submit.click() assert_that(self.settings_page.is_feedback_sent(), "Feedback thanks should be present").is_true() self.settings_page.bn_feedback_dismiss.click() assert_that(self.settings_page.is_settings_page_opened(), "Settings page should be opened").is_true() @allure.title("RTI - Send feedback") @allure.description("User should be able to send feedback from any page") @allure.testcase("https://data-analytics.atlassian.net/browse/AMA-2053") @pytest.mark.regression def test_feedback_from_anywhere(self): self.login_page.login_as_super_user() self.welcome_page.click_skip_btn() self.artist_selector_page.select_an_artist_by_position(1) self.navigation_page.open_dots_menu() self.settings_page.click_feedback_from_menu() assert_that(self.settings_page.is_feedback_form_opened(), "Feedback form should be present").is_true() self.settings_page.in_feedback_form.click() self.settings_page.in_feedback_form.send_text("Feedback Form automation testing") self.settings_page.bn_feedback_submit.click() assert_that(self.settings_page.is_feedback_sent(), "Feedback thanks should be present").is_true() self.navigation_page.click_dismiss() @allure.title("RTI - Share") @allure.description("User should be able to share stats of the track and proceed via deeplink") @allure.testcase("https://data-analytics.atlassian.net/browse/AMA-2259") @pytest.mark.skip(reason="does not work in BrowserStack") def test_share_and_deep_link(self): self.login_page.login_as_super_user() self.welcome_page.click_skip_btn() self.artist_selector_page.select_an_artist_by_position(1) self.library_page.view_all_tracks() # self.tracks_page.select_track_by_position(1) # self.track_view_page.charts_list.select_by_text('ALL Streams') # self.navigation_page.dots_menu_from_track.click() # self.settings_page.click_share_from_menu() # assert_that(self.settings_page.is_activity_form_opened(), "Feedback form should be present").is_true() # # # self.settings_page.bn_copy.click() # clipboard = self.driver.get_clipboard_text() # print(f'clipboard = {clipboard}') # deeplink = self.settings_page.get_link_from_clipboard(clipboard) # if deeplink == '': # deeplink = 'insights://artists/GRAS_1133733/tracks/USSM11912588/streams-graph?time_interval=last28days&market=worldwide&dsp=all' deeplink = 'insights://artists/GRAS_1133733/tracks/USSM11912588/streams-graph?time_interval=last28days&market=worldwide&dsp=all' print(f'deeplink = {deeplink}') # # Click somewhere # size = self.driver.get_window_size() # self.driver.tap(positions=[(size["width"] / 2, size["height"] - 520)]) # self.driver.tap(positions=[(size["width"] / 2, size["height"] - 520)]) # # self.navigation_page.click_back() # self.navigation_page.click_back() # self.navigation_page.click_back() self.driver.get(deeplink) assert_that(self.common_page.is_label_present("ALL ")).is_true() assert_that(self.common_page.is_label_present("Streams Worldwide")).is_true()