@deprecated
@fansifter
@email-campaigns
Feature: Email Campaigns

  @FS-4061
  @id_a1df06211b950c83945f1b45834d9e31da0c7b5faab74080ef5d583e6dc76b4a
  Scenario: Email Campaign
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have Email Campaigns permissions:
      | Test Label             | create |
      | Columbia Records Group | create |
    And I have authorized local storage for fansifter
    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 "Test Label, Columbia Records Group" 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

  @FS-4062
  @ows_dmp
  @cleanup-created-email-campaign
  @id_d7cce9b3d7510d8acb6c8b39dc460cc54c68c2538090c1b8a1783194300a0627
  Scenario: Create Email Campaign for Artist
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have email campaign data:
      | Account | Test Label (7123)       |
      | Artist  | Wolfgang Amadeus Mozart |
    And I have authorized local storage for fansifter
    When I visit Email Campaigns page
    Then I receive email campaigns data from backend
    And I see valid Email Campaigns page with create access
    And I see correct data table on Email Campaigns page
    When I create Email Campaign with data
    Then I see correct email campaign data on Email Overview page

  @FS-4098
  @cleanup-created-email-campaign
  @id_d06cb020a5414020c47efac7ecea00b70164fcb9df90ac57cdc26afb8fceb5c6
  Scenario: Create Email Campaign for Artist List
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have email campaign data:
      | Account | Test Label (7123) |
      | List    | Warped Tour       |
    And I have authorized local storage for fansifter
    When I visit Email Campaigns page
    Then I see valid Email Campaigns page with create access
    When I create Email Campaign with data
    Then I see correct email campaign data on Email Overview page

  @FS-4820
  @ows_dmp
  @cleanup-created-email-campaign
  @cleanup-duplicated-email-campaign
  @id_ea57eb94457265cccb6d858ad20b9a3326212218a6ae62d83a5a330d259dbedd
  Scenario: Duplicate Email Campaign
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have email campaign data:
      | Account | Test Label (7123)       |
      | Artist  | Wolfgang Amadeus Mozart |
    And I have authorized local storage for fansifter
    When I visit Email Campaigns page
    Then I see valid Email Campaigns page with create access
    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:
      | Subject      | Original Subject      |
      | Preview Text | Original Preview Text |
      | Sender Name  | Original 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
    Then I see correct email campaign data on Email Overview page

  @FS-5026
  @id_461a47e66822864062c4987f10d350bc4507adc5227b2cf21997859ce3ce632f
  Scenario: [Email Campaigns] Privacy footer block should be required to send email campaign
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have email campaign data:
      | Account | Test Label (7123)       |
      | Artist  | Wolfgang Amadeus Mozart |
    And I have authorized local storage for fansifter
    When I visit Email Campaigns page
    Then I receive email campaigns data from backend
    And I see valid Email Campaigns page with create access
    And I see correct data table on Email Campaigns page
    When I create Email Campaign with data
    Then I see correct email campaign data on Email Overview page
    When I open Edit Design modal
    And I delete Email Campaign privacy block
    And I try to send test email from edit design modal
    Then I see error toast about missing privacy block
    When I save edited email design
    Then I see alert about missing privacy block
    When I try to schedule or send email campaign
    Then I see error toast about missing privacy block
    When I open Edit Design modal
    And I add privacy block to email design
    And I save edited email design
    Then I don't see alert about missing privacy block

  @cleanup-created-email-campaign
  @FS-5069
  @id_1cc6074d1ce59eafa02394efa0c40e5f7d3f56156bc88dde7ed9fce571ed4b17
  Scenario: [Email Campaigns] Edit email campaign design
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have email campaign data:
      | Account | Test Label (7123)       |
      | Artist  | Wolfgang Amadeus Mozart |
    And I have authorized local storage for fansifter
    When I visit Email Campaigns page
    Then I receive email campaigns data from backend
    And I see valid Email Campaigns page with create access
    And I see correct data table on Email Campaigns page
    When I create Email Campaign with data
    Then I see correct email campaign data on Email Overview page
    When I open Edit Design modal
    And I add button to email design
    And I edit button in email design
    And I add text block to email design
    And I edit added text block and make it visible only on mobile device
    And I save edited email design
    Then I can see edited button in Email Campaign preview
    And I can see text block visible only in mobile preview

  @FS-5091
  @id_efe882f2a9b6b0b962970c4cab63432f11d3c554ea932986ff65982fe1cbdef5
  Scenario: Send Test Email Campaign and Verify Content
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have email campaign data:
      | Account | Test Label (7123)       |
      | Artist  | Wolfgang Amadeus Mozart |
    And I have authorized local storage for fansifter
    And I alias the current timestamp in seconds
    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 create Email Campaign with data
    Then I see correct email campaign data on Email Overview page
    When I edit Email Campaign Details with unique subject
    Then I see correct email campaign data on Email Overview page
    When I open Edit Design modal
    And I add text block to email design
    And I edit added text block with test content
    And I save edited email design
    When I send test email to generated address
    And I visit Email Campaigns page
    And I delete created Email Campaign
    Then I receive test email with correct subject and content

  @FS-5149
  @id_2a985b1bcbb0a915c40b1ed7bbbe0c9265c58b9f0736410fb1f66e1463d47abe
  Scenario: [Email Campaigns] Analytics page verification
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    When I visit Email Campaign Analytics page for campaign "8a4cfe46-f3ba-4d8e-81ae-582d0fa375a8"
    Then I try to log in to fansifter
    When I receive email campaign analytics data from backend
    Then all elements on email campaign analytics page are present
    And I see correct data on email campaign analytics page

  @FS-5277
  @cleanup-created-email-campaign
  @id_b7305b27ef567e749ec73684b89ce9002b166870be02036f17db9c051d4ee8a8
  Scenario: [Email Campaign] Schedule/Reschedule/Unschedule email campaign
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have email campaign data:
      | Account | Test Label (7123)       |
      | Artist  | Wolfgang Amadeus Mozart |
    And I have authorized local storage for fansifter
    When I visit Email Campaigns page
    And I create Email Campaign with data
    Then I see correct email campaign data on Email Overview page

    # Test validation error - try to schedule without required details
    When I try to schedule or send email campaign
    Then I see schedule validation alert

    # Add required details and verify alert disappears
    When I edit Email Campaign Details with data:
      | Subject      | Test Subject                        |
      | Preview Text | Test Preview Text                   |
      | Audience     | AUTO_TEST_LABEL_EMAIL_DO_NOT_DELETE |
    Then I see correct email campaign data on Email Overview page
    And I don't see schedule validation alert

    # Schedule campaign successfully
    When I schedule email campaign for future date
    Then I see campaign status changed to "Scheduled"
    And I see campaign edit buttons show unschedule modal when scheduled

    # Reschedule the campaign
    When I reschedule email campaign to future date
    Then I see campaign status changed to "Scheduled"

    # Unschedule back to draft
    When I unschedule email campaign
    Then I see campaign status changed to "Draft"

    # Schedule campaign again
    When I schedule email campaign for future date
    Then I see campaign status changed to "Scheduled"

    # Unschedule via edit button modal
    When I unschedule email campaign via edit button modal
    Then I see campaign status changed to "Draft"

  @FS-5291
  @id_dd2db5a3dd8cd768457674d84d6703edc5eaedf2015ba978da81c5613bb61005
  Scenario Outline: [Email Campaign] Send Now complete workflow - <Account>
    Given an orchard employee fansifter-set-2-12-ophiuchus for fansifter
    Given I have email campaign data:
      | Account | <Account> |
      | Artist  | <Artist>  |
    And I have authorized local storage for fansifter
    When I visit Email Campaigns page
    And 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:
      | Subject      | Test Send Now Subject #automationtest |
      | Preview Text | Test Send Now Preview Text            |
      | Audience     | <Audience>                            |
    Then I see correct email campaign data on Email Overview page
    And I don't see schedule validation alert
    When I send email campaign now
    Then I see send now confirmation for "<Audience>" audience with any recipients
    When I confirm send now action
    Then I wait for campaign to be sent
    And I see campaign status changed to "Sent"

    Examples:
      | Account                | Artist                  | Audience                                                       |
      | Test Label (7123)      | Wolfgang Amadeus Mozart | Email Campaign: yuliia.dytyniak.sme@sonymusic-pde.com          |
      | Columbia Records Group | 44phantom               | Email Campaign Columbia: yuliia.dytyniak.sme@sonymusic-pde.com |

  @cleanup-created-email-campaign
  @id_1a1c2bb5f7efb123714d1e51764e8bd404d55746041d070fdfa0db64924c6f01
  Scenario: Email preview with browser link
    Given an orchard employee fansifter-e2e-7123-34514 for fansifter
    Given I have email campaign data:
      | Account | Test Label (7123)       |
      | Artist  | Wolfgang Amadeus Mozart |
    And I have authorized local storage for fansifter
    And I alias the current timestamp in seconds
    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 create Email Campaign with data
    Then I see correct email campaign data on Email Overview page
    When I open Edit Design modal
    And I add text block to email design
    And I edit added text block with test content
    And I save edited email design
    When I select "View in Browser" test option on email campaign page
    Then I see email preview with correct content
    When I use my browser's back button
    When I open Edit Design modal
    And I add text block to email design
    And I edit added text block with test content
    And I save edited email design
    When I select "View in Browser" test option on email campaign page
    Then I see email preview with correct content
