@fansifter_permissions
Feature: Permissions for users with access to two labels Part 2

  Rule: User with Set 2-2 Aquarius access
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    V2 Roles (Test Label)
    - fansifter_can_view_fan_data
    V2 Roles (Columbia Records Group)
    - fansifter_can_view_fan_data

    Background: Login as set-2-2-aquarius
      Given an orchard employee fansifter-set-2-2-aquarius visits fansifter
      When I log in
      Then I see "Search, My Roster" navigation tab in Fansifter navbar
      And I don't see "Audiences, Ad Reporting, Emails, Email Campaigns, App Connections" navigation tabs in Fansifter navbar
      And I see "fansifter" icon in app switcher popover

    @artist-page
    @id_8f5a170e5509b69bf53cb49712bba73f30ff787c1f031fcb6e2e81c52f59f41e
    Scenario: Search and view artists from two labels
      When I open Fansifter Search page
      And I search for an artist "AC/DC"
      And I select #1 search result containing "AC/DC"
      Then page header with all elements is shown with fans
      And I receive fansifter artist page data responses
      And all fan data and charts are visible
      When I open Fansifter Search page
      And I search for an artist "Wolfgang Amadeus Mozart"
      And I select #1 search result containing "Wolfgang Amadeus Mozart" without access
      Then page header with all elements is shown with fans
      And all fan data and charts are visible
      When I open Fansifter Search page
      And I search for an artist "Konrad Mil"
      And I select #1 search result containing "Konrad Mil" without access
      Then page header with all elements is shown without fans
      And notice about no fan data is shown on artist page
      And total fans count is "—"
      And all fan data and charts are hidden

    @artist-page
    @id_290ca87be6314f22aaa703f1826c2a14818dd0d91a0ad92ab887c5267ba15572
    Scenario: My Roster search and filter
      When I am on My Roster page
      Then I see only "Columbia Records Group (34514), Test Label (7123)" options in accounts filter for My Roster
      When I select "Test Label" account on My Roster page
      And I search for "Wolfgang Amadeus Mozart" on My Roster page
      Then I receive My Roster data from backend
      And I see only "Wolfgang Amadeus Mozart" artist in My Roster table
      When I select "Columbia Records Group" account on My Roster page
      Then I receive My Roster data from backend
      And I search for "AC/DC" on My Roster page
      Then I receive My Roster data from backend
      And I see only "AC/DC" artist in My Roster table
      When I clear all filters on My Roster page
      And I search for "Konrad Mil" on My Roster page
      Then I receive My Roster data from backend
      And I see no artists/lists in My Roster table

    @id_cc9f6b67831a29c55fa6cee34773ee4837faea163782e90092638fada89b1089
    Scenario: User should see not found error on a pages without access
      When I visit Ad Reporting page without access
      Then I see Not found error on a page
      When I visit Audiences page without access
      Then I see Not found error on a page
      When I visit Email Campaigns page without access
      Then I see Not found error on a page
      When I visit App Connections page without access
      Then I see Not found error on a page

  Rule: User with Set 2-4 Aries access
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - Audiences
    - App Connections
    - Ad Reporting
    - Email Campaigns
    - SMS Campaigns
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_connect_ad_accounts
    - fansifter_can_create_ad_reports
    - fansifter_can_view_email_campaigns
    - fansifter_can_create_sms_campaigns
    V2 Roles (Columbia Records Group):
    - fansifter_can_view_fan_data
    - fansifter_can_connect_ad_accounts
    - fansifter_can_create_ad_reports
    - fansifter_can_create_email_campaigns

    Background: Login as set-2-4-aries
      Given an orchard employee fansifter-set-2-4-aries visits fansifter
      When I log in
      Then I see "Search, My Roster, Audiences, Ad Reporting, Emails, App Connections" navigation tab in Fansifter navbar

    @id_12acf103cc8fd0ab9dd34ab67f9f6a5430ce3f2fb7c55b0c5699f8bde4586ce8
    Scenario: User should have access to email audience and campaign creation for two labels
      When I open Audiences page
      And I open New audience page
      Then "Email" campaign audience use should be available
      And "Advertising" campaign audience use should not be available
      When I select Email campaign audience use
      Then account "Columbia Records Group (34514)" is selected for new audience and disabled
      When I visit Email Campaigns page
      Then I see valid Email Campaigns page with create access
      Given I have email campaign data:
        | Account | Columbia Records Group (34514), Disabled |
        | Artist  | Adele                                    |
      When I create Email Campaign with data
      Then I see correct email campaign data on Email Overview page
      When I edit Email Campaign Details with data:
        | Account      | Columbia Records Group (34514), Disabled |
        | Subject      | Edited Subject                           |
        | Preview Text | Edited Preview Text                      |
        | Sender Name  | Edited Sender Name                       |
      Then I see correct email campaign data on Email Overview page
      When I duplicate opened Email Campaign
      Then I see duplicated Email Campaign overview page
      And I see correct email campaign data on Email Overview page

    @id_d13aef44385800e93774b04ab66f4c5250eae67cbbaef7b6c6b82b3733131414
    Scenario: User has access to all app connections
      When I open App Connections page
      Then App Connections page header is shown
      And Meta Ad Accounts section with table is shown
      And I see only "Test Label, Columbia Records Group" accounts in "Meta" app connections table
      And Google Ad Accounts section with table is shown
      And I see only "Test Label, Columbia Records Group" accounts in "Google" app connections table
      And TikTok Ad Accounts section with table is shown
      And I see only "Test Label, Columbia Records Group" accounts in "TikTok" app connections table
      And Shopify stores section with table is shown
      And I see only "Test Label, Columbia Records Group" accounts in "Shopify" app connections table

    @cleanup-created-ad-report
    @id_308aa2470c7dc364481c7832ce4c024b8e313d922b359e2b295027c3b2deac5c
    Scenario: User should be able to create ad report with campaigns from two labels
      When I open Ad Reporting page
      And I click on "New report" button
      Then new ad report modal is opened
      And I receive "campaigns" data from backend
      When I filter new report campaigns by "Adele" artist
      Then I receive "campaigns" data from backend
      And I select first campaign in table for new ad report
      When I filter new report campaigns by "Wolfgang Amadeus Mozart" artist
      Then I receive "campaigns" data from backend
      And I select first campaign in table for new ad report
      When I confirm selected campaigns for new ad report
      Then I fill new ad report random name
      When I confirm creating new ad report
      Then I receive "report" data from backend
      When I click on report's "Campaigns" tab
      Then Report's "Campaigns" filters are shown
      And I receive report's campaigns data from backend
      And Default report's "Campaigns" data is correctly shown in the table
      And All campaigns should be shown in report's campaigns tab table
      And I see only campaigns for "Columbia Records Group, Test Label" account report's campaigns tab

  Rule: User with Set 2-6 Gemini access
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - Audiences
    - Ad Reporting
    - Email Campaigns
    - SMS Campaigns
    - App Connections
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_create_ad_reports
    - fansifter_can_share_ad_campaign_audiences
    - fansifter_can_create_email_campaigns
    - fansifter_can_create_sms_campaigns
    V2 Roles (Columbia Records Group):
    - fansifter_can_view_fan_data
    - fansifter_can_create_ad_reports
    - fansifter_can_share_ad_campaign_audiences
    - fansifter_can_view_email_campaigns
    - fansifter_can_view_sms_campaigns

    Background: Login as set-2-6-gemini
      Given an orchard employee fansifter-set-2-6-gemini visits fansifter
      Given I have Email Campaigns permissions:
        | Test Label             | create |
        | Columbia Records Group | view   |
      And I log in
      Then I see "Search, My Roster, Audiences, Emails, Ad Reporting, App Connections" navigation tab in Fansifter navbar

    @id_dbefde1e87503c41adf3a8062160e010d319afb9b118b0a0c7b434485074a38d
    Scenario: User with email create access can create and manage email audiences
      When I open Audiences page
      And I open New audience page
      Then "Email" campaign audience use should be available
      And "Advertising" campaign audience use should be available
      And only "Columbia Records Group (34514), Test Label (7123)" accounts are available for new audience creation
      When I select Email campaign audience use
      Then account "Test Label (7123)" is selected for new audience and disabled
      And I have the audience data:
        | Account         | Test Label                     |
        | Audience Use    | Email                          |
        | Artist          | Wolfgang Amadeus Mozart        |
        | Fan location    | Include, United States         |
        | Fan segment     | Include, Engaged Fans          |
        | Last engagement | Include, Past Year             |
        | Fan DSP         | Exclude, Apple Music           |
        | Heavy rotation  | Exclude, NOT in Heavy Rotation |
      When I fill new audience data
      And I save new audience
      Then new audience is created
      When I visit Audiences page
      Then created audience exists in the table
      When I archive the created audience
      Then archived audience is not shown in the table

    @cleanup-created-email-campaign
    @cleanup-duplicated-email-campaign
    @id_f15bd55b922deee90a212bf3052fa5994072c20d88210105986eb5fab54eaddd
    Scenario: User with email create access can create and manage email campaigns
      When I visit Email Campaigns page
      Then I see valid Email Campaigns page with create access
      Given I have email campaign data:
        | Account | Test Label (7123), Disabled |
        | Artist  | Wolfgang Amadeus Mozart     |
      When I create Email Campaign with data
      Then I see correct email campaign data on Email Overview page
      When I edit Email Campaign Details with data:
        | Account      | Test Label (7123), Disabled |
        | Subject      | Edited Subject              |
        | Preview Text | Edited Preview Text         |
        | Sender Name  | Edited Sender Name          |
      Then I see correct email campaign data on Email Overview page
      When I duplicate opened Email Campaign
      Then I see duplicated Email Campaign overview page
      And I see correct email campaign data on Email Overview page

    @cleanup-created-audience
    @id_dcb460e1abe5d70945f848afebd4383cb30304621f1b7540e1e7bbb649da8e9b
    Scenario: User can share Test label audience
      Given I have the audience data:
        | Account      | Test Label              |
        | Audience Use | Advertising             |
        | Artists      | Wolfgang Amadeus Mozart |
        | Fan location | Include, United Kingdom |
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data
      When I save new audience
      Then new audience is created
      And audience size is greater than 10000
      When I open the Share audience sidebar
      When I set Ad account to Demo Ad Account
      And I share the audience to Meta
      Then progress indicator with text is shown in the Share sidebar
      And audience is successfully shared to Meta

    @cleanup-created-audience
    @id_0835ec97b46e6e3e4d8dbcf4c369a8033d4ad382633bba585017efa05d09dc37
    Scenario: User can share Columbia Records Group audience
      Given I have the audience data:
        | Account      | Columbia Records Group |
        | Audience Use | Advertising            |
        | Artists      | Adele                  |
        | Fan location | Include, Greece        |
      When I visit Audiences page
      And I open New audience page
      And I fill new audience data
      When I save new audience
      Then new audience is created
      And audience size is greater than 1000
      When I open the Share audience sidebar
      When I set Ad account to Demo Ad Account
      And I share the audience to Meta
      Then progress indicator with text is shown in the Share sidebar
      And audience is successfully shared to Meta

    @id_5e6f6a6e20c7f18aa3e5a36138a5f793aab7704ab71e53bdd762acf3f75f7ef8
    Scenario: User should have access to email creation for Test Label and emails view for Columbia Records Group
      When I visit Email Campaigns page
      Then I receive email campaigns data from backend
      And I see valid Email Campaigns page with create access
      When I show "Account" column for Email Campaigns table
      Then I see only "Columbia Records Group, Test Label" accounts in Email Campaigns table
      And I check correct permissions for Sent Email Campaigns
      And I check correct permissions for Draft Email Campaigns
      And I check correct permissions for Scheduled Email Campaigns

  Rule: User with Set 2-8 Leo access
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - Audiences
    - Email Campaigns
    - SMS Campaigns
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_create_email_campaigns
    - fansifter_can_create_sms_campaigns
    V2 Roles (Columbia Records Group):
    - fansifter_can_view_fan_data

    Background: Login as set-2-8-leo
      Given an orchard employee fansifter-set-2-8-leo visits fansifter
      When I log in
      Then I see "Search, My Roster, Audiences, Emails" navigation tab in Fansifter navbar
      And I don't see "App Connections, Ad Reporting" navigation tab in Fansifter navbar

    @id_0c031a5a1c8c0eaccdcdec37a26a3eb735343a4c526e13582e266ac71c4352bf
    Scenario: User should have access to audience and email creation for Test Label
      When I open Audiences page
      And I open New audience page
      Then "Email" campaign audience use should be available
      And "Advertising" campaign audience use should not be available
      When I select Email campaign audience use
      And account "Test Label (7123)" is selected for new audience and disabled
      When I visit Email Campaigns page
      Then I see valid Email Campaigns page with create access
      When I click on "New Email" button on Email campaigns page
      Then I see Create Email Campaign modal opened
      When I select "Campaign" email type in Create Email Campaign modal
      Then I see "Test Label (7123)" account selected and disabled in Create Email Campaign modal

  Rule: User with Set 2-10 Libra access
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - Audiences
    - Email Campaigns
    - SMS Campaigns
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_view_email_campaigns
    - fansifter_can_view_sms_campaigns
    V2 Roles (Columbia Records Group):
    - fansifter_can_view_fan_data
    - fansifter_can_share_ad_campaign_audiences
    - fansifter_can_create_email_campaigns
    - fansifter_can_create_sms_campaigns

    Background: Login as set-2-10-libra
      Given an orchard employee fansifter-set-2-10-libra visits fansifter
      Given I have Email Campaigns permissions:
        | Columbia Records Group | create |
        | Test Label             | view   |
      When I log in
      Then I see "Search, My Roster, Audiences, Emails" navigation tab in Fansifter navbar
      And I don't see "App Connections, Ad Reporting" navigation tab in Fansifter navbar

    @id_e4a8563ca013e89e7e9e1f6ab9aa61828ec27098772ab299b903b0f17dbbd328
    Scenario: User should have access to  email audience and campaign creation for Columbia Records Group
      When I open Audiences page
      And I open New audience page
      Then "Email" campaign audience use should be available
      And "Advertising" campaign audience use should be available
      And account "Columbia Records Group (34514)" is selected for new audience and disabled
      When I select Email campaign audience use
      Then account "Columbia Records Group (34514)" is selected for new audience and disabled
      When I visit Email Campaigns page
      Then I receive email campaigns data from backend
      And I see valid Email Campaigns page with create access
      When I show "Account" column for Email Campaigns table
      Then I see only "Columbia Records Group, Test Label" account in Email Campaigns table
      And I check correct permissions for Sent Email Campaigns
      And I check correct permissions for Draft Email Campaigns
      And I check correct permissions for Scheduled Email Campaigns
      When I click on "New Email" button on Email campaigns page
      Then I see Create Email Campaign modal opened
      When I select "Campaign" email type in Create Email Campaign modal
      Then I see "Columbia Records Group (34514)" account selected and disabled in Create Email Campaign modal

  Rule: User with Set 2-12 Ophiuchus access
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - Audiences
    - Email Campaigns
    - SMS Campaigns
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_share_ad_campaign_audiences
    - fansifter_can_create_email_campaigns
    - fansifter_can_create_sms_campaigns
    V2 Roles (Columbia Records Group):
    - fansifter_can_view_fan_data
    - fansifter_can_create_email_campaigns
    - fansifter_can_create_sms_campaigns

    Background: Login as set-2-12-ophiuchus
      Given an orchard employee fansifter-set-2-12-ophiuchus visits fansifter
      Given I have Email Campaigns permissions:
        | Test Label             | create |
        | Columbia Records Group | create |
      When I log in
      Then I see "Search, My Roster, Audiences, Emails" navigation tab in Fansifter navbar
      And I don't see "App Connections, Ad Reporting" navigation tab in Fansifter navbar

    @cleanup-created-audience
    @id_b1560e4b023d8988fe2ce4a6f386a1ed16b416f601461f196fd680568e6be199
    Scenario: User should be able to change audience use for Test Label audience
      Given I have the audience data:
        | Account      | Test Label              |
        | Audience Use | Advertising             |
        | Artists      | Wolfgang Amadeus Mozart |
      When I open Audiences page
      And I open New audience page
      Then "Email" campaign audience use should be available
      And "Advertising" campaign audience use should be available
      When I fill new audience data
      And I save new audience
      Then new audience is created
      When I click edit audience button
      Then "Email" campaign audience use should be available and enabled
      And "Advertising" campaign audience use should be available and enabled
      And "Advertising" campaign audience use is selected
      When I select Email campaign audience use
      And account "Test Label (7123)" is selected for new audience and disabled
      When I save updated audience
      Then audience is updated
      When I refresh the page
      When I click edit audience button
      Then "Email" campaign audience use should be available and enabled
      And "Email" campaign audience use is selected
      And "Advertising" campaign audience use should be available and enabled
      When I select Advertising campaign audience use
      And account "Test Label (7123)" is selected for new audience and disabled
      When I save updated audience
      Then audience is updated
      And audience page shows correct audience data
      And audience page does not show elements not in audience data

    @cleanup-created-audience
    @id_e7676565dd800134f336e455c11325f13ee9f2dd038de64cc8795606d10920de
    Scenario: User should be able to change audience use for Columbia Records Group audience
      Given I have the audience data:
        | Account      | Columbia Records Group |
        | Audience Use | Email                  |
        | Artist       | Adele                  |
      When I open Audiences page
      And I open New audience page
      Then "Email" campaign audience use should be available
      And "Advertising" campaign audience use should be available
      When I fill new audience data
      And I save new audience
      Then new audience is created
      When I click edit audience button
      Then "Email" campaign audience use should be available and disabled
      And "Email" campaign audience use is selected
      And "Advertising" campaign audience use should be available and disabled
      When I click on the Cancel button for updated audience
      And audience page shows correct audience data
      And audience page does not show elements not in audience data

    @id_12acf103cc8fd0ab9dd34ab67f9f6a5430ce3f2fb7c55b0c5699f8bde4586ce8
    Scenario: User should have access to email audience and campaign creation for two labels
      When I open Audiences page
      And I open New audience page
      Then "Email" campaign audience use should be available
      And "Advertising" campaign audience use should be available
      And account "Test Label (7123)" is selected for new audience and disabled
      When I select Email campaign audience use
      Then only "Columbia Records Group (34514), Test Label (7123)" accounts are available for new audience creation
      When I visit Email Campaigns page
      Then I see valid Email Campaigns page with create access
      When I click on "New Email" button on Email campaigns page
      Then I see Create Email Campaign modal opened
      When I select "Campaign" email type in Create Email Campaign modal
      Then I see only "Columbia Records Group (34514), Test Label (7123)" accounts in Create Email Campaign modal

    @id_a5918223701cbe37b226f912c9ceabb1f26f90a1f758630f1c5e133327d7cc54
    Scenario: User should have access to email create access for both labels
      When I visit Email Campaigns page
      Then I receive email campaigns data from backend
      And I see valid Email Campaigns page with create access
      When I show "Account" column for Email Campaigns table
      Then I see only "Columbia Records Group, Test Label" accounts in Email Campaigns table
      And I check correct permissions for Sent Email Campaigns
      And I check correct permissions for Draft Email Campaigns
      And I check correct permissions for Scheduled Email Campaigns
