diff --git a/features/shop/cart/viewing_total_quantity_of_the_cart.feature b/features/shop/cart/viewing_total_quantity_of_the_cart.feature index 18f414a134..4020410739 100644 --- a/features/shop/cart/viewing_total_quantity_of_the_cart.feature +++ b/features/shop/cart/viewing_total_quantity_of_the_cart.feature @@ -10,17 +10,17 @@ Feature: Viewing a total quantity of the cart And the store has a product "Sylius T-Shirt" And the store has a product "Symfony T-Shirt" - @no-api @todo-ui + @no-api @ui @javascript Scenario: Viewing a total quantity for 1 product with quantity equals 1 When I add product "PHP T-Shirt" to the cart Then I should see cart total quantity is 1 - @no-api @todo-ui + @no-api @ui @javascript Scenario: Viewing a total quantity for 1 product with quantity equals 2 When I add 2 products "PHP T-Shirt" to the cart Then I should see cart total quantity is 2 - @no-api @todo-ui + @no-api @ui @javascript Scenario: Viewing a total quantity for 3 products with various quantities When I add 2 products "PHP T-Shirt" to the cart And I add 3 products "Sylius T-Shirt" to the cart diff --git a/src/Sylius/Behat/Element/Shop/CartWidgetElement.php b/src/Sylius/Behat/Element/Shop/CartWidgetElement.php index 4a502add4a..7089c762fd 100644 --- a/src/Sylius/Behat/Element/Shop/CartWidgetElement.php +++ b/src/Sylius/Behat/Element/Shop/CartWidgetElement.php @@ -19,10 +19,9 @@ final class CartWidgetElement extends Element implements CartWidgetElementInterf { public function getCartTotalQuantity(): int { - $cartTotal = $this->getElement('cart_button')->getText(); - preg_match('/.+,\s(\d+)\s(items|item)/', $cartTotal, $parts); + $quantity = $this->getElement('cart_button')->getText(); - return (int) ($parts[1] ?? 0); + return (int) ($quantity ?? 0); } protected function getDefinedElements(): array