@deprecated
@fansifter
@audience-overview-page
Feature: Audience overview page tests

  @FS-2058
  @cleanup-created-audience
  @ows_dmp
  @id_caf1056401093957a738de41d34c088bbbfcde4bb96d8c921212ac8bd9e49836
  Scenario: Audience overview page audience update
    Given an orchard employee fansifter-set-2-10-libra for fansifter
    And I have the audience data:
      | Account         | Columbia Records Group         |
      | Audience Use    | Advertising                    |
      | Artists         | The Kid LAROI                  |
      | Fan location    | United States                  |
      | Fan segment     | Include, Engaged Fans          |
      | Last engagement | Include, Past Year             |
      | Spend min       | 5                              |
      | Spend max       | 100                            |
      | Fan DSP         | Exclude, Apple Music           |
      | Heavy rotation  | Exclude, NOT in Heavy Rotation |
    And I have authorized local storage for fansifter
    When I visit Audiences page
    And I open New audience page
    And I fill new audience data
    Then the audience being edited is now updated, the correct date and time are displayed
    When I click on the Save button for new audience
    Then new audience is created
    And created audience was updated now, and the correct date and time are displayed
    When I click edit audience button
    And I update audience data
    And I click on the Save button for updated audience
    Then audience is updated
    And created audience was updated now, and the correct date and time are displayed

  Rule: Artist audience

    Background: Log in (user has access to a few labels)
      Given an orchard employee fansifter-set-2-6-gemini for fansifter
      And I have the audience data:
        | Account         | Columbia Records Group         |
        | Audience Use    | Advertising                    |
        | Artists         | The Kid LAROI                  |
        | Fan location    | United States                  |
        | Fan segment     | Include, Engaged Fans          |
        | Last engagement | Include, Past Year             |
        | Spend min       | 5                              |
        | Spend max       | 100                            |
        | Fan DSP         | Exclude, Apple Music           |
        | Heavy rotation  | Exclude, NOT in Heavy Rotation |
      And I have authorized local storage for fansifter
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data

    @FS-2056
    @cleanup-created-audience
    @id_fe1354dd87b7097d433427842a4757ea9ac33c9551e149d534bf886876f63428
    Scenario: Audience overview page data verification
      When I click on the Save button for new audience
      Then new audience is created
      And audience page shows correct audience data
      And audience page does not show elements not in audience data

    @FS-2057
    @cleanup-created-audience
    @id_b6488c5859a04d659e1e7170f763aa8c2ab12afd288fd74ab101e5ffd54a5a22
    Scenario: Audience overview page audience refresh
      When I click on the Save button for new audience
      Then new audience is created
      When I click refresh audience button
      Then audience size is updated
      And created audience was updated now, and the correct date and time are displayed
      When I click refresh audience button
      Then audience size is updated

    @FS-2220
    @cleanup-created-audience
    @id_55cf7bb57c3bc9e2ad8ab963a35d203f0747a6daf322e2833042e9bf501fed7a
    Scenario: Audience overview page design (Artist audience)
      When I click on the Save button for new audience
      And audience overview page header contains audience name and export button
      And audience details block contains Edit button and all entered information
      And audience size block contains size, last updated info and Refresh button

  Rule: Custom list audience

    Background: Log in (user has access to a few labels)
      Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
      And I have the audience data:
        | Account         | Test Label                     |
        | Audience Use    | Advertising                    |
        | Custom List     | Warped Tour                    |
        | Fan location    | United States                  |
        | Fan segment     | Exclude, Lapsed Fans           |
        | Last engagement | Include, Past Year             |
        | Fan DSP         | Exclude, Deezer                |
        | Heavy rotation  | Exclude, NOT in Heavy Rotation |
      And I have authorized local storage for fansifter
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data

    @FS-2220
    @cleanup-created-audience
    @id_17fe00794536ba7883e58322e167feee11f889b4e074e6535bb329828adfe3f3
    Scenario: Audience overview page design (Custom list audience)
      When I click on the Save button for new audience
      And audience overview page header contains audience name and export button
      And audience details block contains Edit button and all entered information
      And audience size block contains size, last updated info and Refresh button

  Rule: Audience with artist and custom list

    Background: Log in (user has access to a few labels)
      Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
      And I have the audience data:
        | Account         | Test Label                     |
        | Audience Use    | Advertising                    |
        | Custom List     | Warped Tour                    |
        | Artists         | Wolfgang Amadeus Mozart        |
        | Fan location    | United States                  |
        | Fan segment     | Include, Engaged Fans          |
        | Last engagement | Include, Past Year             |
        | Fan DSP         | Include, Apple Music           |
        | Heavy rotation  | Exclude, NOT in Heavy Rotation |
      And I have authorized local storage for fansifter
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data

    @cleanup-created-audience
    @FS-4207
    @id_6e56beffdadf8b6328804f4ad7fb52fa58a9d2890b06f11ab1562a689678f2c5
    Scenario: Audience overview page design (Artist and Custom list audience)
      When I click on the Save button for new audience
      And audience overview page header contains audience name and export button
      And audience details block contains Edit button and all entered information
      And audience size block contains size, last updated info and Refresh button

  Rule: Audience with two artists

    Background: Log in (user has access to a few labels)
      Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
      And I have the audience data:
        | Account         | Test Label                             |
        | Audience Use    | Advertising                            |
        | Artists         | Wolfgang Amadeus Mozart, Frank Sinatra |
        | Fan location    | United States                          |
        | Fan segment     | Include, Engaged Fans                  |
        | Last engagement | Include, Past Year                     |
        | Fan DSP         | Exclude, Apple Music                   |
        | Heavy rotation  | Exclude, NOT in Heavy Rotation         |
      And I have authorized local storage for fansifter
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data

    @FS-4206
    @cleanup-created-audience
    @id_5385d7aecf0aa1f1f27c489a07a0e5009e726570cbbd545832056e079743806e
    Scenario: Audience overview page design (Two artists audience)
      When I click on the Save button for new audience
      And audience overview page header contains audience name and export button
      And audience details block contains Edit button and all entered information
      And audience size block contains size, last updated info and Refresh button

  Rule: Audience with city radius filter, Email audience use, email and songwhip filters

    Background: Log in (user has access to a few labels)
      Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
      And I have the audience data:
        | Account                | Test Label                                                       |
        | Audience Use           | Email                                                            |
        | Artist                 | Wolfgang Amadeus Mozart                                          |
        | Fan city               | New York                                                         |
        | Additional city radius | 150 mi                                                           |
        | Email Campaign         | Has NOT Received, DON"T DELETE USED BY AUTOTESTS                 |
        | Songwhip               | Has NOT Presaved, "La bergère Célimène" and other works - Mozart |
      And I have authorized local storage for fansifter
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data

    @FS-4354
    @cleanup-created-audience
    @id_35dd3606bcfcfe6c5838509cd1f43528857f32caaa182fb79521dd67380a3398
    Scenario: Audience overview page design (City radius filter and Email campaign use)
      When I click on the Save button for new audience
      And audience overview page header contains audience name and export button
      And audience details block contains Edit button and all entered information
      And audience size block contains size, last updated info and Refresh button

  Rule: Audience with only city filter and Email campaign use

    Background: Log in (user has access to a few labels)
      Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
      And I have the audience data:
        | Account      | Test Label              |
        | Audience Use | Email                   |
        | Artist       | Wolfgang Amadeus Mozart |
        | Fan city     | New York, Toronto       |
      And I have authorized local storage for fansifter
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data

    @FS-4355
    @cleanup-created-audience
    @id_51db24b6bb42a8b456e41443e52be811ba4487a57183e4ac76e5592629b18833
    Scenario: Audience overview page design (City filter and Email campaign use)
      When I click on the Save button for new audience
      And audience overview page header contains audience name and export button
      And audience details block contains Edit button and all entered information
      And audience size block contains size, last updated info and Refresh button

  Rule: Audience with Form filter - Comprehensive functionality

    Background: Log in and prepare
      Given an orchard employee fansifter-e2e-7123-34514 for fansifter
      And I have authorized local storage for fansifter
      When I visit Audiences page
      And I open New audience page

    @FS-5874
    @cleanup-created-audience
    @id_ef537a87d5ab52a7c28ef8e7587abfd6174ca62bfdfefe3224b70c88a5bf7df5
    Scenario: Form filter comprehensive workflow
      # Prerequisites - Forms require Account + Artist
      Given no Forms are available to select
      When I select "Columbia Records Group" account for new audience
      Then no Forms are available to select

      When I open artist multiselect for new audience
      And I select "Adele" artist in multiselect for new audience and close
      And audience size is recalculated
      Then Forms for "Adele" are available

      # Default Operator & Selection
      When I open Form filter dropdown
      Then there is an ability to select "Has Participated" or "Has NOT Participated" in Form filter
      And "Has Participated" operator is selected by default for Form filter

      When I select "Adele in Munich - 2024 - Form" Form and close
      Then "Adele in Munich - 2024 - Form" Form is selected with "Has Participated" operator
      And audience size is recalculated

      # Save Audience
      When I enter random audience name
      And I click on the Save button for new audience
      Then new audience is created
      And audience overview page header contains audience name and export button
      And Form filter displays "Has Participated" with "Adele in Munich - 2024 - Form" on audience overview page

      # Edit & Switch Operator
      When I click edit audience button
      And I select "Has NOT Participated" operator for Form filter
      Then "Adele in Munich - 2024 - Form" Form is selected with "Has NOT Participated" operator
      And audience size is recalculated

      When I click on the Save button for updated audience
      Then audience is updated
      And audience overview page header contains audience name and export button
      And Form filter displays "Has NOT Participated" with "Adele in Munich - 2024 - Form" on audience overview page

      # Add Multiple Forms
      When I click edit audience button
      And I select "Adele Newsletter Signup 2024 - Website" Form and close
      Then "Adele in Munich - 2024 - Form+1" Forms are selected with "Has NOT Participated" operator

      When I click on the Save button for updated audience
      Then audience is updated
      And audience overview page header contains audience name and export button
      And Form filter displays "Has NOT Participated" with "Adele in Munich - 2024 - Form, Adele Newsletter Signup 2024 - Website" on audience overview page

      # Clear Form Filter
      When I click edit audience button
      And I clear all Forms
      When I click on the Save button for updated audience
      Then audience is updated
      And audience overview page header contains audience name and export button
      And Form filter is NOT displayed in audience details card

    @FS-5874
    @cleanup-created-audience
    @id_1b398d590cae2e8138c4651eabf31b1b99b12f14aa6479f995bfe0cd5acef3de
    Scenario: Form filter persists across Audience Use switches
      # Setup initial audience with Form filter
      Given I select "Columbia Records Group" account for new audience
      When I open artist multiselect for new audience
      And I select "Adele" artist in multiselect for new audience and close
      And I select "United States" location for new audience
      And I open fan segments filter dropdown
      And I select "Engaged Fans" fan segment and close

      # Select Form with Advertising audience use
      When I select "Adele in Munich - 2024 - Form" Form and close
      Then "Adele in Munich - 2024 - Form" Form is selected with "Has Participated" operator

      # Save audience with Advertising use
      When I enter random audience name
      And I click on the Save button for new audience
      Then new audience is created
      And audience overview page header contains audience name and export button
      And Form filter displays "Has Participated" with "Adele in Munich - 2024 - Form" on audience overview page

      # Switch to Email Campaign and verify Form persists
      When I click edit audience button
      And I select Email campaign audience use
      Then "Adele in Munich - 2024 - Form" Form is selected with "Has Participated" operator
      And "Email" campaign audience use is selected

      # Switch back to Advertising and verify Form still persists
      When I select Advertising campaign audience use
      Then "Adele in Munich - 2024 - Form" Form is selected with "Has Participated" operator
      And "Advertising" campaign audience use is selected

      # Save with Advertising use and verify
      When I click on the Save button for updated audience
      Then audience is updated
      And audience overview page header contains audience name and export button
      And Form filter displays "Has Participated" with "Adele in Munich - 2024 - Form" on audience overview page

    @FS-5874
    @cleanup-created-audience
    @id_a92ee662895e30b737aafa74a56e9898ae1bd04e293b3f20cf722b3ddb937b3f
    Scenario: Form filter behavior when managing multiple artists
      # Setup: Select first artist and configure Form filter
      Given I select "Columbia Records Group" account for new audience
      When I open artist multiselect for new audience
      And I select "Adele" artist in multiselect for new audience and close
      And I select "Adele in Munich - 2024 - Form" Form and close
      And I select "Has NOT Participated" operator for Form filter
      Then "Adele in Munich - 2024 - Form" Form is selected with "Has NOT Participated" operator
      And artist "Adele" is selected in multiselect for new audience

      # Test 1: Add second artist - Form filter should persist (NOT reset)
      When I open artist multiselect for new audience
      And I select "AC/DC" artist in multiselect for new audience and close
      Then artist "Adele,AC/DC" is selected in multiselect for new audience
      And "Adele in Munich - 2024 - Form" Form is selected with "Has NOT Participated" operator

      # Test 2: Remove first artist - Form filter should reset
      When I remove "Adele" artist from multiselect for new audience
      Then artist "AC/DC" is selected in multiselect for new audience
      And Form filter has no selections
      And "Has NOT Participated" operator is selected by default for Form filter

      # Test 3: Add second artist back - Form filter should remain reset
      When I open artist multiselect for new audience
      And I select "Adele" artist in multiselect for new audience and close
      Then artist "AC/DC,Adele" is selected in multiselect for new audience
      And Form filter has no selections
      And "Has NOT Participated" operator is selected by default for Form filter

      # Test 4: Select Form for two artists
      When I select "Adele in Munich - 2024 - Form" Form and close
      Then "Adele in Munich - 2024 - Form" Form is selected with "Has NOT Participated" operator
      And I select "AC/DC - The Quiz!" Form and close
      Then "Adele in Munich - 2024 - Form+1" Forms are selected with "Has NOT Participated" operator

      # Save audience with Advertising use
      When I enter random audience name
      And I click on the Save button for new audience
      Then new audience is created
      And audience overview page header contains audience name and export button
      And Form filter displays "Has NOT Participated" with "Adele in Munich - 2024 - Form, AC/DC - The Quiz!" on audience overview page
