#  AUT-930 Workstation accounting deprecation
@statement_attachments
@wip
Feature: Accounting Statement Attachments

  # ACC-756, ACC-885, ACC-759, ACC-760
  @frontend_accounting
  @ows_accounting
  @id_4683fcb07f68ff8ad97178529767db6b3150a88591ec9d3cc8a47b902f2f254c
  Scenario: User can see Statement Attachments for selected period
    Given an orchard employee label_7482 for workstation
    And I log in to workstation silently
    And I am on the accounting statements page
    Then the page should include Statement Attachments column
    When I click 'View' button of a period without Statement Attachments
    Then Statement Attachments page should be displayed with all appropriate fields

  # ACC-754
  @frontend_accounting
  @ows_accounting
  @id_68c512e8276379088b516a1271594c7f23633995358edf4171102795f6c6c13d
  Scenario: Subaccount user cannot see Statement Attachments column
    Given an orchard employee subaccount_1 for workstation
    And I log in to workstation silently
    And I am on the accounting-sub statements page
    Then the page should not include Statement Attachments column

  #   ACC-741, ACC-750, ACC-744
  @frontend_accounting
  @ows_accounting
  @id_abf3a2fc14111b74ae9e9141042720c4b11ea49e2a73736504365789f6d2c236
  Scenario Outline: User should not be able to upload files with invalid extensions
    Given an orchard employee label_7482 for workstation
    And I log in to workstation silently
    And I am on the accounting statements page
    When I click 'View' button for the last period
    And I upload a <file_type> file to S3 bucket for the selected period
    Then a new record should be created in statement_attachments_error table for <file_type> file
    And I refresh the page
    When I click 'View' button for the last period
    Then the file should not be displayed on the page

    Examples:
      | file_type |
      | WAV       |
      | ZIP       |
      | TXT       |

  # ACC-741, ACC-748
  @ows_accounting
  @frontend_accounting
  @id_b8b114aa9df35701f19739c74aff83263851fed7dc27cacf950d70c809fc6268
  Scenario Outline: User should not be able to upload a file with invalid name
    When I upload <file_name> file to to qa-statement-attachments S3 bucket directory
    Then a new record should be created in statement_attachments_error table for <file_name> file

    Examples:
      | file_name       |
      | L10303.pdf      |
      | LTEST_229.png   |
      | 229.xls         |
      | L10303_2229.doc |

  # ACC-867
  @frontend_accounting
  @ows_accounting
  @id_53bd33efdf945c791efeef2541fad0f2798fac842507dccebba766b84f3e8adb
  Scenario: Attachments file name should contain period id for quarterly label
    Given an orchard employee label_7482 for workstation
    And I log in to workstation silently
    And I am on the accounting statements page
    When I click 'View' button for the last period
    And I upload a PNG file to S3 bucket for the selected period
    Then a new record should be created in statement_attachments_success table for PNG file
    And I should see the file name with the selected period id
