@insights
@insights_physical_reporting
Feature: Physical Reporting Summary

  @id_93bb8d3640e600ba664b04a86a27fbd2a14fd7b1a882bf56bb13bb38fb9250a1
  Scenario: Physical Reporting Summary - non-employee user sees auto-selected labels and data
    Given a user from multiaccount1 for insights
    And I log in
    When I navigate to the Physical Reporting page
    Then labels are auto selected in Physical Reporting Summary filter
    And I can see physical reporting summary data on the page
    And I can see Top Open Orders table on the page
    And I can see Top Yesterday Shipments table on the page
    And I can see Top MTD Shipments table on the page
    And I can see label/subaccount summary table on the page

  @id_ba7a21bb9a174a2e6afd1dd0a40b3471a85a1e39c2419e161712d6f9d767e158
  Scenario: Physical Reporting Summary - employee user must select labels
    Given a user from insightsemployee for insights
    And I log in
    When I navigate to the Physical Reporting page
    Then no labels are selected in Physical Reporting Summary filter
    And I can see "Select at least one label to view data" on the page

    When I search and select "22221" in Physical Reporting Summary filter
    Then I can see physical reporting summary data on the page
    And I should not see "Select at least one label to view data" on the page

  @id_bcdd1d418e1fd176f1267e070049e2bf5daecad3a8817797e65f67acc555586c
  Scenario: Physical Reporting Summary - empty state is shown when no labels are selected
    Given a user from multiaccount1 for insights
    And I log in
    When I navigate to the Physical Reporting page
    And I clear all selected labels in Physical Reporting Summary filter
    Then I can see "Select at least one label to view data" on the page
    And I should see no physical reporting summary rows on the page

  @id_8b5d926931e1d386bd05b110fbf7821e8deff74fc55acc5b1fe89dc0266935f0
  Scenario: Physical Reporting Summary - row can be expanded and collapsed
    Given a user from multiaccount1 for insights
    And I log in
    When I navigate to the Physical Reporting page
    Then physical reporting summary has at least 2 rows
    When I expand the first summary row
    Then I can see product detail rows for the expanded summary row

    When I collapse the first summary row
    Then I should not see product detail rows for that summary row

  @id_57a49b282081a02f85fef4f1b6f13f81fc8a54b0664eb1ba93c23e62019bc7bb
  Scenario: Physical Reporting Summary - expand all and collapse all rows
    Given a user from multiaccount1 for insights
    And I log in
    When I navigate to the Physical Reporting page
    Then physical reporting summary has at least 2 rows
    When I click expand all on the summary table
    Then all summary rows are expanded
    And product detail rows are loaded for expanded summary rows

    When I click collapse all on the summary table
    Then no summary rows are expanded

  @id_7a5c06d37519d25338aacb3a6e1748101173ec42b094795173d0166dcaea47e1
  Scenario: Physical Reporting Summary - auto expands when only one summary row exists
    Given a user from insightsemployee for insights
    And I log in
    When I navigate to the Physical Reporting page
    And I search and select "grand jury" in Physical Reporting Summary filter
    Then the only summary row is automatically expanded
    And I can see product detail rows for the expanded summary row

  @id_6163b9f4f199e3c1342921e5339cd03ea73ce6751228f27b0ee2d0974b70d94e
  Scenario: Physical Reporting Summary - selecting a label with no data shows no data available
    Given a user from insightsemployee for insights
    And I log in
    When I navigate to the Physical Reporting page
    And I search and select "33088" in Physical Reporting Summary filter
    Then tables show no data available on the page

  @id_9c22a55a17c24d029b8363d60a8bc381a3c4f948e8d9c2d3f75f48c1431a917c
  Scenario: Physical Reporting Summary - selecting and unselecting labels updates the summary table
    Given a user from insightsemployee for insights
    And I log in
    When I navigate to the Physical Reporting page
    And I search and select "22221" in Physical Reporting Summary filter
    And I search and select "8869" in Physical Reporting Summary filter
    And I search and select "25420" in Physical Reporting Summary filter
    Then the summary table contains label "Fat Possum"
    And the summary table contains label "Cleopatra Records"
    And the summary table contains label "Grand Jury"
    When I unselect "8869" in Physical Reporting Summary filter
    Then the summary table does not contain label "Cleopatra Records"
    And the summary table contains label "Fat Possum"
    And the summary table contains label "Grand Jury"
