#  Please read this document for further details:
#  https://docs.google.com/document/d/1OM0MCR1Ajmmt5cIay08FyN-Hv23uC9VIFMnRNi8i3Iw/

@accounting-run
Feature: Accounting Run

  @id_56ef68fd5c06d009d4664b8f9c26270e15a918c3a2fc2ccbb784e0c89fc76104
  @abacus_accounting_run_setup
  Scenario: Accounting Run Calculations Are Correct
    Given an orchard employee accounting_run for abacus
    When I log in
    And I prepare the QA environment Accounting Run data
    When I define entities names for the Accounting Run
    And I navigate to accounting periods page
    Then I create a new accounting period
    And I open newly created accounting period
    And I get eligible sales
    And I mark all sales as Delivered
    And I approve the sales file
    And I prepare mechanical deductions
    And I initiate the Accounting Run
    Then The Accounting Run results match the expected values
      | contractId | contractTermId | termType |
      | 549169     | 85362          | label    |
      | 549497     | 85508          | label    |
      | 549497     | 85509          | product  |
      | 549202     | 85714          | track    |
    # TODO: mechanicals checks are broken due to test data drift, https://theorchard.atlassian.net/browse/AUT-1160
    #    And The mechanical deductions are correct for the contracts
    #      | contractId | payShare |
    #      | 549853     | customer |
    #      | 549852     | both     |
    #      | 549203     | business |
    And I approve the Accounting Run
    And I skip the run for remaining runcontrollers
    And I mark runs as complete
    Then I close the accounting period


# TODO: mechanicals checks are broken due to test data drift, https://theorchard.atlassian.net/browse/AUT-1160
# And I assert the mechanical deductions values in the publishing escrow table