mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
[Admin][Product][Inventory] Enable behat tests
This commit is contained in:
parent
8b6d2b1e0a
commit
32fcf432a2
15 changed files with 34 additions and 39 deletions
|
|
@ -14,7 +14,7 @@ Feature: Holding inventory units during checkout
|
|||
And there is a customer "sylius@example.com" that placed an order "#00000022"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Holding inventory units
|
||||
Given the customer bought 3 "Iron Maiden T-Shirt" products
|
||||
And the customer chose "Free" shipping method to "United States" with "Offline" payment
|
||||
|
|
@ -22,7 +22,7 @@ Feature: Holding inventory units during checkout
|
|||
Then 3 units of this product should be on hold
|
||||
And 5 units of this product should be on hand
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Release hold units after order has been paid
|
||||
Given the customer bought 3 "Iron Maiden T-Shirt" products
|
||||
And the customer chose "Free" shipping method to "United States" with "Offline" payment
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ Feature: Displaying inventory tab on simple product edit page
|
|||
And the store has a "PHP T-Shirt" configurable product
|
||||
And I am logged in as an administrator
|
||||
|
||||
@todo @ui @no-api
|
||||
@ui @no-api
|
||||
Scenario: Seeing inventory on simple product edit page
|
||||
When I want to modify the "PHP Mug" product
|
||||
Then I should see inventory of this product
|
||||
|
||||
@todo @ui @no-api
|
||||
@ui @no-api
|
||||
Scenario: Not seeing inventory on configurable product edit page
|
||||
When I want to modify the "PHP T-Shirt" product
|
||||
Then I should not see inventory of this product
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Feature: Validation of decreasing inventory below on hold validation
|
|||
And the customer chose "Free" shipping method to "United States" with "Cash on Delivery" payment
|
||||
And I am logged in as an administrator
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Decreasing inventory when order was placed
|
||||
When I want to modify the "Wyborowa Vodka Exquisite" product variant
|
||||
And I change its quantity of inventory to 2
|
||||
|
|
@ -25,7 +25,7 @@ Feature: Validation of decreasing inventory below on hold validation
|
|||
Then I should be notified that on hand quantity must be greater than the number of on hold units
|
||||
And this variant should have a 5 item currently in stock
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Decreasing inventory when order was cancelled
|
||||
Given the order "#00000023" was cancelled
|
||||
When I want to modify the "Wyborowa Vodka Exquisite" product variant
|
||||
|
|
@ -34,7 +34,7 @@ Feature: Validation of decreasing inventory below on hold validation
|
|||
Then I should be notified that it has been successfully edited
|
||||
And this variant should have a 2 item currently in stock
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Decreasing inventory when order was paid
|
||||
Given the order "#00000023" is already paid
|
||||
When I want to modify the "Wyborowa Vodka Exquisite" product variant
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Feature: Inventory releasing on order cancellation
|
|||
And the store allows paying with "Cash on Delivery"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Verify the reserved inventory is back in stock after cancellation of a new order
|
||||
Given there is a customer "john.doe@gmail.com" that placed an order "#00000022"
|
||||
And the customer bought 3 units of "Green" variant of product "T-Shirt banana"
|
||||
|
|
@ -28,7 +28,7 @@ Feature: Inventory releasing on order cancellation
|
|||
Then the variant "Green" should have 5 items on hand
|
||||
And the "Green" variant should have 0 items on hold
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Verify the reserved inventory and quantity of product's items is back in stock after cancellation of paid order
|
||||
Given there is a customer "john.doe@gmail.com" that placed an order "#00000022"
|
||||
And the customer bought 3 units of "Green" variant of product "T-Shirt banana"
|
||||
|
|
@ -39,7 +39,7 @@ Feature: Inventory releasing on order cancellation
|
|||
Then the variant "Green" should have 5 items on hand
|
||||
And the "Green" variant should have 0 items on hold
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Verify the reserved inventory is back in stock after cancellation of a new order with two variants of product
|
||||
Given there is a customer "john.doe@gmail.com" that placed an order "#00000023"
|
||||
And the customer bought 3 units of "Green" variant of product "T-Shirt banana"
|
||||
|
|
@ -52,7 +52,7 @@ Feature: Inventory releasing on order cancellation
|
|||
And the variant "Red" should have 5 items on hand
|
||||
And the "Red" variant should have 0 items on hold
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Verify the reserved inventory and quantity of product's items is back in stock after cancellation of paid order with two variants of product
|
||||
Given there is a customer "john.doe@gmail.com" that placed an order "#00000023"
|
||||
And the customer bought 3 units of "Green" variant of product "T-Shirt banana"
|
||||
|
|
@ -66,7 +66,7 @@ Feature: Inventory releasing on order cancellation
|
|||
And the variant "Red" should have 5 items on hand
|
||||
And the "Red" variant should have 0 items on hold
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Verify the reserved inventory is back in stock after cancellation of a new order with two variants of different products
|
||||
Given there is a customer "john.doe@gmail.com" that placed an order "#00000024"
|
||||
And the customer bought 3 units of "Green" variant of product "T-Shirt banana"
|
||||
|
|
@ -78,7 +78,7 @@ Feature: Inventory releasing on order cancellation
|
|||
And the "Yellow" variant of "Skirt watermelon" product should have 5 items on hand
|
||||
And the "Yellow" variant of "Skirt watermelon" product should have 0 items on hold
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Verify the reserved inventory and quantity of product's items is back in stock after cancellation of paid order with two variants of different products
|
||||
Given there is a customer "john.doe@gmail.com" that placed an order "#00000024"
|
||||
And the customer bought 3 units of "Green" variant of product "T-Shirt banana"
|
||||
|
|
@ -91,7 +91,7 @@ Feature: Inventory releasing on order cancellation
|
|||
And the "Yellow" variant of "Skirt watermelon" product should have 5 items on hand
|
||||
And the "Yellow" variant of "Skirt watermelon" product should have 0 items on hold
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Verify the reserved inventory and quantity of product's items is back in stock after cancellation of a refunded order
|
||||
Given there is a customer "john.doe@gmail.com" that placed an order "#00000022"
|
||||
And the customer bought 3 units of "Green" variant of product "T-Shirt banana"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Feature: Seeing product's variant with specify quantity of items on hand
|
|||
And the store allows paying with "Cash on Delivery"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Seeing decreased quantity of product's items in selected variant after order payment
|
||||
Given there is a customer "lucy@teamlucifer.com" that placed an order "#00000666"
|
||||
And the customer bought 3 units of "Green" variant of product "T-Shirt banana"
|
||||
|
|
@ -25,7 +25,7 @@ Feature: Seeing product's variant with specify quantity of items on hand
|
|||
When I view all variants of the product "T-Shirt banana"
|
||||
Then the variant "Green" should have 2 items on hand
|
||||
|
||||
@todo @ui @api
|
||||
@ui @api
|
||||
Scenario: Seeing decreased quantity of product's items from different variants after order payment
|
||||
Given there is a customer "lucy@teamlucifer.com" that placed an order "#00000666"
|
||||
And the customer bought 3 units of "Yellow" variant of product "T-Shirt banana"
|
||||
|
|
|
|||
|
|
@ -133,24 +133,24 @@ final class BrowsingProductVariantsContext implements Context
|
|||
/**
|
||||
* @Then /^the variant "([^"]+)" should have (\d+) items on hand$/
|
||||
*/
|
||||
public function thisVariantShouldHaveItemsOnHand($productVariantName, $quantity)
|
||||
public function thisVariantShouldHaveItemsOnHand($productVariantName, $quantity): void
|
||||
{
|
||||
Assert::true($this->indexPage->isSingleResourceWithSpecificElementOnPage(
|
||||
['name' => $productVariantName],
|
||||
sprintf('td > div.ui.label:contains("%s")', $quantity),
|
||||
sprintf('[data-test-on-hand]:contains("%s")', $quantity),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the "([^"]+)" variant of ("[^"]+" product) should have (\d+) items on hand$/
|
||||
*/
|
||||
public function theVariantOfProductShouldHaveItemsOnHand($productVariantName, ProductInterface $product, $quantity)
|
||||
public function theVariantOfProductShouldHaveItemsOnHand($productVariantName, ProductInterface $product, $quantity): void
|
||||
{
|
||||
$this->indexPage->open(['productId' => $product->getId()]);
|
||||
|
||||
Assert::true($this->indexPage->isSingleResourceWithSpecificElementOnPage(
|
||||
['name' => $productVariantName],
|
||||
sprintf('td > div.ui.label:contains("%s")', $quantity),
|
||||
sprintf('[data-test-on-hand]:contains("%s")', $quantity),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1288,7 +1288,7 @@ final class ManagingProductsContext implements Context
|
|||
*/
|
||||
public function iShouldSeeInventoryOfThisProduct(): void
|
||||
{
|
||||
Assert::true($this->updateSimpleProductPage->hasInventoryTab());
|
||||
Assert::true($this->updateSimpleProductPage->hasTab('inventory'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1296,7 +1296,7 @@ final class ManagingProductsContext implements Context
|
|||
*/
|
||||
public function iShouldNotSeeInventoryOfThisProduct(): void
|
||||
{
|
||||
Assert::false($this->updateConfigurableProductPage->hasInventoryTab());
|
||||
Assert::false($this->updateConfigurableProductPage->hasTab('inventory'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -118,6 +118,11 @@ trait FormTrait
|
|||
$this->autocompleteHelper->selectByName($this->getDriver(), $productOptionsAutocomplete->getXpath(), $optionName);
|
||||
}
|
||||
|
||||
public function hasTab(string $name): bool
|
||||
{
|
||||
return $this->hasElement('side_navigation_tab', ['%name%' => $name]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tabs management
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -136,11 +136,6 @@ class UpdateConfigurableProductPage extends BaseUpdatePage implements UpdateConf
|
|||
$this->getDocument()->clickLink('Generate');
|
||||
}
|
||||
|
||||
public function hasInventoryTab(): bool
|
||||
{
|
||||
return null !== $this->getDocument()->find('css', '.tab > h3:contains("Inventory")');
|
||||
}
|
||||
|
||||
protected function getCodeElement(): NodeElement
|
||||
{
|
||||
return $this->getElement('code');
|
||||
|
|
|
|||
|
|
@ -63,5 +63,5 @@ interface UpdateConfigurableProductPageInterface extends UpdatePageInterface
|
|||
|
||||
public function goToVariantGeneration(): void;
|
||||
|
||||
public function hasInventoryTab(): bool;
|
||||
public function hasTab(string $name): bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,11 +283,6 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd
|
|||
$this->getDocument()->clickLink('Generate');
|
||||
}
|
||||
|
||||
public function hasInventoryTab(): bool
|
||||
{
|
||||
return null !== $this->getDocument()->find('css', '.tab > h3:contains("Inventory")');
|
||||
}
|
||||
|
||||
public function getShowProductInSingleChannelUrl(): string
|
||||
{
|
||||
return $this->getElement('show_product_single_button')->getAttribute('href');
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ interface UpdateSimpleProductPageInterface extends BaseUpdatePageInterface
|
|||
|
||||
public function goToVariantGeneration(): void;
|
||||
|
||||
public function hasInventoryTab(): bool;
|
||||
public function hasTab(string $name): bool;
|
||||
|
||||
public function getShowProductInSingleChannelUrl(): string;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
|||
protected function getDefinedElements(): array
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
'on_hand_quantity' => '.onHand[data-product-variant-id="%id%"]',
|
||||
'on_hold_quantity' => '.onHold[data-product-variant-id="%id%"]',
|
||||
'on_hand_quantity' => '[data-test-on-hand][data-product-variant-id="%id%"]',
|
||||
'on_hold_quantity' => '[data-test-on-hold][data-product-variant-id="%id%"]',
|
||||
'save_configuration_button' => '[data-test-save-configuration-button]',
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
default:
|
||||
suites:
|
||||
ui_managing_inventory:
|
||||
ui_inventory_on_product_page:
|
||||
contexts:
|
||||
- sylius.behat.context.hook.doctrine_orm
|
||||
- sylius.behat.context.hook.session
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{% if data.isTracked %}
|
||||
<span class="onHand" data-product-variant-id="{{ data.id }}">{{ data.onHand }}</span> {{ 'sylius.ui.available_on_hand'|trans }}
|
||||
<span class="onHand" data-product-variant-id="{{ data.id }}" {{ sylius_test_html_attribute('on-hand') }}>{{ data.onHand }}</span> {{ 'sylius.ui.available_on_hand'|trans }}
|
||||
{% if data.onHold > 0 %}
|
||||
<span class="onHold" data-product-variant-id="{{ data.id }}">{{ data.onHold }}</span> {{ 'sylius.ui.reserved'|trans }}
|
||||
<span class="onHold" data-product-variant-id="{{ data.id }}" {{ sylius_test_html_attribute('on-hold') }}>{{ data.onHold }}</span> {{ 'sylius.ui.reserved'|trans }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ 'sylius.ui.not_tracked'|trans }}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue