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

  Rule: User with Set 2-1 Capricorn 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

    @id_b2f5f62ae0d81b6e72e7aa5855fa4fdd24fb365858a65a40863e5e5b38ca69e5
    Scenario: Search and view artists from two labels
      Given an orchard employee fansifter-set-2-1-capricorn visits fansifter
      When I try to log in to fansifter
      Then I see "Search, My Roster" navigation tab in Fansifter navbar
      And I don't see "Audiences, Ad Reporting, Email Campaigns, App Connections" navigation tabs in Fansifter navbar
      And I see "fansifter" icon in app switcher popover

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

    Background: Login as set-2-3-pisces
      Given an orchard employee fansifter-set-2-3-pisces visits fansifter
      When I try to log in to fansifter
      Then I see "Search, My Roster, Audiences, Ad Reporting, Email Campaigns, App Connections" navigation tab in Fansifter navbar

    @cleanup-created-email-campaign
    @cleanup-duplicated-email-campaign
    @id_2dda30d6b51f3da9cf5b3a513237092eff2abfe0ffd32adeb694d4a1a70daf4b
    Scenario: User should have email campaign creation access for Columbia Records Group label
      When I visit Email Campaigns page
      Then I receive email campaigns data from backend
      Then I see valid Email Campaigns page with create access
      Given I have email campaign data:
        | Account | Columbia Records Group (34514), Disabled |
        | Artist  | AC/DC                                    |
      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                       |
        | Audience     | AUTO_COLUMBIA_LABEL_EMAIL_DO_NOT_DELETE  |
      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
      Then I see correct email campaign data on Email Overview page

    @cleanup-created-ad-report
    @id_9e6674aa5f2803598ab17fa63c3d7494d9c7c7cdc6fe071b2caac90865f75083
    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
      Then I see only campaigns for "Columbia Records Group" account  in new report table
      When I filter new report campaigns by "Adele" artist
      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" account report's campaigns tab

    @id_ece993c0bcaaeabcbcbd3acfcd258cfdb20dcc7201d1e9eef94110043e3123a8
    Scenario: User has access to all app connections for Test Label
      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" accounts in "Meta" app connections table
      And Google Ad Accounts section with table is shown
      And I see only "Test Label" accounts in "Google" app connections table
      And TikTok Ad Accounts section with table is shown
      And I see only "Test Label" 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-audience
    @id_798ffb021fb16711cbd783660839a55aba3344a519edf075f2e5dbc5d349456d
    Scenario: User can create advertising audience for Test Label and share to Meta
      Given I have the audience data:
        | Account      | Test Label              |
        | Audience Use | Advertising             |
        | Artists      | Wolfgang Amadeus Mozart |
        | Fan location | United States           |
        | Fan segment  | Include, Casual Fans    |
      When I visit Audiences page
      And I open New audience page
      Then "Advertising" campaign audience use should be available
      And account "Test Label (7123)" is selected for new audience and disabled
      When I fill new audience data
      And I click on the Save button for new audience
      Then new audience is created
      When I open the Share audience sidebar
      And I set Ad account to Demo Ad Account
      And I click Share button in the Share sidebar
      Then audience is successfully shared to Meta

    @cleanup-created-audience
    @id_60f4f46128fec808998be671e51fe91993fa45047c11f30ed622754f7ba0f83b
    Scenario: User can create and edit email audience for Columbia Records Group
      Given I have the audience data:
        | Account      | Columbia Records Group |
        | Audience Use | Email                  |
        | Artist       | Adele                  |
        | Fan location | United States          |
        | Fan segment  | Include, Engaged Fans  |
      When I visit 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
      And account "Columbia Records Group (34514)" is selected for new audience and disabled
      When I fill new audience data
      And I click on the Save button for 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 account "Columbia Records Group (34514)" is selected for new audience and disabled
      And I select "Australia" location for new audience
      And I click on the Save button for new audience
      Then audience is updated
      And audience page shows correct audience data

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

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

    @wip
    @cleanup-created-audience
    @id_d4daf70699f1da9115d117dd33fdae618a3a01c3e5b8f37d6890263972533c78
    Scenario: User should be able to create audience for Columbia Records Group and share it
      When I open Audiences page
      And I open New audience page
      Then "Advertising" campaign audience use should be available
      And "Email" campaign audience use should not be available
      Given I have the audience data:
        | Account        | Columbia Records Group     |
        | Audience Use   | Advertising                |
        | Artists        | Adele                      |
        | Fan location   | United States              |
        | Heavy rotation | Include, In Heavy Rotation |
      When I fill new audience data
      And I click on the Save button for new audience
      Then new audience is created
      When I click edit audience button
      Then "Advertising" campaign audience use should be available and disabled
      And "Email" campaign audience use should not be available
      And account "Columbia Records Group (34514)" is selected for new audience and disabled
      And I click on the Cancel button for new audience
      When I open the Share audience sidebar
      And I set Ad account to Demo Ad Account
      And I click Share button in the Share sidebar
      Then progress indicator with text is shown in the Share sidebar
      And audience is successfully shared to Meta

    @id_306b612b5988ebab38c8fbab8c62153790824e10769c5a81e96ba36cf6041670
    Scenario: User should have access to audience creation for both and emails view for Columbia Records Group
      When I open Audiences page
      And I open New audience page
      Then "Advertising" campaign audience use should be available
      And "Email" campaign audience use should not be available
      When I select Advertising 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 receive email campaigns data from backend
      And I see valid Email Campaigns page with view access
      When I show "Account" column for Email Campaigns table
      Then I see only "Columbia Records Group" 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

    @id_988617d994a0a4bf075790171407cd768f47618d9639cad940d4d9c5f24b8d9c
    Scenario: User has access to all app connections except Shopify
      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 hidden

  Rule: User with Set 2-7 Cancer 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_view_email_campaigns
    - fansifter_can_view_sms_campaigns
    V2 Roles (Columbia Records Group):
    - fansifter_can_view_fan_data

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

    @id_920b3aad6d892ca7179f4beb553e31f91cebe6150d05aa52abde48ae29e63254
    Scenario: User should have access to ad audience creation and email campaigns view for Test Label
      When I open Audiences page
      And I open New audience page
      Then "Advertising" campaign audience use should be available
      And "Email" campaign audience use should not be available
      And account "Test Label (7123)" 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 view access
      When I show "Account" column for Email Campaigns table
      Then I see only "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

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

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

    @id_8c912bd9d9dbfe1899d35c1d6b00bda52813583b32c1feccb8b7d06a8d348ec5
    Scenario: User should have read access to and email campaigns for Columbia Records Group
      When I visit Audiences page
      Then I see Not found error on a page
      When I visit Email Campaigns page
      Then I receive email campaigns data from backend
      And I see valid Email Campaigns page with view access
      When I show "Account" column for Email Campaigns table
      Then I see only "Columbia Records Group" 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

  Rule: User with Set 2-11 Scorpio 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_view_email_campaigns
    - fansifter_can_view_sms_campaigns
    V2 Roles (Columbia Records Group):
    - fansifter_can_view_fan_data
    - fansifter_can_view_email_campaigns
    - fansifter_can_view_sms_campaigns

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

    @id_440a454453ccca4fee8d196430a41d2db9dfc3a76c201e0001ebeb8cf96e5881
    Scenario: User should have access to ad audience creation for Test Label and email campaign view access for Columbia Records Group
      When I open Audiences page
      And I open New audience page
      Then "Advertising" campaign audience use should be available
      And "Email" campaign audience use should not be available
      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 view access

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

    Background: Login as set-2-13-sagittarius
      Given an orchard employee fansifter-set-2-13-sagittarius visits fansifter
      When I try to log in to fansifter
      Then I see "Search, My Roster, Audiences, Ad Reporting, Email Campaigns, App Connections" navigation tab in Fansifter navbar

    @artist-page
    @id_b2f5f62ae0d81b6e72e7aa5855fa4fdd24fb365858a65a40863e5e5b38ca69e5
    Scenario: Search and view artists from two labels
      When I open the Search page
      And I search for an artist "Adele"
      And I select #1 search result containing "Adele"
      Then page header with all elements is shown with fans
      And all fan data and charts are visible
      When I open the 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

    @id_97e3ca933d144186108fef0c7a8a163a5ba794785d0220c820a05634b2fdc5f8
    Scenario: User should have access only to Columbia Records Group 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 be available
      And account "Columbia Records Group (34514)" is selected for new audience and disabled
      When I select Email campaign audience use
      And 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
      When I click on "New Email" button on Email campaigns page
      Then I see Create Email Campaign modal opened
      And I see "Columbia Records Group (34514)" account selected and disabled in Create Email Campaign modal
      When I visit App Connections page
      Then App Connections page header is shown
      And Meta Ad Accounts section with table is shown
      And I see only "Columbia Records Group" accounts in "Meta" app connections table
      And Google Ad Accounts section with table is shown
      And I see only "Columbia Records Group" accounts in "Google" app connections table
      And TikTok Ad Accounts section with table is shown
      And I see only "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
