diff --git a/features/channel/managing_channels/adding_channel_with_shop_billing_data.feature b/features/channel/managing_channels/adding_channel_with_shop_billing_data.feature
new file mode 100644
index 00000000000..9fa0eef7ff9
--- /dev/null
+++ b/features/channel/managing_channels/adding_channel_with_shop_billing_data.feature
@@ -0,0 +1,24 @@
+@managing_channels
+Feature: Adding a new channel with shop billing data
+ In order to sell through multiple channels of distributions with specific billing data
+ As an Administrator
+ I want to add a new channel with shop billing data to the registry
+
+ Background:
+ Given the store has currency "Euro"
+ And the store has locale "English (United States)"
+ And I am logged in as an administrator
+
+ @ui
+ Scenario: Adding a new channel with shop billing data
+ Given I want to create a new channel
+ When I specify its code as "MOBILE"
+ And I name it "Mobile channel"
+ And I choose "Euro" as the base currency
+ And I choose "English (United States)" as a default locale
+ And I specify company as "Ragnarok"
+ And I specify tax ID as "1100110011"
+ And I specify shop billing address as "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
+ And I add it
+ Then I should be notified that it has been successfully created
+ And the channel "Mobile channel" should appear in the registry
diff --git a/features/channel/managing_channels/editing_shop_billing_data_on_channel.feature b/features/channel/managing_channels/editing_shop_billing_data_on_channel.feature
new file mode 100644
index 00000000000..c4a8d4e9010
--- /dev/null
+++ b/features/channel/managing_channels/editing_shop_billing_data_on_channel.feature
@@ -0,0 +1,22 @@
+@managing_channels
+Feature: Editing shop billing data on channel
+ In order to have proper shop billing data on shop-related documents
+ As an Administrator
+ I want to be able to edit shop billing data on a channel
+
+ Background:
+ Given the store operates on a channel named "Web Store"
+ And the store ships to "United States"
+ And I am logged in as an administrator
+
+ @ui
+ Scenario: Editing shop billing data on channel
+ When I want to modify a channel "Web Store"
+ And I specify company as "Ragnarok"
+ And I specify tax ID as "1100110011"
+ And I specify shop billing address as "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
+ And I save my changes
+ Then I should be notified that it has been successfully edited
+ And this channel company should be "Ragnarok"
+ And this channel tax ID should be "1100110011"
+ And this channel shop billing address should be "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingChannelsBillingDataContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingChannelsBillingDataContext.php
new file mode 100644
index 00000000000..5f79ad787ad
--- /dev/null
+++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingChannelsBillingDataContext.php
@@ -0,0 +1,79 @@
+shopBillingDataElement = $shopBillingDataElement;
+ }
+
+ /**
+ * @When I specify company as :company
+ */
+ public function specifyCompanyAs(string $company): void
+ {
+ $this->shopBillingDataElement->specifyCompany($company);
+ }
+
+ /**
+ * @When I specify tax ID as :taxId
+ */
+ public function specifyTaxIdAs(string $taxId): void
+ {
+ $this->shopBillingDataElement->specifyTaxId($taxId);
+ }
+
+ /**
+ * @When I specify shop billing address as :street, :postcode :city, :country
+ */
+ public function specifyShopBillingAddressAs(
+ string $street,
+ string $postcode,
+ string $city,
+ CountryInterface $country
+ ): void
+ {
+ $this->shopBillingDataElement->specifyBillingAddress($street, $postcode, $city, $country->getCode());
+ }
+
+ /**
+ * @Then this channel company should be :company
+ */
+ public function thisChannelCompanyShouldBe(string $company): void
+ {
+ Assert::true($this->shopBillingDataElement->hasCompany($company));
+ }
+
+ /**
+ * @Then this channel tax ID should be :taxId
+ */
+ public function thisChanneTaxIdShouldBe(string $taxId): void
+ {
+ Assert::true($this->shopBillingDataElement->hasTaxId($taxId));
+ }
+
+ /**
+ * @Then this channel shop billing address should be :street, :postcode :city, :country
+ */
+ public function thisChannelShopBillingAddressShouldBe(
+ string $street,
+ string $postcode,
+ string $city,
+ CountryInterface $country
+ ): void
+ {
+ Assert::true($this->shopBillingDataElement->hasBillingAddress($street, $postcode, $city, $country->getCode()));
+ }
+}
diff --git a/src/Sylius/Behat/Element/Admin/Channel/ShopBillingDataElement.php b/src/Sylius/Behat/Element/Admin/Channel/ShopBillingDataElement.php
new file mode 100644
index 00000000000..a464e7589f0
--- /dev/null
+++ b/src/Sylius/Behat/Element/Admin/Channel/ShopBillingDataElement.php
@@ -0,0 +1,60 @@
+getElement('company')->setValue($company);
+ }
+
+ public function specifyTaxId(string $taxId): void
+ {
+ $this->getElement('tax_id')->setValue($taxId);
+ }
+
+ public function specifyBillingAddress(string $street, string $postcode, string $city, string $countryCode): void
+ {
+ $this->getElement('street')->setValue($street);
+ $this->getElement('postcode')->setValue($postcode);
+ $this->getElement('city')->setValue($city);
+ $this->getElement('country_code')->setValue($countryCode);
+ }
+
+ public function hasCompany(string $company): bool
+ {
+ return $company === $this->getElement('company')->getValue();
+ }
+
+ public function hasTaxId(string $taxId): bool
+ {
+ return $taxId === $this->getElement('tax_id')->getValue();
+ }
+
+ public function hasBillingAddress(string $street, string $postcode, string $city, string $countryCode): bool
+ {
+ return
+ $street === $this->getElement('street')->getValue() &&
+ $postcode === $this->getElement('postcode')->getValue() &&
+ $city === $this->getElement('city')->getValue() &&
+ $countryCode === $this->getElement('country_code')->getValue()
+ ;
+ }
+
+ protected function getDefinedElements(): array
+ {
+ return array_merge(parent::getDefinedElements(), [
+ 'city' => '#sylius_channel_billingData_city',
+ 'company' => '#sylius_channel_billingData_company',
+ 'country_code' => '#sylius_channel_billingData_countryCode',
+ 'postcode' => '#sylius_channel_billingData_postcode',
+ 'street' => '#sylius_channel_billingData_street',
+ 'tax_id' => '#sylius_channel_billingData_taxId',
+ ]);
+ }
+}
diff --git a/src/Sylius/Behat/Element/Admin/Channel/ShopBillingDataElementInterface.php b/src/Sylius/Behat/Element/Admin/Channel/ShopBillingDataElementInterface.php
new file mode 100644
index 00000000000..8ffbd894d9c
--- /dev/null
+++ b/src/Sylius/Behat/Element/Admin/Channel/ShopBillingDataElementInterface.php
@@ -0,0 +1,20 @@
+getDocument()->selectFieldOption('Locales', $language);
}
- public function isLocaleChosen(string $language): bool
- {
- return $this->getElement('locales')->find('named', ['option', $language])->hasAttribute('selected');
- }
-
public function chooseCurrency(string $currencyCode): void
{
$this->getDocument()->selectFieldOption('Currencies', $currencyCode);
}
- public function isCurrencyChosen(string $currencyCode): bool
- {
- return $this->getElement('currencies')->find('named', ['option', $currencyCode])->hasAttribute('selected');
- }
-
public function chooseDefaultTaxZone(string $taxZone): void
{
$this->getDocument()->selectFieldOption('Default tax zone', $taxZone);
@@ -63,6 +53,16 @@ public function chooseTaxCalculationStrategy(string $taxZone): void
$this->getDocument()->selectFieldOption('Tax calculation strategy', $taxZone);
}
+ public function isLocaleChosen(string $language): bool
+ {
+ return $this->getElement('locales')->find('named', ['option', $language])->hasAttribute('selected');
+ }
+
+ public function isCurrencyChosen(string $currencyCode): bool
+ {
+ return $this->getElement('currencies')->find('named', ['option', $currencyCode])->hasAttribute('selected');
+ }
+
public function isDefaultTaxZoneChosen(string $taxZone): bool
{
return $this->getElement('default_tax_zone')->find('named', ['option', $taxZone])->hasAttribute('selected');
diff --git a/src/Sylius/Behat/Page/Admin/Channel/UpdatePageInterface.php b/src/Sylius/Behat/Page/Admin/Channel/UpdatePageInterface.php
index 118e37852cc..46e4f7f2d47 100644
--- a/src/Sylius/Behat/Page/Admin/Channel/UpdatePageInterface.php
+++ b/src/Sylius/Behat/Page/Admin/Channel/UpdatePageInterface.php
@@ -29,20 +29,20 @@ public function setTheme(string $themeName): void;
*/
public function unsetTheme(): void;
- public function isCodeDisabled(): bool;
-
public function chooseLocale(string $language): void;
- public function isLocaleChosen(string $language): bool;
-
public function chooseCurrency(string $currencyCode): void;
- public function isCurrencyChosen(string $currencyCode): bool;
-
public function chooseDefaultTaxZone(string $taxZone): void;
public function chooseTaxCalculationStrategy(string $taxCalculationStrategy): void;
+ public function isCodeDisabled(): bool;
+
+ public function isLocaleChosen(string $language): bool;
+
+ public function isCurrencyChosen(string $currencyCode): bool;
+
public function isDefaultTaxZoneChosen(string $taxZone): bool;
public function isAnyDefaultTaxZoneChosen(): bool;
diff --git a/src/Sylius/Behat/Resources/config/services/contexts/ui.xml b/src/Sylius/Behat/Resources/config/services/contexts/ui.xml
index 14186ef775d..4534276a3d3 100644
--- a/src/Sylius/Behat/Resources/config/services/contexts/ui.xml
+++ b/src/Sylius/Behat/Resources/config/services/contexts/ui.xml
@@ -49,6 +49,11 @@
+
+
+
+
+
diff --git a/src/Sylius/Behat/Resources/config/services/elements.xml b/src/Sylius/Behat/Resources/config/services/elements.xml
index cfafbe56339..9acb9ed3ddf 100644
--- a/src/Sylius/Behat/Resources/config/services/elements.xml
+++ b/src/Sylius/Behat/Resources/config/services/elements.xml
@@ -16,6 +16,13 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
+
+
+
+
+ %__behat__.mink.parameters%
+
+
diff --git a/src/Sylius/Behat/Resources/config/services/elements/shop/account.xml b/src/Sylius/Behat/Resources/config/services/elements/admin.xml
similarity index 62%
rename from src/Sylius/Behat/Resources/config/services/elements/shop/account.xml
rename to src/Sylius/Behat/Resources/config/services/elements/admin.xml
index 19238829095..5fb4e7869a9 100644
--- a/src/Sylius/Behat/Resources/config/services/elements/shop/account.xml
+++ b/src/Sylius/Behat/Resources/config/services/elements/admin.xml
@@ -15,13 +15,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
-
- Sylius\Behat\Element\Shop\Account\RegisterElement
-
-
-
+
diff --git a/src/Sylius/Behat/Resources/config/services/elements/shop.xml b/src/Sylius/Behat/Resources/config/services/elements/shop.xml
index 9fb30a43182..369333fc170 100644
--- a/src/Sylius/Behat/Resources/config/services/elements/shop.xml
+++ b/src/Sylius/Behat/Resources/config/services/elements/shop.xml
@@ -15,7 +15,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"
>
-
-
-
+
+
+
+
+
diff --git a/src/Sylius/Behat/Resources/config/suites/ui/channel/managing_channels.yml b/src/Sylius/Behat/Resources/config/suites/ui/channel/managing_channels.yml
index c563c0e1cd9..addac3aaa19 100644
--- a/src/Sylius/Behat/Resources/config/suites/ui/channel/managing_channels.yml
+++ b/src/Sylius/Behat/Resources/config/suites/ui/channel/managing_channels.yml
@@ -22,6 +22,7 @@ default:
- sylius.behat.context.setup.zone
- sylius.behat.context.ui.admin.managing_channels
+ - sylius.behat.context.ui.admin.managing_channels_billing_data
- sylius.behat.context.ui.admin.notification
filters:
tags: "@managing_channels && @ui"