Files
perauset-e2e-mrfzphpz/e2e/tests/features/inventory.feature
2026-07-11 08:35:02 +02:00

78 lines
3.8 KiB
Gherkin

Feature: Inventory Management
Scenario: Create inventory item as admin
Given I login as "admin@perauset.org"
When I create an inventory item "Rice" with unit "kg" quantity 100 and minimum 10
Then the response status should be 200
And the response body field "name" should be "Rice"
And the response body field "unit" should be "kg"
And the response body field "isActive" should be truthy
And I store the response field "itemId" as "itemId"
Scenario: Update inventory item as admin
Given I login as "admin@perauset.org"
When I create an inventory item "Flour" with unit "kg" quantity 50 and minimum 5
Then the response status should be 200
And I store the response field "itemId" as "itemId"
When I update the inventory item with name "Whole Wheat Flour"
Then the response status should be 200
And the response body field "name" should be "Whole Wheat Flour"
Scenario: List inventory items
Given I login as "admin@perauset.org"
When I create an inventory item "Olive Oil" with unit "liters" quantity 20 and minimum 5
Then the response status should be 200
When I list inventory items
Then the response status should be 200
And the response body field "items" should be truthy
Scenario: Request inventory item as community member
Given I login as "admin@perauset.org"
When I create an inventory item "Sugar" with unit "kg" quantity 30 and minimum 5
Then the response status should be 200
And I store the response field "itemId" as "itemId"
Given a user "member@test.org" exists with roles "community_member"
And I login as "member@test.org"
When I request inventory for item with quantity 5 unit "kg" and purpose "Baking"
Then the response status should be 200
And the response body field "status" should be "submitted"
And I store the response field "requestId" as "requestId"
Scenario: Review inventory request as admin
Given I login as "admin@perauset.org"
When I create an inventory item "Salt" with unit "kg" quantity 20 and minimum 2
Then the response status should be 200
And I store the response field "itemId" as "itemId"
Given a user "member@test.org" exists with roles "community_member"
And I login as "member@test.org"
When I request inventory for item with quantity 3 unit "kg" and purpose "Cooking"
Then the response status should be 200
And I store the response field "requestId" as "requestId"
Given I login as "admin@perauset.org"
When I review the inventory request with status "approved"
Then the response status should be 200
And the response body field "status" should be "approved"
Scenario: Fulfill inventory request as admin
Given I login as "admin@perauset.org"
When I create an inventory item "Pepper" with unit "kg" quantity 15 and minimum 2
Then the response status should be 200
And I store the response field "itemId" as "itemId"
Given a user "member@test.org" exists with roles "community_member"
And I login as "member@test.org"
When I request inventory for item with quantity 2 unit "kg" and purpose "Seasoning"
Then the response status should be 200
And I store the response field "requestId" as "requestId"
Given I login as "admin@perauset.org"
When I review the inventory request with status "approved"
Then the response status should be 200
When I fulfill the inventory request
Then the response status should be 200
And the response body field "status" should be "fulfilled"
Scenario: Unpermissioned user cannot create inventory items
Given a user "guest@test.org" exists with roles "guest"
And I login as "guest@test.org"
When I create an inventory item "Forbidden Item" with unit "kg" quantity 10 and minimum 1
Then the response status should be 403