@apollo
Feature: Deep Linking of multiple sources

  @id_034f45b46149ad63c74abb0598bcbf362e94cf4b184e6321eac7ddae32a0ba89
  Scenario: [AP-4668] Deep Linking functionality for the multi-selection option of ‘SOURCES’ drop list
    Given Sony user logged in to Apollo portal
    And spotify track40 page is opened with market us
    And Track page is loaded

    When page is reloaded
    And Spotify dsp in Track performance is selected
    Then track page link has track=track40 and market=us at the end
    And Track Performance current source is All Sources

    # step 2
    When Track Performance Source is changed to:
      | Collection |
    And page is reloaded
    Then page url has parameters:
      | market        | 4          |
      | str_gr_source | collection |

    # step 3
    When Track Performance Source is changed to:
      | Collection |
      | Album Page |
      | Chart      |
      | Radio      |
      | Search     |
    And page is reloaded
    Then page url has parameters:
      | market        | 4                                   |
      | str_gr_source | collection,album,chart,radio,search |

    # step 4
    When Track Performance tab selected to By Markets
    And page is reloaded
    Then page url has parameters:
      | market        | 4                                   |
      | str_gr_tab    | 2                                   |
      | str_gr_source | collection,album,chart,radio,search |

    # step 5
    When Track Performance Source is changed to:
      | All Sources |
    And page is reloaded
    Then page url has parameters:
      | market     | 4 |
      | str_gr_tab | 2 |
    And page url has NO parameters:
      | str_gr_source |

    # step 6
    When All Streams dsp in Track performance is selected
    And page is reloaded
    Then page url has parameters:
      | market      | 4 |
      | str_gr_tab  | 2 |
      | str_gr_dsp  | 4 |
      | str_gr_view | 1 |

    # step 7
    When Apple Music dsp in Track performance is selected
    And page is reloaded
    Then page url has parameters:
      | market      | 4 |
      | str_gr_tab  | 2 |
      | str_gr_dsp  | 2 |
      | str_gr_view | 2 |

    # step 8
    When Track Performance Source is changed to:
      | Discovery |
      | Library   |
    And page is reloaded
    Then page url has parameters:
      | market        | 4                 |
      | str_gr_tab    | 2                 |
      | str_gr_dsp    | 2                 |
      | str_gr_view   | 2                 |
      | str_gr_source | discovery,library |

    # step 9
    When Track Performance tab selected to Streams and Sources
    And page is reloaded
    Then page url has parameters:
      | market        | 4                 |
      | str_gr_tab    | 1                 |
      | str_gr_dsp    | 2                 |
      | str_gr_source | discovery,library |
    And Track Performance current source is 2 Sources

    # step 10
    When Track Performance Source is changed to:
      | Search |
    And page is reloaded
    Then page url has parameters:
      | market        | 4      |
      | str_gr_tab    | 1      |
      | str_gr_dsp    | 2      |
      | str_gr_source | search |

    When Amazon dsp in Track performance is selected
    And page is reloaded
    Then page url has parameters:
      | market      | 4 |
      | str_gr_tab  | 1 |
      | str_gr_dsp  | 3 |
      | str_gr_view | 2 |
    And Track Performance current source is All Sources

    When Track Performance Source is changed to:
      | Station |
    And page is reloaded
    Then page url has parameters:
      | str_gr_source | station |

    When Track Performance Source is changed to:
      | All Sources |
    And page is reloaded
    Then page url has NO parameters:
      | str_gr_source |

    When Track Performance Source is changed to:
      | Station   |
      | Playlists |
      | Search    |
    And page is reloaded
    Then page url has parameters:
      | str_gr_source | playlists,search,station |

    When page got back
    And page is reloaded
    Then Track Performance current source is All Sources

    When page got back
    And page is reloaded
    Then Track Performance current source is Station

    When page got back
    And page is reloaded
    Then Track Performance current source is All Sources

    When page got back
    And page is reloaded
    Then Track Performance current source is Search

    When page got forward
    And page is reloaded
    Then Track Performance current source is All Sources

    When page got forward
    And page is reloaded
    Then Track Performance current source is Station

    When page got forward
    And page is reloaded
    Then Track Performance current source is All Sources

    When page got forward
    And page is reloaded
    Then Track Performance current source is 3 Sources
    And page url has parameters:
      | str_gr_source | playlists,search,station |

    # step 15
    When Spotify dsp in Track performance is selected
    And Track Performance Source is changed to:
      | Artist Page     |
      | Album Page      |
      | Chart           |
      | Collection      |
      | Daily Mix       |
      | Discover Weekly |
      | Other           |
      | Play Queue      |
      | Playlists       |
      | Radio           |
      | Release Radar   |
    And Track Performance Owner market is changed to:
      | United States |
      | Australia     |
    And Track Performance Graph View selected to Area Graph, %
    And Track Performance period selected to previous month
    And Track Details Owner Category is changed to:
      | Tastemaker |
    And Track Details Owner market is changed to:
      | Sweden |
    And Track Details scope is switched to Worldwide Streams
    And Track Details filtered by Tiktok
    And page is reloaded
    Then page url has parameters:
      | str_gr_dsp          | 1                                                                                                       |
      | str_gr_view         | 3                                                                                                       |
      | str_gr_start_date   |                                                                                                         |
      | str_gr_end_date     |                                                                                                         |
      | tr_det_owner_ctg    | 7                                                                                                       |
      | tr_det_owner_market | se                                                                                                      |
      | tr_det_market_str   | 1                                                                                                       |
      | tr_det_filter       | Tiktok                                                                                                  |
      | str_gr_source       | album,artist,chart,collection,dailyMix,discoverWeekly,other,playQueue,othersPlaylist,radio,releaseRadar |
      | str_gr_country      | us,au                                                                                                   |

    # step 16
    When page is reloaded
    Then Track Performance current source is 11 Sources
    And Track Performance Graph View is Area Graph, %
    Then Track Performance period on page equals to url
    Then Track Details Owner Category is equal to Tastemaker
    And Track Details streams scope is equal to Worldwide Streams
    And Track Details filter is Tiktok
    And Track Details Owner market is equal to Sweden
    And Track Performance Graph market is equal to 2 Markets

    # step 17
    When Apple Music dsp in Track performance is selected
    And Track Performance Source is changed to:
      | External    |
      | Now Playing |
      | Voice       |
    And page is reloaded
    Then page url has parameters:
      | str_gr_dsp    | 2                         |
      | str_gr_source | external,nowPlaying,voice |
    And Track Performance current source is 3 Sources
