Feature: React Audience

  @frontend_audience
  # DATA-4951
  Scenario: React Audience page load
    Given I am on the ReactWorkstation::ReactAudiencePage
    Then in the new Audience page I see all the components in place

  @frontend_audience
  Scenario: Use React Audience page time filters
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I get the listeners data
    When in the new Audience page I select the year time filter
    Then listeners in the new audience page are increased
    When in the new Audience page I select the month time filter
    Then listeners in the new audience page are the same
    When in the new Audience page I select the week time filter
    Then listeners in the new audience page are decreased

  @frontend_audience
  # DATA-4973
  # DATA-4932
  Scenario: Use React Audience page country filter
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I get the listeners data
    When I filter the new audience page for the Brazil country
    Then listeners in the new audience page are decreased
    When in the new Audience page I click on worldwide link on breadcrumb
    And I refresh the page
    And in the new Audience page I click on Brazil on the map
    Then in the new Audience page I should see a country level map of Brazil
    When in the new Audience page I click on worldwide link on breadcrumb
    Then in the new Audience page I should see a worldwide level map
    # When I get the listeners data from the audience page
    # And I select Brazil from top countries table
    # Then I should see a country level map of Brazil
    # Then listeners in audience page are decreased

  @frontend_audience
  # DATA-4972
  Scenario: Use React Audience page region filter
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I get the listeners data
    When I filter the new audience page for the BR - São Paulo region
    Then listeners in the new audience page are decreased

  @frontend_audience
  # DATA-4948
  Scenario: Use React Audience page artist filter
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I get the listeners data
    When I search the new audience page for the Sevendust artist
    Then I should see Sevendust in the new audience page search field
    And listeners in the new audience page are decreased
    When I toggle the new audience page search for track
    Then listeners in the new audience page are the same

  @frontend_audience
  # DATA-4939
  Scenario: Use React Audience page track filter
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I get the listeners data
    When I search the new audience page for the Get Low track
    Then I should see Get Low in the new audience page search field
    And listeners in the new audience page are decreased

  @frontend_audience
  # DATA-4948
  Scenario: Use React Audience page multiple artist filter
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I select the year time filter
    When I search the new audience page for the Ying Yang Twins artist
    And in the new Audience page I get the listeners data
    And I search the new audience page for the Sevendust artist
    Then listeners in the new audience page are increased

  @frontend_audience
  # DATA-4939
  Scenario: Use React Audience page multiple track filter
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I select the year time filter
    When I search the new audience page for the Get Low track
    And in the new Audience page I get the listeners data
    And I search the new audience page for the Salt Shaker track
    Then listeners in the new audience page are increased

  @frontend_audience
  # DATA-4948
  Scenario: Use React Audience page artist filter - clear artist from search bar
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I select the year time filter
    When I search the new audience page for the Sevendust artist
    And in the new Audience page I get the listeners data
    And I remove a search term from the new Audience page
    Then I should not see Sevendust in the new audience page search field
    And listeners in the new audience page are increased

  @frontend_audience
  # DATA-4939
  Scenario: Use React Audience page track filter - clear track from search bar
    Given I am on the ReactWorkstation::ReactAudiencePage
    And in the new Audience page I select the year time filter
    When I search the new audience page for the Get Low track
    When in the new Audience page I get the listeners data
    And I remove a search term from the new Audience page
    Then I should not see Get Low in the new audience page search field
    And listeners in the new audience page are increased

  @frontend_audience
  Scenario: Engagement demographic insights one year filter
    Given I am on the ReactWorkstation::ReactAudiencePage
    When in the new Audience page I select the week time filter
    Then in the new Audience page I should see gender donut chart
    And in the new Audience page I should see an age bar chart
    And in the new Audience page I should see the top audiences table
    Then in the new Audience page I select the month time filter
    Then in the new Audience page I should see gender donut chart
    And in the new Audience page I should see an age bar chart
    And in the new Audience page I should see the top audiences table

  @frontend_audience
  Scenario: Use React Audience page store filter
    Given I am on the ReactWorkstation::ReactAudiencePage
    When in the new Audience page I get the listeners data
    And I filter the new audience page for Apple Music
    Then listeners in the new audience page are decreased
    When I filter the new audience page for all stores
    Then listeners in the new audience page are the same
    When I filter the new audience page for Spotify
    Then listeners in the new audience page are decreased

  @frontend_audience
  Scenario Outline: Search for multiple tracks and artists with different users
    Given a standalone Workstation <user> user
    And I am on the ReactWorkstation::ReactAudiencePage
    When I search the new audience page for the <track_1> track
    And I search the new audience page for the <track_2> track
    Then I should see <track_1> in the new audience page search field
    Then I should see  <track_2> in the new audience page search field
    When I search the new audience page for the <artist_1> artist
    And I search the new audience page for the <artist_2> artist
    Then I should see <artist_1> in the new audience page search field
    Then I should see <artist_2> in the new audience page search field

    Examples:
      | user            | track_1       | track_2          | artist_1                | artist_2       |
    # catalog: tvt
      | label_15063     | Salt Shaker   | Get Low          | Pitbull                 | Sevendust      |
    # frontline: frenchkiss
      | label_6971      | Ride          | In Between Stars | Local Natives           | The Drums      |
    # d3: thirty tigers
      | label_21989     | Jealous Sun   | I Am the Moon    | White Buffalo           | Parker Millsap |
    # subaccount: lightning rod records
      | subaccount_7584 | Alabama Pines | Mockingbird      | Quaker City Night Hawks | Paul Cauthen   |

