@deprecated
@fansifter
@audience-creation-page
Feature: Audience creation page - Design, Errors and Cancel

  Background: Log in (user has access to a few labels)
    Given an orchard employee fansifter-set-2-13-sagittarius for fansifter
    And I have authorized local storage for fansifter
    When I visit Audiences page
    And I open New audience page

  @FS-2219
  @id_61a433a9ee0b162d3d5974d8e7e3bba2bf5eada024b4a732fa468bb31e3d09fc
  Scenario: Audience creation page design
    Then audience size is shown as TBD
    And there is an explanation text below the audience size
    When I select "Columbia Records Group" account for new audience
    And I open artist multiselect for new audience
    And I select "First Aid Kit" artist in multiselect for new audience and close
    Then audience size is calculated
    And explanation text is not displayed under the audience size

  @FS-2335
  @id_ee0f7ff2a77d32108dbe75320c2e5f70a6808197e2370a538f95123d18f6f36a
  Scenario: Audience creation page cancel creation
    Given I have the audience data:
      | Account         | Columbia Records Group         |
      | Audience Use    | Advertising                    |
      | Artists         | Megan Moroney                  |
      | 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 fill new audience data
    And I cancel audience creation
    Then the audience overview page is not shown
    And canceled audience is not shown in the table

  @FS-2221
  @cleanup-created-audience
  @id_662801d06f489c40ab4d2b428322f0f27c024bd29cc05164d294c2adacb0c093
  Scenario: Audience creation page error states existing audience name
    Given I have the audience data:
      | Account      | Columbia Records Group |
      | Audience Use | Advertising            |
      | Artists      | First Aid Kit          |
      | Fan location | Iceland                |
    When I fill new audience data
    And I click on the Save button for new audience
    Then new audience is created
    When I visit Audiences page
    And I open New audience page
    And I select "Columbia Records Group" account for new audience
    And I open artist multiselect for new audience
    And I select "First Aid Kit" artist in multiselect for new audience and close
    And I enter the same audience name as previously created
    And I click on the Save button for new audience
    Then an error message about the same audience name is shown

  @FS-2255
  @id_7d75ea7a96e1ca01ca89f027384057a76560dd70599d39c289395e2b832fefd7
  Scenario: Audience creation page error states CreateAudience request
    When I select "Columbia Records Group" account for new audience
    And I open artist multiselect for new audience
    And I select "First Aid Kit" artist in multiselect for new audience and close
    And I enter random audience name
    And I click on the Save button for new audience
    Then audience creation error toast is shown

  @FS-2256
  @id_15355d347059797b8eaaa563a04333564a6844c8b00d473b3c39f6ff58522ca3
  Scenario: Audience creation page error states incompatible values
    Given I have the audience data:
      | Account      | Columbia Records Group |
      | Audience Use | Advertising            |
      | Artists      | First Aid Kit          |
      | Fan location | Hungary                |
    When I fill new audience data
    Then alert about fans from "Hungary" are not eligible is shown
    When I click on the Save button for new audience
    Then I don't see any loading indicators
    And alert about fans from "Hungary" are not eligible is shown
    When I select Email campaign audience use
    Then I don't see any loading indicators
    And I don't see alert about fans are not eligible
    When I select Advertising campaign audience use
    Then I don't see any loading indicators
    And alert about fans from "Hungary" are not eligible is shown
    When I enter random audience name
    And I click on the Save button for new audience
    Then I don't see any loading indicators
    And alert about fans from "Hungary" are not eligible is shown
    When I cancel audience creation
    And I enter created audience name into Search by Name field
    Then "No Audiences Found" message is displayed in the audiences table
