@android
Feature: Android My Catalog

  Background:
      Given a valid test user
      Given I login to the android app

  Scenario: Verify Songs Tab
    When I can see the catalog screen
      Then Songs cards should display correct and complete information
      And The sorting option displayed should be 'STREAMS • 1 DAYS'
      And All songs sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of '28' days
      Then The sorting option displayed should be 'STREAMS • 28 DAYS'
      And All songs sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of '7' days
      Then The sorting option displayed should be 'STREAMS • 7 DAYS'
      And All songs sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of 'All' time
      Then The sorting option displayed should be 'STREAMS • ALL TIME'
      # TODO: Re-enable once bug GO-4136 is fixed
      # And All songs sorted by the number of streams in descending order
    When I change the sorting option to 'Release Date'
      Then The sorting option displayed should be 'RELEASE DATE'
      And All songs sorted by the release date

    When I filter songs with the following criteria
      | Action            | Values             |
      | Artists           | Somebody's Child  |
    When I filter songs with the following criteria
      | Action            | Values             |
      | Labels            | Test Label         |
    Then I should see the "No songs" error message

    When I reset all filters
      Then The total number of displayed songs should exceed 3
      And Songs cards should display correct and complete information

    When I change the sorting option to 'Streams' for a period of '1' day
      Then The sorting option displayed should be 'STREAMS • 1 DAYS'
      And All songs sorted by the number of streams in descending order

    When I filter playlists with the following criteria
      | Action            | Values             |
      | Artists           | Somebody's Child   |
    When I filter playlists with the following criteria
      | Action            | Values             |
      | Labels            | Frenchkiss Records |
    When I filter playlists with the following criteria
      | Action            | Values             |
      | Countries         | Argentina          |
      Then I should see songs with Somebody's Child as the only artist

    When I reset all applied filters using the filters panel
      Then The total number of displayed songs should exceed 3
      And Songs cards should display correct and complete information

  Scenario: Verify Products Tab
    When I navigate to the products tab
      Then Products cards should display correct and complete information
      And The sorting option displayed should be 'STREAMS • 1 DAYS'
      And All products sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of '28' days
      Then The sorting option displayed should be 'STREAMS • 28 DAYS'
      And All products sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of '7' days
      Then The sorting option displayed should be 'STREAMS • 7 DAYS'
      And All products sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of 'All' time
      Then The sorting option displayed should be 'STREAMS • ALL TIME'
      And All products sorted by the number of streams in descending order
    When I change the sorting option to 'Release Date'
      Then The sorting option displayed should be 'RELEASE DATE'
      And Products sorted by the release date

    When I filter products with the following criteria
      | Action            | Values             |
      | Artists           | ISLAND             |
    When I filter products with the following criteria
      | Action            | Values             |
      | Labels            | Test Label         |
    Then I should see the "No products" error message

    When I reset all filters
      Then The total number of displayed products should exceed 3
      And Products cards should display correct and complete information

    When I change the sorting option to 'Streams' for a period of '1' day
      Then The sorting option displayed should be 'STREAMS • 1 DAYS'

    When I filter playlists with the following criteria
      | Action            | Values             |
      | Artists           | Future Generations |
    When I filter playlists with the following criteria
      | Action            | Values             |
      | Labels            | Frenchkiss Records |
    When I filter playlists with the following criteria
      | Action            | Values             |
      | Countries         | Canada             |
      Then I can see product Landscape with id 2320107 in my search results
      And Tapping product Landscape with id 2320107 takes me to the product page
      And I navigate back from the product screen

    When I reset all applied filters using the filters panel
      Then The total number of displayed products should exceed 3
      And Products cards should display correct and complete information

  Scenario: Verify Artists Tab
    When I navigate to the artists tab
      Then Artists cards should display correct and complete information
      And The sorting option displayed should be 'STREAMS • 1 DAYS'
      And All artists sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of '28' days
      Then The sorting option displayed should be 'STREAMS • 28 DAYS'
      And All artists sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of '7' days
      Then The sorting option displayed should be 'STREAMS • 7 DAYS'
      And All artists sorted by the number of streams in descending order
    When I change the sorting option to 'Streams' for a period of 'All' time
      Then The sorting option displayed should be 'STREAMS • ALL TIME'
      And All artists sorted by the number of streams in descending order

    When I filter artists with the following criteria
      | Action            | Values             |
      | Artists           | ISLAND             |
    When I filter artists with the following criteria
      | Action            | Values             |
      | Labels            | Test Label         |
      Then No artists should be displayed

    When I reset all filters
      Then The total number of displayed artists should exceed 3
      And Artists cards should display correct and complete information

    When I filter playlists with the following criteria
      | Action            | Values             |
      | Artists           | ISLAND             |
    When I filter playlists with the following criteria
      | Action            | Values             |
      | Labels            | Frenchkiss Records |
    When I filter playlists with the following criteria
      | Action            | Values             |
      | Countries         | France             |
      Then I can see artist ISLAND with id 1816ed91-cd0b-4600-86d0-001b1245c0db in my search results
      And Tapping artist ISLAND with id 1816ed91-cd0b-4600-86d0-001b1245c0db takes me to the artist page
      And I should be navigated to the artist page for ISLAND
      And I navigate back from the artist screen

    When I reset all applied filters using the filters panel
      Then The total number of displayed artists should exceed 3

  @skip_if_sme
  Scenario: Verify Playlists Tab
    When I navigate to the playlists tab
      Then Playlist cards should display correct and complete information
      And All playlists are displayed sorted by the '1D STREAMS' 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 change the playlists sorting option to '7d Streams'
      Then All playlists are displayed sorted by the '7D STREAMS' filter
    When I change the playlists sorting option to 'Followers'
      Then All playlists are displayed sorted by the 'Followers' filter

    When I filter playlists with the following criteria
      | Action            | Values             |
      | Deselecting store | Spotify            |
      | Selecting types   | Editorial          |
      | Markets           | Australia          |
    When I filter playlists with the following criteria
      | Action            | Values             |
      | Labels            | Frenchkiss Records |
    When I filter playlists with the following criteria
      | Action            | Values             |
      | Artists           | Les Savy Fav       |
      Then Playlist cards should display correct and complete information
      And Playlist cards should display the following attributes
      | Property      | Value        |
      | Playlist Type | EDITORIAL    |
      # TODO: Temporarily disabled due to lowercase country code shown
#      | Country Label | AU           |
      | Store Icon    | Apple        |
      | Artist        | Les Savy Fav |
    When I filter playlists with the following criteria
      | Action            | Values      |
      | Selecting store   | Deezer      |
      | Deselecting store | Apple Music |
      | Selecting types   | Curated     |
      | Deselecting types | Editorial   |
      | Markets           | Brazil      |
      Then No playlists should be displayed
    When I reset the playlist filters
      Then The total number of displayed playlists should exceed 1
    When I tap the bottom part of playlist card number 1
      Then The track page for the selected track should be displayed
      And I should be able to navigate back
