From cb044e3115d054841f4a238190e832cfb939614b Mon Sep 17 00:00:00 2001 From: Destiny Date: Sun, 2 Aug 2020 22:11:42 +0200 Subject: [PATCH] Revert "[Behat] Remove js requirement for bulk delete scenarios" This reverts commit 4013e51dfdd3ff7d5bd00f2751308eac2bb3149a. --- .../managing_channels/deleting_multiple_channels.feature | 2 +- .../deleting_multiple_exchange_rates.feature | 2 +- .../deleting_multiple_payment_methods.feature | 2 +- .../deleting_multiple_product_attributes.feature | 2 +- .../deleting_multiple_product_options.feature | 2 +- .../deleting_multiple_product_reviews.feature | 2 +- .../deleting_multiple_product_variants.feature | 2 +- .../managing_products/deleting_multiple_products.feature | 2 +- .../managing_coupons/deleting_multiple_coupons.feature | 2 +- .../managing_promotions/deleting_multiple_promotions.feature | 2 +- .../deleting_multiple_shipping_categories.feature | 2 +- .../deleting_multiple_shipping_methods.feature | 2 +- .../deleting_multiple_tax_categories.feature | 2 +- .../managing_tax_rates/deleting_multiple_tax_rates.feature | 2 +- .../deleting_multiple_administrators.feature | 2 +- .../deleting_multiple_customer_groups.feature | 2 +- src/Sylius/Behat/Page/Admin/Crud/IndexPage.php | 5 +---- .../private/js/sylius-bulk-action-require-confirmation.js | 4 ++++ .../Bundle/UiBundle/Resources/views/Macro/buttons.html.twig | 2 +- .../Bundle/UiBundle/Resources/views/Macro/table.html.twig | 2 +- 20 files changed, 23 insertions(+), 22 deletions(-) diff --git a/features/channel/managing_channels/deleting_multiple_channels.feature b/features/channel/managing_channels/deleting_multiple_channels.feature index ef04742c0a..422ee1dc97 100644 --- a/features/channel/managing_channels/deleting_multiple_channels.feature +++ b/features/channel/managing_channels/deleting_multiple_channels.feature @@ -10,7 +10,7 @@ Feature: Deleting multiple channels And the store operates on another channel named "DE Store" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple channels at once When I browse channels And I check the "PL Store" channel diff --git a/features/currency/managing_exchange_rates/deleting_multiple_exchange_rates.feature b/features/currency/managing_exchange_rates/deleting_multiple_exchange_rates.feature index db816adaa4..fc05312589 100644 --- a/features/currency/managing_exchange_rates/deleting_multiple_exchange_rates.feature +++ b/features/currency/managing_exchange_rates/deleting_multiple_exchange_rates.feature @@ -11,7 +11,7 @@ Feature: Deleting multiple exchange rates And the exchange rate of "Polish Zloty" to "Euro" is 0.22 And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple exchange rates at once When I browse exchange rates And I check the exchange rate between "Euro" and "British Pound" diff --git a/features/payment/managing_payment_methods/deleting_multiple_payment_methods.feature b/features/payment/managing_payment_methods/deleting_multiple_payment_methods.feature index 180a42bb47..5cd5d6d72f 100644 --- a/features/payment/managing_payment_methods/deleting_multiple_payment_methods.feature +++ b/features/payment/managing_payment_methods/deleting_multiple_payment_methods.feature @@ -10,7 +10,7 @@ Feature: Deleting multiple payment methods And the store has also a payment method "PayPal Express Checkout" with a code "paypal" and Paypal Express Checkout gateway And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple payment methods at once When I browse payment methods And I check the "Offline" payment method diff --git a/features/product/managing_product_attributes/deleting_multiple_product_attributes.feature b/features/product/managing_product_attributes/deleting_multiple_product_attributes.feature index bf648890e8..1544fe8b98 100644 --- a/features/product/managing_product_attributes/deleting_multiple_product_attributes.feature +++ b/features/product/managing_product_attributes/deleting_multiple_product_attributes.feature @@ -10,7 +10,7 @@ Feature: Deleting multiple product attributes And the store has a integer product attribute "Pages" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple product attributes at once When I browse product attributes And I check the "Publisher" product attribute diff --git a/features/product/managing_product_options/deleting_multiple_product_options.feature b/features/product/managing_product_options/deleting_multiple_product_options.feature index f9b28e0285..77ac16a12e 100644 --- a/features/product/managing_product_options/deleting_multiple_product_options.feature +++ b/features/product/managing_product_options/deleting_multiple_product_options.feature @@ -10,7 +10,7 @@ Feature: Deleting multiple product options And the store has also a product option "T-Shirt brand" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple product options at once When I browse product options And I check the "T-Shirt size" product option diff --git a/features/product/managing_product_reviews/deleting_multiple_product_reviews.feature b/features/product/managing_product_reviews/deleting_multiple_product_reviews.feature index 9d8a4fe847..220b9de3f8 100644 --- a/features/product/managing_product_reviews/deleting_multiple_product_reviews.feature +++ b/features/product/managing_product_reviews/deleting_multiple_product_reviews.feature @@ -11,7 +11,7 @@ Feature: Deleting multiple product reviews And this product has also a review titled "Cool" and rated 4 with a comment "Quite cool" added by customer "aquaman@dc.com" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple product reviews at once When I browse product reviews And I check the "Awesome" product review diff --git a/features/product/managing_product_variants/deleting_multiple_product_variants.feature b/features/product/managing_product_variants/deleting_multiple_product_variants.feature index d18e3dfa45..dbda51bd62 100644 --- a/features/product/managing_product_variants/deleting_multiple_product_variants.feature +++ b/features/product/managing_product_variants/deleting_multiple_product_variants.feature @@ -10,7 +10,7 @@ Feature: Deleting multiple product variants And this product has "Small PHP Mug", "Medium PHP Mug" and "Big PHP Mug" variants And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple product variants at once When I browse variants of this product And I check the "Small PHP Mug" product variant diff --git a/features/product/managing_products/deleting_multiple_products.feature b/features/product/managing_products/deleting_multiple_products.feature index 5ce21db734..628d75453b 100644 --- a/features/product/managing_products/deleting_multiple_products.feature +++ b/features/product/managing_products/deleting_multiple_products.feature @@ -8,7 +8,7 @@ Feature: Deleting multiple products Given the store has "Audi RS5 model", "Audi RS6 model" and "Audi RS7 model" products And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple products at once When I browse products And I check the "Audi RS5 model" product diff --git a/features/promotion/managing_coupons/deleting_multiple_coupons.feature b/features/promotion/managing_coupons/deleting_multiple_coupons.feature index 5f58a1896c..7144c5669d 100644 --- a/features/promotion/managing_coupons/deleting_multiple_coupons.feature +++ b/features/promotion/managing_coupons/deleting_multiple_coupons.feature @@ -10,7 +10,7 @@ Feature: Deleting multiple coupons And this promotion has "SANTA1", "SANTA2" and "SANTA3" coupons And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple coupons at once When I browse coupons of this promotion And I check the "SANTA1" coupon diff --git a/features/promotion/managing_promotions/deleting_multiple_promotions.feature b/features/promotion/managing_promotions/deleting_multiple_promotions.feature index 464dd8e0b8..4ece0141ee 100644 --- a/features/promotion/managing_promotions/deleting_multiple_promotions.feature +++ b/features/promotion/managing_promotions/deleting_multiple_promotions.feature @@ -11,7 +11,7 @@ Feature: Deleting multiple promotions And there is also a promotion "Easter sale" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple promotions at once When I browse promotions And I check the "Christmas sale" promotion diff --git a/features/shipping/managing_shipping_categories/deleting_multiple_shipping_categories.feature b/features/shipping/managing_shipping_categories/deleting_multiple_shipping_categories.feature index 6b80162ee7..9acfe00401 100644 --- a/features/shipping/managing_shipping_categories/deleting_multiple_shipping_categories.feature +++ b/features/shipping/managing_shipping_categories/deleting_multiple_shipping_categories.feature @@ -9,7 +9,7 @@ Feature: Deleting multiple shipping categories And the store has "Big" and "Small" shipping category And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple shipping categories at once When I browse shipping categories And I check the "Big" shipping category diff --git a/features/shipping/managing_shipping_methods/deleting_multiple_shipping_methods.feature b/features/shipping/managing_shipping_methods/deleting_multiple_shipping_methods.feature index 6a627cbb5a..2d50667f61 100644 --- a/features/shipping/managing_shipping_methods/deleting_multiple_shipping_methods.feature +++ b/features/shipping/managing_shipping_methods/deleting_multiple_shipping_methods.feature @@ -9,7 +9,7 @@ Feature: Deleting multiple shipping methods And the store allows shipping with "UPS", "FedEx" and "DHL" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple shipping methods at once When I browse shipping methods And I check the "UPS" shipping method diff --git a/features/taxation/managing_tax_categories/deleting_multiple_tax_categories.feature b/features/taxation/managing_tax_categories/deleting_multiple_tax_categories.feature index c6e3df5ac2..4e69677b51 100644 --- a/features/taxation/managing_tax_categories/deleting_multiple_tax_categories.feature +++ b/features/taxation/managing_tax_categories/deleting_multiple_tax_categories.feature @@ -8,7 +8,7 @@ Feature: Deleting multiple tax categories Given the store has tax categories "Alcohol", "Food" and "Books" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple tax categories at once When I browse tax categories And I check the "Alcohol" tax category diff --git a/features/taxation/managing_tax_rates/deleting_multiple_tax_rates.feature b/features/taxation/managing_tax_rates/deleting_multiple_tax_rates.feature index c253319314..076da1a245 100644 --- a/features/taxation/managing_tax_rates/deleting_multiple_tax_rates.feature +++ b/features/taxation/managing_tax_rates/deleting_multiple_tax_rates.feature @@ -11,7 +11,7 @@ Feature: Deleting multiple tax rates And the store has "High VAT" tax rate of 40% for "Food" for the rest of the world And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple tax rates at once When I browse tax rates And I check the "Low VAT" tax rate diff --git a/features/user/managing_administrators/deleting_multiple_administrators.feature b/features/user/managing_administrators/deleting_multiple_administrators.feature index 112a12e70f..fe84b9fb56 100644 --- a/features/user/managing_administrators/deleting_multiple_administrators.feature +++ b/features/user/managing_administrators/deleting_multiple_administrators.feature @@ -10,7 +10,7 @@ Feature: Deleting multiple administrators And there is also an administrator "watermelon@example.com" And I am logged in as "watermelon@example.com" administrator - @ui + @ui @javascript Scenario: Deleting multiple administrators at once Given I browse administrators And I check the "banana@example.com" administrator diff --git a/features/user/managing_customer_groups/deleting_multiple_customer_groups.feature b/features/user/managing_customer_groups/deleting_multiple_customer_groups.feature index f5db85e099..8ba5b3d1a6 100644 --- a/features/user/managing_customer_groups/deleting_multiple_customer_groups.feature +++ b/features/user/managing_customer_groups/deleting_multiple_customer_groups.feature @@ -8,7 +8,7 @@ Feature: Deleting multiple customer groups Given the store has customer groups "Retail", "Wholesale" and "General" And I am logged in as an administrator - @ui + @ui @javascript Scenario: Deleting multiple customer groups at once When I browse customer groups And I check the "Retail" customer group diff --git a/src/Sylius/Behat/Page/Admin/Crud/IndexPage.php b/src/Sylius/Behat/Page/Admin/Crud/IndexPage.php index 82dda3e45f..d94dcaf596 100644 --- a/src/Sylius/Behat/Page/Admin/Crud/IndexPage.php +++ b/src/Sylius/Behat/Page/Admin/Crud/IndexPage.php @@ -13,7 +13,6 @@ declare(strict_types=1); namespace Sylius\Behat\Page\Admin\Crud; -use Behat\Mink\Driver\Selenium2Driver; use Behat\Mink\Element\NodeElement; use Behat\Mink\Exception\ElementNotFoundException; use Behat\Mink\Session; @@ -138,9 +137,7 @@ class IndexPage extends SymfonyPage implements IndexPageInterface public function bulkDelete(): void { $this->getElement('bulk_actions')->pressButton('Delete'); - if ($this->getDriver() instanceof Selenium2Driver || $this->getDriver() instanceof ChromeDriver) { - $this->getElement('confirmation_button')->click(); - } + $this->getElement('confirmation_button')->click(); } public function sort(string $order): void diff --git a/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-bulk-action-require-confirmation.js b/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-bulk-action-require-confirmation.js index adac5b8530..15be213182 100644 --- a/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-bulk-action-require-confirmation.js +++ b/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-bulk-action-require-confirmation.js @@ -27,6 +27,10 @@ $.fn.extend({ event.preventDefault(); const form = actionButton.closest('form'); + $('input.bulk-select-checkbox:checked').each((index, element) => { + $(``).appendTo(form); + }); + form.submit(); }); } diff --git a/src/Sylius/Bundle/UiBundle/Resources/views/Macro/buttons.html.twig b/src/Sylius/Bundle/UiBundle/Resources/views/Macro/buttons.html.twig index 2eb9d018d7..2f641eb0e1 100644 --- a/src/Sylius/Bundle/UiBundle/Resources/views/Macro/buttons.html.twig +++ b/src/Sylius/Bundle/UiBundle/Resources/views/Macro/buttons.html.twig @@ -62,7 +62,7 @@ {% endmacro %} {% macro bulkDelete(url, message, labeled = true) %} -
+