@fansifter
@audiences-page
Feature: Audiences page tests

  Rule: Tests that don't require a new audience

    Background: Log in (user has access to a few labels)
      Given an orchard employee fansifter-set-2-5-taurus for fansifter
      And I log in

    @FS-2199
    @id_f30ef4e5e7eb40d5879f5f37d4688ec7b0c932422fd3552d0229a374d526f21e
    Scenario: Audiences table customization
      When I visit Audiences page
      Then default columns exist in the audiences table
      When I open Customize Columns modal
      Then default columns are selected by default in Audiences customize columns modal
      When I select all columns and save changes
      Then all columns exist in the audiences table

    @FS-2357
    @id_b42db19a7bf3d5b5d6896b85325d3ba13d04a785a45d290fafead6d690b1650e
    Scenario: Audiences table search for non-existent audience
      When I visit Audiences page
      When I enter non-existent audience name into Search by Name field
      Then "No Audiences Found" message is displayed in the audiences table

    @FS-2358
    @id_37a8bdb9b75ab26a2f5e9605c874397cb44f728b45b4d9b65428746ee73d989d
    Scenario: Audiences table with 0 audiences
      Given I will mock audiences requests to return empty list
      When I visit Audiences page
      Then "No Audiences yet" message is displayed in the audiences table

    @FS-2359
    @id_f0d395242fa56562ba99d321705255aa259f0887ae1442197ce7b9c21916bede
    Scenario: Audiences table error state
      Given I will abort "audiences" requests for fansifter
      When I visit Audiences page
      Then audiences table isn't shown
      And "Network Error" message is displayed in the audiences page

  Rule: Tests that require a new audience

    Background: Log in and create an audience
      Given an orchard employee fansifter-set-2-5-taurus for fansifter
      And I log in
      And I have the audience data:
        | Account      | Columbia Records Group |
        | Audience Use | Advertising            |
        | Artists      | First Aid Kit          |
        | Fan location | Include, United States |
        | Fan segment  | Include, Engaged Fans  |
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data
      And I save new audience
      Then new audience is created
      When I visit Audiences page

    @FS-2054
    @cleanup-created-audience
    @id_39daac694b7d093903fbaa8880acfa004ae7c312e36ff9cb0ecc340e993f58a0
    Scenario: Audiences table data verification
      Then created audience exists in the table
      When I open Customize Columns modal
      Then default columns are selected by default in Audiences customize columns modal
      When I select all columns and save changes
      And audience data in the table is correct

    @FS-2200
    @cleanup-created-audience
    @ows_dmp
    @id_32d7f8d23015b0368da39bd4ab70502ccb9ebbe3057dd4ac16c515a443e72775
    Scenario: Audiences table search
      When I enter created audience name into Search by Name field
      Then audiences are filtered by name

    @FS-2201
    @cleanup-created-audience
    @ows_dmp
    @id_b199f2a23c0775b8d8ba5fd1606779d062611d81e78bf2739833f8c75d3bd44e
    Scenario: Audiences table artist filtering
      When I enter the artist of the created audience into the Artist field
      Then audiences are filtered by artist

    @FS-2336
    @ows_dmp
    @id_3e265612bac3ef294142fe175cb3590478676e098f884f503d5cb83769c82cdf
    Scenario: Audiences table archiving the audience
      Then created audience exists in the table
      When I archive the created audience
      Then archived audience is not shown in the table
      When I visit archived audience by URL
      Then I see Not found error on a page

    @FS-2337
    @cleanup-created-audience
    @id_cd6012ac97a7469f648977554410aa24060f3344e79afa97d16d1c63695bc824
    Scenario: Audiences table cancel archiving the audience
      Then created audience exists in the table
      When I open Archive audience modal for created audience
      And I click Cancel button in archive audience modal
      And I refresh the page
      Then created audience exists in the table
