Feature: React Engagement

  @frontend_engagement
  Scenario: Engagement top playlist placements add up
    Given I am on the ReactWorkstation::ReactEngagementPage
    When I search the engagement page for the Home track
    And I get the number of placements after adding the first track in Engagement page
    And I search the engagement page for the Salt Shaker track
    And I get the number of placements after adding the second track in Engagement page
    And I remove a track search from the Engagement page
    Then The playlist placements totals should have subtracted correctly in Engagement page

  @frontend_engagement
  Scenario: Engagement filter placements tracks
    Given I am on the ReactWorkstation::ReactEngagementPage
    When I search the engagement page for the Salt Shaker track
    And I set the dates from 2019-08-01 to 2019-10-01 in Engagement page
    Then I should see Salt Shaker in the search field in Engagement page
    And in Engagement page the filtered placements table contains data
    And in Engagement page the placement tiles should contain the track Salt Shaker
    And in Engagement page the placement tiles should contain background images
    And in Engagement page the placement tiles should contain followers

  Scenario: Engagement filter placements artists
    Given I am on the ReactWorkstation::ReactEngagementPage
    When  I search the engagement page for the Lil Jon artist
    And  I search the engagement page for the Ying Yang Twins, Pitbull artist
    And I set the dates from 2019-08-01 to 2019-10-01 in Engagement page
    Then I should see Lil Jon in the search field in Engagement page
    Then I should see Ying Yang Twins, Pitbull in the search field in Engagement page
    And in Engagement page the filtered placements table contains data
    And in Engagement page the placement tiles should contain the artist Lil Jon
    And in Engagement page the placement tiles should contain background images
    And in Engagement page the placement tiles should contain followers

  @frontend_engagement
  Scenario: Engagement switching between artist and track filter clears search
    Given I am on the ReactWorkstation::ReactEngagementPage
    When I search the engagement page for the USTV10200105 track
    And  I search the engagement page for the In Da Club track
    Then in Engagement page the placement tiles should contain the track Get Low
    When  I search the engagement page for the Lil Jon And The East Side Boyz artist
    And  I search the engagement page for the Ying Yang Twins, Pitbull artist
    And in Engagement page I set the date filter to last week
    Then in Engagement page I should not see either Get Low or In Da Club in the search field

  @frontend_engagement
  Scenario: Engagement data loads with date filters
    Given I am on the ReactWorkstation::ReactEngagementPage
    When in Engagement page I set the date filter to last year
    Then the engagement table should be populated
    When in Engagement page I set the date filter to last month
    Then the engagement table should be populated
    When in Engagement page I set the date filter to last week
    Then the engagement table should be populated

  @frontend_engagement
  Scenario: Engagement Custom date range
    Given I am on the ReactWorkstation::ReactEngagementPage
    When I set the dates from 2019-08-01 to 2019-10-01 in Engagement page
    Then the engagement table should be populated
    When I search the engagement page for the USTV10400126 track
    Then in Engagement page the placement tiles should contain the track Culo
    # When I select the artist of a filtered placements tile in Engagement page
    # And I select a random playlist placements marker in Engagement page
    # Then in Engagement page the placements table should contain the correct amount of placements
    # When I remove a track search from the Engagement page
    # When I search the engagement page for the Sevendust artist
    # Then in Engagement page the placement tiles should contain the artist Sevendust
    # When I set the dates from 2018-10-10 to 2018-10-24 in Engagement page
    # When I select the artist of a filtered placements tile in Engagement page
    # And I select a random playlist placements marker in Engagement page
    # Then in Engagement page the placements table should contain the correct amount of placements

  @frontend_engagement
  Scenario: Engagement Streaming summary numbers decrease when date range is decreased
    And I am on the ReactWorkstation::ReactEngagementPage
    When in Engagement page I get the streams count
    And in Engagement page I get the saves count
    And in Engagement page I get the listeners collection count
    And in Engagement page I get the active discovery count
    And in Engagement page I get the passive discovery count
    And in Engagement page I set the date filter to last week
    Then in Engagement page streams decreases
    And in Engagement page saves decreases
    And in Engagement page listeners collection decreases
    And in Engagement page active discovery decreases
    And in Engagement page passive discovery decreases

  @frontend_engagement
  Scenario Outline: Search for multiple tracks and artists
    Given a standalone Workstation <user> user
    Given I am on the ReactWorkstation::ReactEngagementPage
    When I search the engagement page for the <track_1> track
    And I search the engagement page for the <track_2> track
    Then I should see <track_1> in the search field in Engagement page
    Then I should see  <track_2> in the search field in Engagement page
    When I search the engagement page for the <artist_1> artist
    And I search the engagement page for the <artist_2> artist
    Then I should see <artist_1> in the search field in Engagement page
    Then I should see <artist_2> in the search field in Engagement page

    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   |
