minor #16627 [Admin] Enable and Implement Remaining Scenarios (Rafikooo)

This PR was merged into the 2.0 branch.

Discussion
----------

| Q               | A
|-----------------|-----
| Branch?         | 2.0 <!-- see the comment below -->
| Bug fix?        | no
| New feature?    | yes
| BC breaks?      | no
| Deprecations?   | no <!-- don't forget to update the UPGRADE-*.md file -->
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
 - Features, removing deprecations and BC breaks must be submitted against the 2.0 branch
 - Make sure that the correct base branch is set

 To be sure you are not breaking any Backward Compatibilities, check the documentation:
 https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


Commits
-------
  [Behat] Enable all hybrid checkout scenarios except one
  [Admin] Render currency test attribute
  [Behat] Enable hybrid catalog promotion scenarios
  [Behat] Enable editing product option scenario
  [Behat] Enable remaining managing users scenario
  [Behat] Enable deleting multiple product variants scenario
  [Behat] Enable viewing product in store from variant edit page scenarios
  [Behat] Improve view product in store action
  [Admin] Render view in store button in the variant edit page
  [Behat] Enable scenarios and improve implementation for filtered pages redirections
  [Admin] Render pagination and enabled filter test attributes
  [Behat] Use test attribute to retrieve order notes
  [Admin] Add missing order notes information
  [Admin] Configure and use anonymous view in store component
This commit is contained in:
Jan Góralski 2024-08-01 16:42:37 +02:00 committed by GitHub
commit a6ec5b2103
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 131 additions and 101 deletions

View file

@ -12,7 +12,7 @@ Feature: Being redirected to previous filtered page
And the store has a product "Znicz Pruszków T-Shirt"
And I am logged in as an administrator
@todo @ui @no-api
@no-api @ui
Scenario: Being redirected to previous filtered page after deleting a product
When I browse products
And I choose enabled filter
@ -20,7 +20,7 @@ Feature: Being redirected to previous filtered page
And I delete the "FC Barcelona T-Shirt" product on filtered page
Then I should be redirected to the previous page of only enabled products
@todo @ui @no-api
@no-api @ui
Scenario: Being redirected to previous filtered page after cancelling editing a product
When I browse products
And I choose enabled filter
@ -29,7 +29,7 @@ Feature: Being redirected to previous filtered page
And I cancel my changes
Then I should be redirected to the previous page of only enabled products
@todo @ui @no-api
@no-api @ui
Scenario: Being redirected to previous filtered page with pagination after cancelling editing a product
When I browse products
And I choose enabled filter
@ -39,7 +39,7 @@ Feature: Being redirected to previous filtered page
And I cancel my changes
Then I should be redirected to the 2nd page of only enabled products
@todo @ui @no-api
@no-api @ui
Scenario: Being redirected to previous filtered page after cancelling creating a new product
When I browse products
And I choose enabled filter

View file

@ -19,7 +19,7 @@ Feature: Editing product options
Then I should be notified that it has been successfully edited
And this product option name should be "T-Shirt color"
@todo @ui @api
@api @ui
Scenario: Not being able to edit code of an existing product option
When I want to modify the "T-Shirt size" product option
Then I should not be able to edit its code

View file

@ -10,22 +10,22 @@ In order to check a product in shop in all channels it is available in
And the store has a product "Bugatti" available in "United States" channel
And I am logged in as an administrator
@todo @ui @no-api
@no-api @ui
Scenario: Accessing product show page in shop from the product variant edit page where product is available in more than one channel
Given this product is also available in the "Europe" channel
And this product has "Red" variant priced at "$220,000.00" in "Europe" channel
When I want to modify the "Bugatti" product variant
And I choose to show this product in the "Europe" channel
And I choose to show this product in the channel "Europe"
Then I should see this product in the "Europe" channel in the shop
@todo @ui @no-api
@no-api @ui
Scenario: Accessing product show page in shop from the product variant edit page where product is available in one channel
Given this product has "Red" variant priced at "$220,000.00" in "United States" channel
When I want to modify the "Bugatti" product variant
And I choose to show this product in this channel
Then I should see this product in the "United States" channel in the shop
@todo @ui @no-api
@no-api @ui
Scenario: Being unable to access product show page in shop when the product is disabled
Given this product has been disabled
When I want to modify the "Bugatti" product variant

View file

@ -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
@todo @ui @mink:chromedriver @no-api
@no-api @ui @mink:chromedriver
Scenario: Deleting multiple product variants at once
When I browse variants of this product
And I check the "Small PHP Mug" product variant

View file

@ -9,7 +9,7 @@ Feature: Changing shop user's password
And there is a user "kibsoon@example.com" identified by "goodGuy"
And I am logged in as an administrator
@api @todo @ui
@api @ui
Scenario: Changing a password of a shop user
When I change the password of user "kibsoon@example.com" to "veryGoodGuy"
Then I should be notified that it has been successfully edited

View file

@ -13,7 +13,7 @@ Feature: Leaving additional request notes on my order during checkout
And there is a customer account "customer@example.com" identified by "sylius"
And I am logged in as "customer@example.com"
@todo @ui @api
@api @ui
Scenario: Adding note on the checkout summary step
Given I have product "PHP T-Shirt" in the cart
And I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow"

View file

@ -16,7 +16,7 @@ Feature: Placing an order on a single channel store
And there is a customer account "customer@example.com" identified by "sylius"
And I am logged in as "customer@example.com"
@todo @ui
@api @ui
Scenario: Placing an order in a channels base currency
Given I have product "PHP T-Shirt" in the cart
And I specified the billing address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow"
@ -24,7 +24,7 @@ Feature: Placing an order on a single channel store
And I confirm my order
Then the administrator should see that order placed by "customer@example.com" has "USD" currency
@todo @ui @no-api
@no-api @ui
Scenario: Placing an order in a channels base currency displaying prices in other currency
Given that channel also allows to shop using the "CAD" currency
And I had product "PHP T-Shirt" in the cart

View file

@ -17,7 +17,7 @@ Feature: Placing an order on multiple channels with different currency
And there is a customer account "customer@example.com" identified by "sylius"
And I am logged in as "customer@example.com"
@todo @ui @api
@api @ui
Scenario: Placing an order in a channels base currency
Given I changed my current channel to "United States"
And I have product "PHP T-Shirt" in the cart
@ -26,7 +26,7 @@ Feature: Placing an order on multiple channels with different currency
And I confirm my order
Then the administrator should see that order placed by "customer@example.com" has "USD" currency
@todo @ui @api
@api @ui
Scenario: Placing an order on a different channel with same currency
Given I changed my current channel to "Colombia"
And I had product "PHP T-Shirt" in the cart

View file

@ -17,7 +17,7 @@ Feature: Placing an order on multiple channels with same currency
And there is a customer account "customer@example.com" identified by "sylius"
And I am logged in as "customer@example.com"
@todo @ui
@api @ui
Scenario: Placing an order in a channels base currency
Given I changed my current channel to "Web"
And I have product "PHP T-Shirt" in the cart
@ -26,7 +26,7 @@ Feature: Placing an order on multiple channels with same currency
And I confirm my order
Then the administrator should see that order placed by "customer@example.com" has "USD" currency
@todo @ui
@api @ui
Scenario: Placing an order on a different channel with same currency
Given I changed my current channel to "Mobile"
And I had product "PHP T-Shirt" in the cart

View file

@ -9,13 +9,13 @@ Feature: Applying catalog promotions for product created in catalog promotions s
And the store classifies its products as "Clothes" and "Dishes"
And I am logged in as an administrator
@todo @ui @mink:chromedriver @no-api
@no-api @ui @mink:chromedriver
Scenario: Applying catalog promotion on newly created simple product
Given there is a catalog promotion "Clothes sale" that reduces price by "30%" and applies on "Clothes" taxon
When I create a new simple product "T-Shirt" priced at "$20.00" with "Clothes" taxon in the "United States" channel
Then the visitor should see "$14.00" as the price of the "T-Shirt" product in the "United States" channel
@api @todo @ui
@api @ui
Scenario: Applying catalog promotion on newly created product variant
Given there is a catalog promotion "Clothes sale" that reduces price by "30%" and applies on "Clothes" taxon
And the store has a "T-Shirt" configurable product
@ -23,7 +23,7 @@ Feature: Applying catalog promotions for product created in catalog promotions s
When I create a new "PHP T-Shirt" variant priced at "$20.00" for "T-Shirt" product in the "United States" channel
Then the visitor should see "$14.00" as the price of the "T-Shirt" product in the "United States" channel
@api @todo @ui
@api @ui
Scenario: Not applying catalog promotion on newly created product variant if it's not eligible
Given there is a catalog promotion "Clothes sale" that reduces price by "30%" and applies on "Clothes" taxon
And the store has a "Plate" configurable product

View file

@ -14,12 +14,12 @@ Feature: Not reapplying catalog promotions on variant once its prices changes
And there is disabled catalog promotion "Surprise sale" between "2021-07-01" and "2022-05-04" available in "Web-US" channel that reduces price by "90%" and applies on "PHP T-Shirt" variant
And I am logged in as an administrator
@api @todo @ui
@api @ui
Scenario: Changing the price of the variant
When I change the price of the "PHP T-Shirt" product variant to "$50.00" in "Web-US" channel
Then the visitor should see "$50.00" as the price of the "T-Shirt" product in the "Web-US" channel
@api @todo @ui
@api @ui
Scenario: Changing the original price of the variant
When I change the original price of the "PHP T-Shirt" product variant to "$105.00" in "Web-US" channel
Then the visitor should see "$100.00" as the price of the "T-Shirt" product in the "Web-US" channel

View file

@ -16,14 +16,14 @@ Feature: Not reapplying catalog promotions on variants once the products taxo
And there is disabled catalog promotion "Surprise sale" between "2021-07-01" and "2022-05-04" available in "Web-US" channel that reduces price by "90%" and applies on "Dishes" taxon
And I am logged in as an administrator
@api @todo @ui
@api @ui @mink:chromedriver
Scenario: Changing products taxon to taxon with scheduled catalog promotion
When I change that the "T-Shirt" product does not belong to the "Clothes" taxon
And I add "Shirts" taxon to the "T-Shirt" product
Then the visitor should see that the "PHP T-Shirt" variant is not discounted
And the visitor should still see "$100.00" as the price of the "T-Shirt" product in the "Web-US" channel
@api @todo @ui
@api @ui @mink:chromedriver
Scenario: Changing products taxon to taxon with disabled catalog promotion
When I change that the "T-Shirt" product does not belong to the "Clothes" taxon
And I add "Dishes" taxon to the "T-Shirt" product

View file

@ -230,7 +230,7 @@ final readonly class ManagingProductOptionsContext implements Context
*/
public function iShouldNotBeAbleToEditItsCode(): void
{
Assert::true($this->updatePage->isCodeDisabled());
Assert::true($this->formElement->isCodeDisabled());
}
/**

View file

@ -15,14 +15,17 @@ namespace Sylius\Behat\Context\Ui\Admin;
use Behat\Behat\Context\Context;
use Sylius\Behat\Element\Admin\Product\TaxonomyFormElementInterface;
use Sylius\Behat\Page\Admin\Product\UpdateSimpleProductPageInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\TaxonInterface;
use Webmozart\Assert\Assert;
final class ManagingProductTaxonsContext implements Context
{
public function __construct(private TaxonomyFormElementInterface $taxonomyFormElement)
final readonly class ManagingProductTaxonsContext implements Context
{
public function __construct(
private UpdateSimpleProductPageInterface $updateSimpleProductPage,
private TaxonomyFormElementInterface $taxonomyFormElement,
) {
}
/**
@ -41,6 +44,10 @@ final class ManagingProductTaxonsContext implements Context
ProductInterface $product,
TaxonInterface $taxon,
): void {
if (!$this->updateSimpleProductPage->isOpen(['id' => $product->getId()])) {
$this->updateSimpleProductPage->open(['id' => $product->getId()]);
}
$this->taxonomyFormElement->uncheckProductTaxon($taxon);
}

View file

@ -277,11 +277,11 @@ final class ManagingProductVariantsContext implements Context
}
/**
* @When I choose to show this product in the :channelName channel
* @When /^I choose to show this product in the (channel "([^"]+)")$/
*/
public function iChooseToShowThisProductInTheChannel(string $channelName): void
public function iChooseToShowThisProductInTheChannel(ChannelInterface $channel): void
{
$this->updatePage->showProductInChannel($channelName);
$this->updatePage->showProductInChannel($channel);
}
/**

View file

@ -208,7 +208,7 @@ final readonly class ManagingProductsContext implements Context
/**
* @When I choose to show this product in the :channel channel
*/
public function iChooseToShowThisProductInTheChannel(string $channel): void
public function iChooseToShowThisProductInTheChannel(ChannelInterface $channel): void
{
$this->updateSimpleProductPage->showProductInChannel($channel);
}

View file

@ -52,7 +52,7 @@ final readonly class ProductCreationContext implements Context
$this->productChannelPricingsFormElement->specifyPrice($channel, $price);
$this->createPage->checkChannel($channel->getCode());
$this->productTaxonomyFormElement->selectMainTaxon($taxon);
$this->productTaxonomyFormElement->selectMainTaxon($taxon->getName());
$this->productTaxonomyFormElement->checkProductTaxon($taxon);
$this->createPage->create();

View file

@ -28,7 +28,7 @@ class CreatePage extends SymfonyPage implements CreatePageInterface
Session $session,
$minkParameters,
RouterInterface $router,
private string $routeName,
private readonly string $routeName,
) {
parent::__construct($session, $minkParameters, $router);
}
@ -61,17 +61,25 @@ class CreatePage extends SymfonyPage implements CreatePageInterface
return $this->routeName;
}
public function cancelChanges(): void
{
$this->getElement('cancel_button')->click();
}
public function getMessageInvalidForm(): string
{
return $this->getDocument()->find('css', '.ui.icon.negative.message')->getText();
}
/**
* @return array<string, string>
*/
protected function getDefinedElements(): array
{
return array_merge(
parent::getDefinedElements(),
['form' => 'form'],
);
return array_merge(parent::getDefinedElements(), [
'form' => 'form',
'cancel_button' => '[data-test-cancel-changes-button]',
]);
}
protected function waitForFormUpdate(): void

View file

@ -27,8 +27,8 @@ class IndexPage extends SymfonyPage implements IndexPageInterface
Session $session,
$minkParameters,
RouterInterface $router,
private TableAccessorInterface $tableAccessor,
private string $routeName,
private readonly TableAccessorInterface $tableAccessor,
private readonly string $routeName,
) {
parent::__construct($session, $minkParameters, $router);
}
@ -165,6 +165,16 @@ class IndexPage extends SymfonyPage implements IndexPageInterface
return $this->routeName;
}
public function goToPage(int $page): void
{
$this->getElement('page_button', ['%page%' => $page])->click();
}
public function getPageNumber(): int
{
return (int) $this->getElement('current_page')->getText();
}
protected function getTableAccessor(): TableAccessorInterface
{
return $this->tableAccessor;
@ -200,10 +210,12 @@ class IndexPage extends SymfonyPage implements IndexPageInterface
return array_merge(parent::getDefinedElements(), [
'bulk_actions' => '.sylius-grid-nav__bulk',
'bulk_delete_confirm_button' => '[data-test-modal="bulk-delete"] [data-test-confirm-button]',
'enabled_filter' => '#criteria_enabled',
'current_page' => '[data-test-current-page]',
'enabled_filter' => '[data-test-criterion-enabled]',
'filter' => '[data-test-filter]',
'filters_form' => '[data-test-filters-form]',
'filters_toggle' => '.accordion-button',
'page_button' => '[data-test-page="%page%"]',
'table' => '.table',
]);
}

View file

@ -27,7 +27,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
Session $session,
$minkParameters,
RouterInterface $router,
private TableAccessorInterface $tableAccessor,
private readonly TableAccessorInterface $tableAccessor,
) {
parent::__construct($session, $minkParameters, $router);
}
@ -314,9 +314,9 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
public function hasNote(string $note): bool
{
$orderNotesElement = $this->getElement('order_notes');
$notes = $this->getElement('notes');
return $orderNotesElement->getText() === $note;
return $notes->getText() === $note;
}
public function hasShippingProvinceName(string $provinceName): bool
@ -388,32 +388,35 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
return $this->getElement('shipment_shipped_at_date')->getText();
}
/**
* @return array<string, string>
*/
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
'billing_address' => '[data-test-billing-address]',
'cancel_order' => '[data-test-cancel-order]',
'currency' => '#sylius-order-currency',
'currency' => '[data-test-currency]',
'customer_email' => '[data-test-customer] [data-test-email]',
'ip_address' => '#ipAddress',
'item' => '[data-test-item="%name%"]',
'items_total' => '[data-test-items-total]',
'order_notes' => '#sylius-order-notes',
'notes' => '[data-test-notes]',
'order_payment_state' => '[data-test-order-payment-state]',
'order_shipping_state' => '[data-test-order-shipping-state]',
'order_state' => '[data-test-order-state]',
'order_total' => '[data-test-order-total]',
'payments' => '[data-test-payments]',
'payment_complete' => '[data-test-complete-payment="%paymentId%"]',
'payment_refund' => '[data-test-refund-payment="%paymentId%"]',
'payments' => '[data-test-payments]',
'promotion' => '[data-test-promotion="%name%"]',
'promotion_total' => '[data-test-promotion-total]',
'resend_order_confirmation_email' => '[data-test-resend-order-confirmation-email]',
'resend_shipment_confirmation_email' => '[data-test-resend-shipment-confirmation-email]',
'shipment_shipped_at_date' => '[data-test-shipments] [data-test-shipped-at-date]',
'shipments' => '[data-test-shipments]',
'shipment_tracking' => '[data-test-shipment-tracking]',
'shipment_ship_button' => '[data-test-shipment-ship-button]',
'shipment_shipped_at_date' => '[data-test-shipments] [data-test-shipped-at-date]',
'shipment_tracking' => '[data-test-shipment-tracking]',
'shipments' => '[data-test-shipments]',
'shipping' => '[data-test-shipping="%name%"]',
'shipping_address' => '[data-test-shipping-address]',
'shipping_adjustment_name' => '#shipping-adjustment-label',
@ -426,11 +429,6 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
]);
}
protected function getTableAccessor(): TableAccessorInterface
{
return $this->tableAccessor;
}
protected function hasAddress(string $elementText, string $customerName, string $street, string $postcode, string $city, string $countryName): bool
{
return

View file

@ -33,11 +33,6 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
);
}
public function cancelChanges(): void
{
$this->getElement('cancel_button')->click();
}
public function checkChannel(string $channelName): void
{
$this->getDocument()->checkField($channelName);
@ -105,7 +100,6 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
'cancel_button' => '[data-test-cancel-changes-button]',
'code' => '#sylius_admin_payment_method_code',
'enabled' => '#sylius_admin_payment_method_enabled',
'gateway_name' => '#sylius_admin_payment_method_gatewayConfig_gatewayName',

View file

@ -65,11 +65,6 @@ class CreateSimpleProductPage extends BaseCreatePage implements CreateSimpleProd
$this->getElement('channel', ['%channel_code%' => $channelCode])->check();
}
public function cancelChanges(): void
{
$this->getElement('cancel_button')->click();
}
private function changeTab(string $tabName): void
{
if (DriverHelper::isNotJavascript($this->getDriver())) {

View file

@ -84,11 +84,6 @@ class IndexPage extends CrudIndexPage implements IndexPageInterface
$field->find('css', '[data-test-show-action="Details"]')->click();
}
public function goToPage(int $page): void
{
$this->getElement('pagination_button', ['%page%' => $page])->click();
}
public function checkFirstProductHasDataAttribute(string $attributeName): bool
{
return $this->getElement('first_product')->find('css', sprintf('[%s]', $attributeName)) !== null;
@ -99,11 +94,6 @@ class IndexPage extends CrudIndexPage implements IndexPageInterface
return $this->getElement('last_product')->find('css', sprintf('[%s]', $attributeName)) !== null;
}
public function getPageNumber(): int
{
return (int) $this->getElement('page_number')->getText();
}
/** @return array<string, string> */
protected function getDefinedElements(): array
{
@ -113,9 +103,6 @@ class IndexPage extends CrudIndexPage implements IndexPageInterface
'first_product' => '.table > tbody > tr:first-child',
'last_product' => '.table > tbody > tr:last-child',
'main_taxon_filter' => '#criteria_main_taxon',
'page_number' => '.sylius-grid-nav__pagination .active',
'pagination_button' => '.sylius-grid-nav__pagination a.item:contains("%page%")',
'pagination_buttons' => '.sylius-grid-nav__pagination',
'taxon_filter' => '#criteria_taxon',
]);
}

View file

@ -19,6 +19,7 @@ use Sylius\Behat\Behaviour\ChecksCodeImmutability;
use Sylius\Behat\Context\Ui\Admin\Helper\NavigationTrait;
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Symfony\Component\Routing\RouterInterface;
class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProductPageInterface
@ -93,9 +94,9 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd
return $this->getElement('view_in_store')->hasClass('disabled');
}
public function showProductInChannel(string $channel): void
public function showProductInChannel(ChannelInterface $channel): void
{
$this->getElement('view_in_store')->clickLink($channel);
$this->getElement('view_in_store_in_channel', ['%channel_code%' => $channel->getCode()])->click();
}
public function showProductInSingleChannel(): void
@ -168,6 +169,7 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd
'side_navigation_tab' => '[data-test-side-navigation-tab="%name%"]',
'tracked' => '[name="sylius_admin_product[variant][tracked]"]',
'view_in_store' => '[data-test-view-in-store]',
'view_in_store_in_channel' => '[data-test-view-in-store] [data-test-channel-code="%channel_code%"]',
]);
}
}

View file

@ -16,6 +16,7 @@ namespace Sylius\Behat\Page\Admin\Product;
use Sylius\Behat\Page\Admin\Crud\UpdatePageInterface as BaseUpdatePageInterface;
use Sylius\Behat\Page\Admin\EditToShowPageSwitcherInterface;
use Sylius\Behat\Page\Admin\ShowPageButtonCheckerInterface;
use Sylius\Component\Core\Model\ChannelInterface;
interface UpdateSimpleProductPageInterface extends
BaseUpdatePageInterface,
@ -46,7 +47,7 @@ interface UpdateSimpleProductPageInterface extends
public function isShowInShopButtonDisabled(): bool;
public function showProductInChannel(string $channel): void;
public function showProductInChannel(ChannelInterface $channel): void;
public function showProductInSingleChannel(): void;

View file

@ -104,17 +104,17 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
public function isShowInShopButtonDisabled(): bool
{
return $this->getElement('show_product_single_button')->hasClass('disabled');
return $this->getElement('view_in_store')->hasClass('disabled');
}
public function showProductInChannel(string $channel): void
public function showProductInChannel(ChannelInterface $channel): void
{
$this->getElement('show_product_dropdown')->clickLink($channel);
$this->getElement('view_in_store_in_channel', ['%channel_code%' => $channel->getCode()])->click();
}
public function showProductInSingleChannel(): void
{
$this->getElement('show_product_single_button')->click();
$this->getElement('view_in_store')->click();
}
public function isSelectedOptionValueOnPage(string $optionName, string $valueName): bool
@ -131,6 +131,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
{
return array_merge(parent::getDefinedElements(), [
'code' => '#sylius_admin_product_variant_code',
'enabled' => '#sylius_admin_product_variant_enabled',
'minimum_price' => '#sylius_admin_product_variant_channelPricings_%channelCode%_minimumPrice',
'name' => '#sylius_admin_product_variant_translations_%language%_name',
'on_hand' => '#sylius_admin_product_variant_onHand',
@ -139,10 +140,10 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
'price' => '#sylius_admin_product_variant_channelPricings_%channelCode%_price',
'pricing_configuration' => '#sylius_calculator_container',
'shipping_required' => '#sylius_admin_product_variant_shippingRequired',
'show_product_dropdown' => '.scrolling.menu',
'show_product_single_button' => 'a:contains("Show product in shop page")',
'tracked' => '#sylius_admin_product_variant_tracked',
'enabled' => '#sylius_admin_product_variant_enabled',
'view_in_store' => '[data-test-view-in-store]',
'view_in_store_in_channel' => '[data-test-view-in-store] [data-test-channel-code="%channel_code%"]',
]);
}

View file

@ -45,7 +45,7 @@ interface UpdatePageInterface extends BaseUpdatePageInterface
public function isShowInShopButtonDisabled(): bool;
public function showProductInChannel(string $channel): void;
public function showProductInChannel(ChannelInterface $channel): void;
public function showProductInSingleChannel(): void;

View file

@ -239,6 +239,7 @@
</service>
<service id="Sylius\Behat\Context\Ui\Admin\ManagingProductTaxonsContext">
<argument type="service" id="sylius.behat.page.admin.product.update_simple" />
<argument type="service" id="sylius.behat.element.admin.product.taxonomy_form" />
</service>

View file

@ -174,6 +174,8 @@ twig_hooks:
template: '@SyliusAdmin/order/show/content/sections/general/language.html.twig'
channel:
template: '@SyliusAdmin/order/show/content/sections/general/channel.html.twig'
notes:
template: '@SyliusAdmin/order/show/content/sections/general/notes.html.twig'
'sylius_admin.order.show.content.sections.customer':
full_name:

View file

@ -14,7 +14,9 @@ twig_hooks:
edit:
template: '@SyliusAdmin/shared/crud/show/content/header/title_block/actions/edit.html.twig'
view_in_store:
template: '@SyliusAdmin/product/common/header/title_block/actions/view_in_store.html.twig'
component: 'sylius_admin:view_in_store'
props:
product: '@=_context.resource'
'sylius_admin.product.show.content.page_body':
general:

View file

@ -15,7 +15,9 @@ twig_hooks:
'sylius_admin.product.update.content.header.title_block.actions':
view_in_store:
template: '@SyliusAdmin/product/common/header/title_block/actions/view_in_store.html.twig'
component: 'sylius_admin:view_in_store'
props:
product: '@=_context.resource'
manage_variants:
template: '@SyliusAdmin/product/common/header/title_block/actions/manage_variants.html.twig'

View file

@ -13,6 +13,10 @@ twig_hooks:
'sylius_admin.product_variant.update.content.header.title_block.actions':
price_history:
template: '@SyliusAdmin/product_variant/form/content/update/header/actions/price_history.html.twig'
view_in_store:
component: 'sylius_admin:view_in_store'
props:
product: '@=_context.resource.getProduct()'
'sylius_admin.product_variant.update.content.form':
side_navigation:

View file

@ -4,5 +4,5 @@
<div>
<strong>{{ 'sylius.ui.currency'|trans }}:</strong>
</div>
<div class="mb-3">{{ order.currencyCode }}</div>
<div class="mb-3" {{ sylius_test_html_attribute('currency') }}>{{ order.currencyCode }}</div>
</div>

View file

@ -0,0 +1,14 @@
{% set order = hookable_metadata.context.resource %}
<div>
<div>
<strong>{{ 'sylius.ui.notes'|trans }}:</strong>
</div>
<div class="mb-3" {{ sylius_test_html_attribute('notes') }}>
{% if order.notes is not null %}
{{ order.notes }}
{% else %}
-
{% endif %}
</div>
</div>

View file

@ -1,9 +1,8 @@
{% if sylius_bundle_loaded_checker('SyliusShopBundle') %}
{% from '@SyliusAdmin/shared/helper/icon.html.twig' import icon %}
{% set product = (hookable_metadata.context.resource) %}
{% set enabled_channels = product.channels|filter(channel => channel.enabled == true) %}
{% if sylius_bundle_loaded_checker('SyliusShopBundle') %}
{% if not product.enabled or enabled_channels|length < 1 %}
<a class="btn disabled" href="{{ (url is not defined) ? '#' : url|raw }}" target="_blank" {{ sylius_test_html_attribute('view-in-store') }}>
{{ icon({ icon: 'arrow_up_right', class: 'icon icon-tabler' }) }}
@ -26,6 +25,7 @@
class="dropdown-item{% if url is not defined %} disabled{% endif %}"
href="{{ (url is not defined) ? '#' : url|raw }}"
target="_blank"
{{ sylius_test_html_attribute('channel-code', channel.code) }}
>
{{ icon({ icon: 'arrow_up_right', class: 'icon dropdown-item-icon icon-tabler' }) }}
{{ channel.name }} ({{ channel.code }})

View file

@ -1,3 +1,3 @@
{% form_theme form '@SyliusAdmin/shared/form_theme.html.twig' %}
{{ form_row(form, {'label': filter.label}) }}
{{ form_row(form, sylius_test_form_attribute('criterion-enabled')|sylius_merge_recursive({'label': filter.label})) }}

View file

@ -7,11 +7,11 @@
{%- endblock pager_widget -%}
{%- block page_link -%}
<li class="page-item"><a class="page-link" href="{{- path -}}">{{- page -}}</a></li>
<li class="page-item"><a class="page-link" href="{{- path -}}" {{ sylius_test_html_attribute('page', page)}}>{{- page -}}</a></li>
{%- endblock page_link -%}
{%- block current_page_link -%}
<li class="page-item active" aria-current="page"><span class="page-link">{{- page -}}</span></li>
<li class="page-item active" aria-current="page"><span {{ sylius_test_html_attribute('current-page')}} class="page-link">{{- page -}}</span></li>
{%- endblock current_page_link -%}
{%- block previous_page_link -%}