@fansifter_permissions
Feature: Permissions for users with single label access Part 2

  Rule: User with basic features access (set-1-2-basic)
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data

    Background: Login as fansifter-set-1-2-basic
      Given an orchard employee fansifter-set-1-2-basic 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, SMS Campaigns, App Connections" navigation tabs in Fansifter navbar
      And I see "fansifter" icon in app switcher popover

    @artist-page
    @id_dd44c850da5cffd2cdc9fa2d1095bb37b890214b6d270ad95845cf39987d80b2
    Scenario: Search and view artist in label with access and without
      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"
      Then page header with all elements is shown with fans
      And I receive fansifter artist page data responses
      And heavy rotation view is shown
      And heavy rotation chart is shown
      And fans by gender view is shown
      And fans by gender chart is shown
      And fans are also listening to view is shown
      #And fans are also listening to artists are shown #AUT-959
      When I open Fansifter Search page
      And I search for an artist "Adele"
      And I select #1 search result containing "Adele" 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

    @id_ccd2643d7c5c4b6efb552dc4bd80a8dd4b1e833855783a1a4cda3032bb08bdde
    Scenario: My Roster search and filter
      When I am on My Roster page
      Then I see only "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 clear all filters on My Roster page
      Then I receive My Roster data from backend
      When I search for "Adele" on My Roster page
      Then I receive My Roster data from backend
      And I see no artists/lists in My Roster table

  Rule: User with only Ad Reporting access (set-1-4-ad-reporting)
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - Ad Reporting
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_create_ad_reports

    Background: Login as fansifter-set-1-4-ad-reporting
      Given an orchard employee fansifter-set-1-4-ad-reporting visits fansifter
      When I log in
      Then I see "Search, My Roster, Ad Reporting" navigation tab in Fansifter navbar
      And I don't see "Audiences, Emails, Email Campaigns, SMS Campaigns, App Connections" navigation tabs in Fansifter navbar

    @id_75dab8470abebf67f1a4c38b4f28de340b53c4ac1efc8fca108067fd85eed58a
    Scenario: User should not have access to audiences, email campaigns, app connections
      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

    @cleanup-created-ad-report
    @id_5bf8dbddd96feee94a412631e936b5c46c7f237edbcaf440d7c860669f33be0c
    Scenario: User has access only to Ad Reporting
      Given I have newly created ad report with one campaign
      When I change Ad report name
      Then edited Ad report name is present in report page header
      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
      When I click add "Add Campaigns" button on report campaigns tab
      Then Add campaigns to report modal should be present
      And Already added campaigns should be checked in Add Campaigns modal
      When I add new campaign to Ad Report in Add Campaigns modal
      Then Add campaigns to report modal should not exist
      And I will alias "adReportingReportCampaigns" requests for fansifter
      When I refresh the page
      And I receive report's campaigns data from backend
      Then All campaigns should be shown in report's campaigns tab table
      When I remove one of the campaigns from report's campaigns tab
      And I will alias "adReportingReportCampaigns" requests for fansifter
      And I refresh the page
      And I receive report's campaigns data from backend
      Then All campaigns should be shown in report's campaigns tab table
      When I click on report's "Ad Sets" tab
      Then I receive report's ad sets data from backend
      And Default report's "Ad Sets" data is correctly shown in the table
      When I click on report's "Ads" tab
      Then I receive report's grouped ads data from backend
      And report's grouped ads data is correctly shown in the table

    @id_364df174b5f0ba17529aeb5ebb5f838581ae10a82eb1c24008306e8272d012ed
    Scenario: User should be able to change assigned artists in campaign
      When I open Ad Reporting page
      Then I receive "reports" data from backend
      And I click Campaigns tab
      Then I receive "campaigns" data from backend
      When I search for campaign with "Mozart"
      Then I receive "campaigns" data from backend
      When I click on edit assigned artists for second campaign
      Then assign artist modal is opened
      Then I delete all additional assigned artist in modal
      And I select artist with name "Wolfgang Amadeus Mozart" in #1 row
      When I confirm assigned artists in modal
      Then toast after only "Wolfgang Amadeus Mozart" artist has been assigned to edited campaign is present
      Then assign artist modal is no longer exist
      When I click on edit assigned artists for second campaign
      Then assign artist modal is opened
      When I add another artist row
      And I select artist with name "Frank Sinatra" in #2 row
      Then I confirm assigned artists in modal
      Then toast after 2 artists has been assigned to edited campaign is present
      And assign artist modal is no longer exist

  Rule: User with app connections and Shopify access (set-1-6-app-conn-shopify)
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - App Connections
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_connect_ad_accounts

    @id_35c24323aaaa100ec42ed3822a8037e1f08fd8a596e23c5c61c3c3fd2f929514
    Scenario: User have access only to App connections including Shopify
      Given an orchard employee fansifter-set-1-6-app-conn-shopify visits fansifter
      And I log in
      Then I see "Search, My Roster, App Connections" navigation tab in Fansifter navbar
      And I don't see "Audiences, Ad Reporting, Emails, Email Campaigns, SMS Campaigns" navigation tabs in Fansifter navbar
      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" accounts in "Shopify" app connections table

  Rule: User with email campaigns view access (set-1-8-email-view)
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - Email Campaigns
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_view_email_campaigns

    Background: Login as fansifter-set-1-8-email-view
      Given an orchard employee fansifter-set-1-8-email-view visits fansifter
      Given I have Email Campaigns permissions:
        | Test Label | view |
      And I log in
      Then I see "Search, My Roster, Emails" navigation tab in Fansifter navbar
      And I don't see "Ad Reporting, Audiences, SMS Campaigns, App Connections" navigation tabs in Fansifter navbar

    @id_668bdbf30a31417ee71a7673781ae5e6d4b1ff90af63e7720b8f3bf062fd57a1
    Scenario: User with email view access should not have access to audiences and edit email campaigns
      When I visit Audiences page
      Then I see Not found error on a page
      When I visit New Audience page
      Then I see Not found error on a page
      When I visit Email Campaigns page
      Then I receive email campaigns data from backend
      Then 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

    @id_7f9cb2245ac87dff20dd13730b42cb5e3e5e72db87a80145d74f5c858801cf8c
    Scenario: User should have access to existing email campaigns for Test Label and should not have access to other labels
      When I visit Email Campaigns page
      Then I receive email campaigns data from backend
      When I show "Account" column for Email Campaigns table
      And I search for existing Email Campaign for "Test Label" account
      Then I receive email campaigns data from backend
      And I see only existing Email Campaign for "Test Label" account with view access
      When I open first "Test Label" Email Campaign from the table
      Then I see correct existing for "Test Label" account email campaign data on Email Overview page
      When I visit Email Campaigns page
      Then I receive email campaigns data from backend
      When I search for existing Email Campaign for "Columbia Records Group" account
      Then I receive email campaigns data from backend
      And I see no campaigns in Email Campaigns table

  Rule: User with sms view access (set-1-10-sms-view)
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - SMS Campaigns
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_view_sms_campaigns

    Background: Login as fansifter-set-1-10-sms-view
      Given an orchard employee fansifter-set-1-10-sms-view visits fansifter
      And I log in
      Then I see "Search, My Roster" navigation tab in Fansifter navbar
      And I don't see "Ad Reporting, Audiences, Emails, Email Campaigns, App Connections" navigation tabs in Fansifter navbar

    # SMS Campaigns still in development
    @id_112e32d265f679ee849e9aa7784c5149dcdb3985dda2dad0fad30e46006cd967
    Scenario: User with sms view access should not have access to sms audiences
      When I visit Audiences page without access
      Then I see Not found error on a page
      When I visit New Audience 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 Ad Reporting 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 email view, audiences, ad reporting access (set-1-12-ad-rep-ad-aud-email-view)
    User should have access to the following pages:
    - Search
    - Artist
    - My Roster
    - Audiences
    - Ad Reporting
    V2 Roles (Test Label):
    - fansifter_can_view_fan_data
    - fansifter_can_create_ad_reports
    - fansifter_can_share_ad_campaign_audiences
    - fansifter_can_view_email_campaigns

    Background: Login as fansifter-set-1-12-ad-rep-ad-aud-email-view
      Given an orchard employee fansifter-set-1-12-ad-rep-ad-aud-email-view visits fansifter
      And I log in
      Then I see "Search, My Roster, Audiences, Ad Reporting, Emails" navigation tab in Fansifter navbar
      And I don't see "SMS Campaigns, App Connections" navigation tabs in Fansifter navbar

    @cleanup-created-audience
    @id_a82d0bdc75a4e01be616b4c72ed1f28a9db62da85b98ac90fe9436223a507f60
    Scenario: User with share ad audience access should have access to audiences
      Given I have the audience data:
        | Account         | Test Label              |
        | Audience Use    | Advertising             |
        | Artists         | Wolfgang Amadeus Mozart |
        | Fan location    | Include, United States  |
        | Fan segment     | Include, Engaged Fans   |
        | Last engagement | Include, Past Year      |
      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 fill new audience data
      And I save 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 "Test Label (7123)" is selected for new audience and disabled
      And I select "Australia" location for new audience
      And I save updated audience
      Then audience is updated
      When I visit App Connections page without access
      Then I see Not found error on a page
