@android
Feature: Android Song Screen

    Scenario: User can login
        Given a valid test user
        When I login to the android app
        Then I can see the catalog screen

    Scenario: Header
        Given I am on the search tab
        When I search for "USJMZ0900024"
            Then I can see song Kettering with id USJMZ0900024 in my search results
        When Tapping song Kettering with id USJMZ0900024 takes me to the song page
            Then All expected elements in the song header for artist The Antlers should be present
            And The song header should display correct information for Kettering
            And The general info section should display correct and valid information for the track
        When I tap on artist The Antlers button
            Then I should be navigated to the artist page for The Antlers
            And I navigate back from the artist screen

    Scenario: Streaming Trend
        Given The active screen is the song screen
        When I inspect the Streaming Trend section
            Then All essential elements of the Streaming Trend section should be visible

        # By Stores
        When I inspect the POT section
            Then The POT list should display 6 stores by default
            And The "Show All Items" button should be visible
        When I tap the "Show All Items" button in the POT section
            Then The POT list should display top 10 stores
        When I select a random store from the POT list that has data
            Then The POT graph should be updated to display data only for the selected store
            #TODO: Re-enable once bug IN-16426 is fixed
#            And The last day value from the POT graph should match the "1D" value in the POT table
        When I inspect the POT stores list
        And I select a random store from the POT list that has no data
            Then I should see a message indicating that streaming data may be delayed

        # By Countries
        When I switch the POT view to "By Countries"
            Then The POT list should display top 10 countries
            And The "Show Less Items" button should be visible
        When I tap the "Show Less Items" button in the POT section
            Then The POT list should display top 6 countries
        When I select a random country from the POT list
            Then The POT graph should be updated to display data only for the selected country
            #TODO: Re-enable once bug IN-16426 is fixed
#            And The last day value from the POT graph should match the "1D" value in the POT table

        # By Sources
        When I switch the POT view to "By Sources"
        And I select the "Total Streams" row from the POT list
            # TODO: Re-enable once bug IN-16426 is fixed
#            Then The last day value from the POT graph should match the "1D" value in the POT table

        # Table totals
        When I inspect the POT table period switcher
            Then The "Recent" period should be selected by default
            # TODO: Re-enable once bug GO-4265 is fixed
#            And The POT recent total value should be the same for all POT tabs

#        When I set the POT table period to "All Time"
#            Then The POT all time total value should be the same for all POT tabs

        When I tap the store status button
            Then The Store Status screen should be displayed with all essential elements

    Scenario Outline: Streaming Trend#DSoS
        Given The active screen is the song screen
        When I filter DSoS by store "<store>"

        When I switch the DSoS view to "By Stores"
        #TODO: Re-enable once bug IN-16426 is fixed
#            Then The last day value from the DSoS "By Stores" graph should match the "1D" value in the DSoS table
#        When I switch the DSoS view to "By Countries"
#            Then The last day value from the DSoS "By Countries" graph should match the "1D" value in the DSoS table
#        When I switch the DSoS view to "By Sources"
#            Then The last day value from the DSoS "By Sources" graph should match the "1D" value in the DSoS table

        When I inspect the POT table period switcher
        When I set the POT table period to "All Time"
            Then The POT all time total value should be the same for all POT tabs
        When I set the POT table period to "Recent"
            # TODO: Re-enable once bug GO-4265 is fixed
#            Then The POT recent total value should be the same for all POT tabs

        Examples:
            | store        |
            | Spotify      |
            | Apple Music  |
            # TODO: Re-enable once bug IN-16460 is fixed
#            | Amazon Music |
#            | YouTube      |
            # TODO: Re-enable once bug IN-16425 is fixed
#            | Random store |

    Scenario: TikTok Creations
        When I inspect the TikTok Creations section
            Then All essential elements of the TikTok Creations section should be visible
            And I should see the "SEE ALL TIKTOK DATA" button below the tiktok section
            # TODO: Simplify verifications due to GO-4313.
            # Accurate comparison is currently not possible because the data
            # in the chart and the table may differ by up to one day.
#            And The total value collected from the TikTok Creations chart on the song screen should match the "7 DAYS" total in the table
#        When I tap the "SEE ALL TIKTOK DATA" button
#            Then The TikTok Data page should be displayed
#            And The total value collected from the TikTok Creations chart on the detailed screen should match the "7 DAYS" total in the table
#            And The total value collected from the TikTok Views chart on the detailed screen should match the "7 DAYS" total in the table
#        When I switch to the UGC/PGC tab
#            Then The UGC/PGC tab should be active, and its graphs should be visible
#        When I toggle the chart to display only UGC data
#            Then The UGC values collected from the TikTok Creations chart on the detailed screen should match the "7 DAYS" total in the table
#        When I toggle the chart to display only PGC data
#            Then The PGC values collected from the TikTok Creations chart on the detailed screen should match the "7 DAYS" total in the table
#        When I navigate to the UGC/PGC Views section by scrolling down
#        And I toggle the chart to display only UGC data
#            Then The UGC values collected from the TikTok Views chart on the detailed screen should match the "7 DAYS" total in the table
#        When I toggle the chart to display only PGC data
#            Then The PGC values collected from the TikTok Views chart on the detailed screen should match the "7 DAYS" total in the table
#        Then I navigate back to the song screen

    Scenario: Top Playlists
        When I inspect the Top Playlists section
        And I tap the information icon next to the Top Playlists title
            Then A popup with information about the Top Playlists section should appear
            And The Top Playlists section should display correct and complete information
            And I should see the "See All" button below the playlists section
            And Playlist cards should display correct and complete information
            And The total number of displayed playlists should be 3
            And All playlists are displayed sorted by the '7D STREAMS' filter
        #TODO: Re-enable once bug GO-4354 is fixed
#        When I select 'Most Recent' in the playlists filter
#            Then All playlists are displayed sorted by the 'Most Recent' filter
        When I select '1d Streams' in the playlists filter
            Then All playlists are displayed sorted by the '1D STREAMS' filter
        When I select 'Followers' in the playlists filter
            Then All playlists are displayed sorted by the 'Followers' filter
        When I tap the 'SEE ALL' button to open all playlists
            Then The total number of displayed playlists should exceed 3
            And Playlist cards should display correct and complete information
            And All playlists are displayed sorted by the 'Followers' filter
         #TODO: Re-enable once bug GO-4354 is fixed
#        When I change the playlists sorting option to 'Most Recent'
#            Then All playlists are displayed sorted by the 'Most Recent' filter
        When I filter playlists with the following criteria
            | Action            | Values                                                 |
            | Deselecting store | Apple Music                                            |
            | Deselecting types | Algorithmic, Editorial, New Music Friday, Personalized |
            | Markets           | United Kingdom                                         |
            Then Playlist cards should display correct and complete information
            And Playlist cards should display the following attributes
                | Property      | Value   |
                | Playlist Type | CURATED |
                | Country Label | GB      |
        When I filter playlists with the following criteria
            | Action            | Values         |
            | Selecting store   | Apple Music    |
            | Deselecting store | Spotify        |
            | Selecting types   | Personalized   |
            | Deselecting types | Curated        |
            | Markets           | Argentina      |
            Then No playlists should be displayed
        When I reset the playlist filters
            Then The total number of displayed playlists should exceed 3
            And I navigate back from the playlists screen

    Scenario: Top Markets
        When I inspect the Top Markets section
            Then The Top Markets section should display correct and complete information
            And Top Markets cards should display correct and complete information
            And The total number of displayed Top Market cards should be 5

    Scenario: Song not from the catalog
        When I navigate to the Chart Digest screen
            Then The Charts screen should be displayed
        # TODO: uncomment when fix will be ready GO-4052
#        When I tap on the 'Daily Top 200' chart card
#            Then I should be navigated to the 'Daily Top 200' chart screen
#            And All expected song attributes should be displayed for each track on non-Top 100 charts
#        When I tap on a song card number 1
#            Then The track page for the selected track should be displayed
#            And A message indicating the track is not from the catalog should be displayed
#        When I inspect the Top Charts section
#            Then The following Top Charts cards for Spotify should display correct and complete information
#                | Spotify         |
#                | Daily Top 200   |
#                | Weekly Top 200  |
#                | Daily Viral 100 |
#        When I tap the information icon next to the Top Charts title
#            Then A popup with information about the Top Charts section should appear
#        When I swipe through the spotify chart cards back to the first one
#        And I tap the first Spotify Top Charts card
#            Then I should be navigated to the Daily Top 200 Spotify Charts page
#            And The sorting option displayed for Top Charts should be MARKET NAME
#            And All Top Charts cards should be sorted by MARKET NAME
#        When I change the charts sorting option to POSITION
#            Then The sorting option displayed for Top Charts should be POSITION
#            And All charts sorted by their POSITION in descending order
#        When I tap the information icon next to the Spotify Charts title
#            Then A popup with information about the Daily Top 200 Spotify Charts should appear
#        When I change Spotify Charts category to Weekly Top 200
#            Then All Top Charts cards should be sorted by MARKET NAME
#        When I tap the information icon next to the Spotify Charts title
#            Then A popup with information about the Weekly Top 200 Spotify Charts should appear
#        When I change Spotify Charts category to Daily Viral 100
#            Then All Top Charts cards should be sorted by MARKET NAME
#        When I tap the information icon next to the Spotify Charts title
#            Then A popup with information about the Daily Viral 100 Spotify Charts should appear
#            And I navigate back to the song screen
#            And I navigate back to the charts placements
#            And I navigate back to the charts screen
        When I tap on the 'Daily Top 100' chart card
            Then I should be navigated to the 'Daily Top 100' chart screen
            And All expected song attributes should be displayed for each track on Top 100 charts
        When I tap on a song card number 2
            Then The track page for the selected track should be displayed
            And A message indicating the track is not from the catalog should be displayed
        When I inspect the Top Charts section
            Then The following Top Charts cards for Apple should display correct and complete information
                | Apple         |
                | Daily Top 100 |
        When I tap the information icon next to the Top Charts title
            Then A popup with information about the Top Charts section should appear
        When I tap the first Apple Top Charts card
            Then I should be navigated to the Daily Top 100 Apple Charts page
            And The sorting option displayed for Top Charts should be MARKET NAME
            And All Top Charts cards should be sorted by MARKET NAME
        When I change the charts sorting option to POSITION
            Then The sorting option displayed for Top Charts should be POSITION
            And All charts sorted by their POSITION in descending order
        When I tap the information icon next to the Apple Charts title
            Then A popup with information about the Daily Top 100 Apple Charts should appear
