From 63d886137daa2e3ded7bd20642f4040b54907126 Mon Sep 17 00:00:00 2001 From: Wojdylak Date: Thu, 26 Sep 2024 15:09:43 +0200 Subject: [PATCH 1/4] Enable behat test for placing orders as impersonated shop users --- features/admin/placing_order_as_impersonated_shop_users.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/admin/placing_order_as_impersonated_shop_users.feature b/features/admin/placing_order_as_impersonated_shop_users.feature index 680c955a2a..b37de9aa68 100644 --- a/features/admin/placing_order_as_impersonated_shop_users.feature +++ b/features/admin/placing_order_as_impersonated_shop_users.feature @@ -24,7 +24,7 @@ Feature: Placing an order as impersonated shop users And I browse orders of a customer "tanith.low@london.uk" Then I should see a single order in the list - @no-api @todo-ui + @no-api @ui @mink:chromedriver Scenario: Placing an order as an impersonated shop user when the shop user was already logged When I sign in with email "john.doe@london.uk" and password "johndoe" And I view details of the customer "tanith.low@london.uk" From 1659159c1b152f34909b8f9149fc0e1badfaff90 Mon Sep 17 00:00:00 2001 From: Wojdylak Date: Thu, 26 Sep 2024 15:10:08 +0200 Subject: [PATCH 2/4] Enable behat test for picking up cart created in ui and the api --- .../continuing_cart_processing_from_ui_in_api.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/shop/cart/shopping_cart/continuing_cart_processing_from_ui_in_api.feature b/features/shop/cart/shopping_cart/continuing_cart_processing_from_ui_in_api.feature index 28f6ba455d..94c0677c34 100644 --- a/features/shop/cart/shopping_cart/continuing_cart_processing_from_ui_in_api.feature +++ b/features/shop/cart/shopping_cart/continuing_cart_processing_from_ui_in_api.feature @@ -9,7 +9,7 @@ Feature: Continuing to process the cart picked up in the web store, in the API And the store has a product "Apple's Polishing Cloth" And I am a logged in customer on the web store and in the API - @todo-hybrid @javascript + @hybrid @javascript Scenario: Picking up the shopping cart on the web store and resuming it using API When I add "Apple's Polishing Cloth" to the cart on the web store And I check items in my cart using API From 32c0a3b85a3a2c782feb850ec77e7a2a23adf555 Mon Sep 17 00:00:00 2001 From: Wojdylak Date: Fri, 27 Sep 2024 09:20:34 +0200 Subject: [PATCH 3/4] Enable hybrid suit with javascript tag in actions --- .github/workflows/ci_e2e-custom.yaml | 4 ++-- .github/workflows/ci_e2e-mariadb.yaml | 4 ++-- .github/workflows/ci_e2e-mysql.yaml | 8 ++++---- .github/workflows/ci_e2e-pgsql.yaml | 4 ++-- .github/workflows/ci_e2e-unstable.yaml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci_e2e-custom.yaml b/.github/workflows/ci_e2e-custom.yaml index c153f4ea8a..cbdea86333 100644 --- a/.github/workflows/ci_e2e-custom.yaml +++ b/.github/workflows/ci_e2e-custom.yaml @@ -104,10 +104,10 @@ jobs: run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" --rerun - name: Run non-UI Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain" --rerun - name: Run non-JS Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" --rerun - name: Upload logs uses: actions/upload-artifact@v3 diff --git a/.github/workflows/ci_e2e-mariadb.yaml b/.github/workflows/ci_e2e-mariadb.yaml index e306836b55..18b76da8c7 100644 --- a/.github/workflows/ci_e2e-mariadb.yaml +++ b/.github/workflows/ci_e2e-mariadb.yaml @@ -109,10 +109,10 @@ jobs: run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" --rerun - name: Run non-UI Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain" --rerun - name: Run non-JS Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" --rerun - name: Upload logs uses: actions/upload-artifact@v3 diff --git a/.github/workflows/ci_e2e-mysql.yaml b/.github/workflows/ci_e2e-mysql.yaml index 7396192264..cd7f9e09e9 100644 --- a/.github/workflows/ci_e2e-mysql.yaml +++ b/.github/workflows/ci_e2e-mysql.yaml @@ -114,10 +114,10 @@ jobs: run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" --rerun - name: Run non-UI Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain" --rerun - name: Run non-JS Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" --rerun - name: Upload logs uses: actions/upload-artifact@v3 @@ -195,7 +195,7 @@ jobs: chrome_version: stable - name: Run Behat (Chromedriver) - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" --rerun || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" --rerun - name: Upload logs uses: actions/upload-artifact@v3 @@ -276,7 +276,7 @@ jobs: run: vendor/bin/bdi detect drivers - name: Run Behat (Panther) - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@ui" --rerun || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@ui" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" --rerun || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" --rerun - name: Upload logs uses: actions/upload-artifact@v3 diff --git a/.github/workflows/ci_e2e-pgsql.yaml b/.github/workflows/ci_e2e-pgsql.yaml index bac0f78632..a138b0cc03 100644 --- a/.github/workflows/ci_e2e-pgsql.yaml +++ b/.github/workflows/ci_e2e-pgsql.yaml @@ -108,10 +108,10 @@ jobs: run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" --rerun - name: Run non-UI Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli&&~@no-postgres" --suite-tags="@api,@domain,@hybrid" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli&&~@no-postgres" --suite-tags="@api,@domain,@hybrid" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli&&~@no-postgres" --suite-tags="@api,@domain" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli&&~@no-postgres" --suite-tags="@api,@domain" --rerun - name: Run non-JS Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli&&~@no-postgres" --suite-tags="@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli&&~@no-postgres" --suite-tags="@ui" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli&&~@no-postgres" --suite-tags="@hybrid,@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli&&~@no-postgres" --suite-tags="@hybrid,@ui" --rerun - name: Upload logs uses: actions/upload-artifact@v3 diff --git a/.github/workflows/ci_e2e-unstable.yaml b/.github/workflows/ci_e2e-unstable.yaml index 79c36c35b5..63ba8e595d 100644 --- a/.github/workflows/ci_e2e-unstable.yaml +++ b/.github/workflows/ci_e2e-unstable.yaml @@ -70,10 +70,10 @@ jobs: run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --suite-tags="@cli" --rerun - name: Run non-UI Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain,@hybrid" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli" --suite-tags="@api,@domain" --rerun - name: Run non-JS Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@ui" --rerun + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@mink:chromedriver&&~@todo&&~@cli" --suite-tags="@hybrid,@ui" --rerun - name: Upload logs uses: actions/upload-artifact@v3 From 365de37fbae460820229ef4bf737d09bd2ef2068 Mon Sep 17 00:00:00 2001 From: Wojdylak Date: Fri, 27 Sep 2024 13:31:51 +0200 Subject: [PATCH 4/4] Enable impersonation tests --- .../admin/placing_order_as_impersonated_shop_users.feature | 4 ++-- src/Sylius/Behat/Page/Admin/Customer/ShowPage.php | 5 +++++ .../show/content/header/title_block/actions.html.twig | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/features/admin/placing_order_as_impersonated_shop_users.feature b/features/admin/placing_order_as_impersonated_shop_users.feature index b37de9aa68..6865b3ce08 100644 --- a/features/admin/placing_order_as_impersonated_shop_users.feature +++ b/features/admin/placing_order_as_impersonated_shop_users.feature @@ -13,7 +13,7 @@ Feature: Placing an order as impersonated shop users And there is a customer "Tanith Low" identified by an email "tanith.low@london.uk" and a password "tanithlow" And I am logged in as an administrator - @no-api @ui @mink:chromedriver + @no-api @ui @javascript Scenario: Placing an order as an impersonated shop user When I view details of the customer "tanith.low@london.uk" And I impersonate them @@ -24,7 +24,7 @@ Feature: Placing an order as impersonated shop users And I browse orders of a customer "tanith.low@london.uk" Then I should see a single order in the list - @no-api @ui @mink:chromedriver + @no-api @ui @javascript Scenario: Placing an order as an impersonated shop user when the shop user was already logged When I sign in with email "john.doe@london.uk" and password "johndoe" And I view details of the customer "tanith.low@london.uk" diff --git a/src/Sylius/Behat/Page/Admin/Customer/ShowPage.php b/src/Sylius/Behat/Page/Admin/Customer/ShowPage.php index 0b8254214d..82817967cb 100644 --- a/src/Sylius/Behat/Page/Admin/Customer/ShowPage.php +++ b/src/Sylius/Behat/Page/Admin/Customer/ShowPage.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Sylius\Behat\Page\Admin\Customer; use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage; +use Sylius\Behat\Service\DriverHelper; class ShowPage extends SymfonyPage implements ShowPageInterface { @@ -86,6 +87,9 @@ class ShowPage extends SymfonyPage implements ShowPageInterface public function impersonate(): void { + if (DriverHelper::isJavascript($this->getDriver())) { + $this->getElement('actions_button')->click(); + } $this->getElement('impersonate_button')->click(); } @@ -122,6 +126,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface protected function getDefinedElements(): array { return array_merge(parent::getDefinedElements(), [ + 'actions_button' => '[data-test-customer-actions]', 'customer_email' => '[data-test-customer-email]', 'customer_name' => '[data-test-customer-fullname]', 'customer_phone_number' => '[data-test-customer-phone]', diff --git a/src/Sylius/Bundle/AdminBundle/templates/customer/show/content/header/title_block/actions.html.twig b/src/Sylius/Bundle/AdminBundle/templates/customer/show/content/header/title_block/actions.html.twig index 343a9f0123..f3090737bd 100644 --- a/src/Sylius/Bundle/AdminBundle/templates/customer/show/content/header/title_block/actions.html.twig +++ b/src/Sylius/Bundle/AdminBundle/templates/customer/show/content/header/title_block/actions.html.twig @@ -1,6 +1,6 @@