diff --git a/dev/tests/functional/composer.json b/dev/tests/functional/composer.json index 0e464d5e40357ea0cdd089aff913409c7d9df08c..4e36f1fa54f2197b79646374dfea39cdede39ec6 100644 --- a/dev/tests/functional/composer.json +++ b/dev/tests/functional/composer.json @@ -1,6 +1,6 @@ { "require": { - "magento/mtf": "1.0.0-rc44", + "magento/mtf": "1.0.0-rc46", "php": "~5.6.0|7.0.2|~7.0.6", "phpunit/phpunit": "4.1.0", "phpunit/phpunit-selenium": ">=1.2" diff --git a/dev/tests/functional/etc/repository_replacer.xml b/dev/tests/functional/etc/repository_replacer.xml new file mode 100644 index 0000000000000000000000000000000000000000..61046fbac44c4b6fdc85e9f75c3d4cb6105644f6 --- /dev/null +++ b/dev/tests/functional/etc/repository_replacer.xml @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + + <repository class="Magento\Catalog\Test\Repository\CatalogAttributeSet"> + <dataset name="default"> + <field name="attribute_set_id" xsi:type="number">4</field> + </dataset> + </repository> + + <repository class="Magento\Catalog\Test\Repository\CatalogProductAttribute"> + <dataset name="quantity_and_stock_status"> + <field name="attribute_id" xsi:type="number">113</field> + </dataset> + + <dataset name="tax_class_id"> + <field name="attribute_id" xsi:type="number">172</field> + </dataset> + </repository> + + <repository class="Magento\Catalog\Test\Repository\Category"> + <dataset name="default_category"> + <field name="parent_id" xsi:type="number">1</field> + <field name="id" xsi:type="number">2</field> + </dataset> + + <dataset name="root_category"> + <field name="parent_id" xsi:type="number">1</field> + </dataset> + </repository> + + <repository class="Magento\Customer\Test\Repository\CustomerGroup"> + <dataset name="General"> + <field name="customer_group_id" xsi:type="number">1</field> + </dataset> + + <dataset name="Retailer"> + <field name="customer_group_id" xsi:type="number">3</field> + </dataset> + + <dataset name="Wholesale"> + <field name="customer_group_id" xsi:type="number">2</field> + </dataset> + + <dataset name="all_customer_groups"> + <field name="customer_group_id" xsi:type="number">0</field> + </dataset> + + <dataset name="NOT_LOGGED_IN"> + <field name="customer_group_id" xsi:type="number">0</field> + </dataset> + + <dataset name="ALL_GROUPS"> + <field name="customer_group_id" xsi:type="number">32000</field> + </dataset> + </repository> + + <repository class="Magento\Store\Test\Repository\Store"> + <dataset name="default"> + <field name="store_id" xsi:type="number">1</field> + </dataset> + + <dataset name="default_store_view"> + <field name="store_id" xsi:type="number">1</field> + </dataset> + + <dataset name="all_store_views"> + <field name="store_id" xsi:type="number">0</field> + </dataset> + </repository> + + <repository class="Magento\Store\Test\Repository\StoreGroup"> + <dataset name="default"> + <field name="group_id" xsi:type="number">1</field> + </dataset> + </repository> + + <repository class="Magento\Store\Test\Repository\Website"> + <dataset name="default"> + <field name="website_id" xsi:type="number">1</field> + </dataset> + + <dataset name="all_websites"> + <field name="website_id" xsi:type="number">0</field> + </dataset> + + <dataset name="main_website"> + <field name="website_id" xsi:type="number">1</field> + </dataset> + </repository> + + <repository class="Magento\Tax\Test\Repository\TaxClass"> + <dataset name="taxable_goods"> + <field name="id" xsi:type="number">2</field> + <field name="class_id" xsi:type="number">2</field> + </dataset> + + <dataset name="retail_customer"> + <field name="class_id" xsi:type="number">3</field> + <field name="id" xsi:type="number">3</field> + </dataset> + + <dataset name="None"> + <field name="id" xsi:type="number">0</field> + </dataset> + </repository> + + <repository class="Magento\Tax\Test\Repository\TaxRate"> + <dataset name="US-CA-Rate_1"> + <field name="tax_calculation_rate_id" xsi:type="number">1</field> + <field name="tax_region_id" xsi:type="number">12</field> + </dataset> + + <dataset name="US-IL-Rate_1"> + <field name="tax_region_id" xsi:type="number">23</field> + </dataset> + + <dataset name="US-NY-Rate_1"> + <field name="tax_calculation_rate_id" xsi:type="number">2</field> + <field name="tax_region_id" xsi:type="number">43</field> + </dataset> + </repository> + + <repository class="Magento\User\Test\Repository\Role"> + <dataset name="Administrators"> + <field name="role_id" xsi:type="number">1</field> + </dataset> + </repository> + + <repository class="Magento\User\Test\Repository\User"> + <dataset name="default"> + <field name="user_id" xsi:type="number">1</field> + </dataset> + </repository> + + <repository class="Magento\Catalog\Test\Repository\CatalogProductSimple"> + <dataset name="sample_data_simple_product"> + <field name="id" xsi:type="number">1</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php index 1e29a988ff196bf695e97dc052227ef373295659..96be468a6eb377f619339c02a2be00835f8425eb 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php @@ -47,6 +47,7 @@ class Cli { $curl = $this->transport; $curl->write($this->prepareUrl($command, $options), [], CurlInterface::GET); + $curl->read(); $curl->close(); } @@ -60,6 +61,6 @@ class Cli private function prepareUrl($command, array $options) { $command .= ' ' . implode(' ', $options); - return $_ENV['app_frontend_url'] . Cli::URL . '?command=' . urldecode($command); + return $_ENV['app_frontend_url'] . Cli::URL . '?command=' . urlencode($command); } } diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php new file mode 100644 index 0000000000000000000000000000000000000000..425abfd85590d0848ea9292752cc4d48a0102065 --- /dev/null +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Mtf\Util\Command\Cli; + +use Magento\Mtf\Util\Command\Cli; + +/** + * Handle cache for tests executions. + */ +class Cache extends Cli +{ + /** + * Parameter for flush cache command. + */ + const PARAM_CACHE_FLUSH = 'cache:flush'; + + /** + * Parameter for cache disable command. + */ + const PARAM_CACHE_DISABLE = 'cache:disable'; + + /** + * Parameter for cache enable command. + */ + const PARAM_CACHE_ENABLE = 'cache:enable'; + + /** + * Flush cache. + * + * @return void + */ + public function flush() + { + parent::execute(Cache::PARAM_CACHE_FLUSH); + } + + /** + * Disable all cache or one cache type. + * + * @param string $cacheType [optional] + * @return void + */ + public function disableCache($cacheType = null) + { + parent::execute(Cache::PARAM_CACHE_DISABLE . ($cacheType ? " $cacheType" : '')); + } + + /** + * Enable all cache or one cache type. + * + * @param string $cacheType [optional] + * @return void + */ + public function enableCache($cacheType = null) + { + parent::execute(Cache::PARAM_CACHE_ENABLE . ($cacheType ? " $cacheType" : '')); + } +} diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Website.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Website.php index 3ca2ee86a8ee6470addfdd4eaf0e526462b7b749..611f46894c8bca850d10a519fe7a2850f31b5533 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Website.php +++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Website.php @@ -58,6 +58,6 @@ class Website */ private function prepareUrl($websiteCode) { - return $_ENV['app_frontend_url'] . Website::URL . '?website_code=' . urldecode($websiteCode); + return $_ENV['app_frontend_url'] . Website::URL . '?website_code=' . urlencode($websiteCode); } } diff --git a/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages.php b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages.php index 3ad5f846b2af5414d76bb11d4ef04496dafa8935..f9cd7d34e2a1eeec26688f900211a59c235c72d9 100644 --- a/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages.php +++ b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages.php @@ -7,6 +7,7 @@ namespace Magento\AdminNotification\Test\Block\System; use Magento\Mtf\Block\Block; +use Magento\Mtf\Client\Locator; /** * Global messages block. @@ -20,6 +21,13 @@ class Messages extends Block */ protected $closePopup = '[data-role="closeBtn"]'; + /** + * Locator for popup text. + * + * @var string + */ + protected $popupText = ".//*[@id='system_messages_list']/ul/li"; + /** * Close popup block. * @@ -31,4 +39,14 @@ class Messages extends Block $this->_rootElement->find($this->closePopup)->click(); } } + + /** + * Get pop up text. + * + * @return string + */ + public function getPopupText() + { + return $this->_rootElement->find($this->popupText, Locator::SELECTOR_XPATH)->getText(); + } } diff --git a/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages/System.php b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages/System.php new file mode 100644 index 0000000000000000000000000000000000000000..6f376246927367fc5a98511e36a1239d56ebf021 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages/System.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\AdminNotification\Test\Block\System\Messages; + +use Magento\Mtf\Block\Block; + +/** + * System message block. + */ +class System extends Block +{ + /** + * Get block text content. + * + * @return string + */ + public function getContent() + { + return $this->_rootElement->getText(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php index 72c2ab77fefa21169e422c1f13f2cda2862d8636..83d2c10752374492ebde4e93e0b653f23656f516 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php @@ -20,7 +20,14 @@ class View extends Block * * @var string */ - protected $recentlyViewedProducts = './/*[contains(@class,"widget")]//strong[@class="product-item-name"]'; + protected $recentlyViewedProducts = '.block-viewed-products-grid strong.product-item-name'; + + /** + * New Products selectors. + * + * @var string + */ + protected $newProducts = '.block-new-products strong.product-item-name'; /** * Description CSS selector. @@ -65,8 +72,24 @@ class View extends Block public function getProductsFromRecentlyViewedBlock() { $products = []; - $this->waitForElementVisible($this->recentlyViewedProducts, Locator::SELECTOR_XPATH); - $productNames = $this->_rootElement->getElements($this->recentlyViewedProducts, Locator::SELECTOR_XPATH); + $this->waitForElementVisible($this->recentlyViewedProducts, Locator::SELECTOR_CSS); + $productNames = $this->_rootElement->getElements($this->recentlyViewedProducts, Locator::SELECTOR_CSS); + foreach ($productNames as $productName) { + $products[] = $productName->getText(); + } + return $products; + } + + /** + * Get products from Catalog New Products List block. + * + * @return array + */ + public function getProductsFromCatalogNewProductsListBlock() + { + $products = []; + $this->waitForElementVisible($this->newProducts, Locator::SELECTOR_CSS); + $productNames = $this->_rootElement->getElements($this->newProducts, Locator::SELECTOR_CSS); foreach ($productNames as $productName) { $products[] = $productName->getText(); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php index 528ff52b172825abb10eed5e927e8566b5845119..40e0a0c014f0f5ad92e19da81882b21648f307e2 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Product/TierPrice.php @@ -41,7 +41,7 @@ class TierPrice extends DataSource private $fixtureFactory; /** - * Rought fixture field data. + * Rough fixture field data. * * @var array */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogAttributeSet.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogAttributeSet.xml index 975d3b3ce8d867b16a281ca39237a30b8d8dbdc2..a62bef0680a9eaf1eff6adf99f809e3f9c538353 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogAttributeSet.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogAttributeSet.xml @@ -8,8 +8,8 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> <repository class="Magento\Catalog\Test\Repository\CatalogAttributeSet"> <dataset name="default"> + <field name="attribute_set_id" xsi:type="string">%id%</field> <field name="attribute_set_name" xsi:type="string">Default</field> - <field name="attribute_set_id" xsi:type="string">4</field> </dataset> <dataset name="custom_attribute_set"> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml index 8ebc57837ec8f4f0e1d12e15db0ab17afb50cb5c..e94af12754af5615b48c81f37fe2a3df21470eff 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml @@ -14,7 +14,7 @@ </dataset> <dataset name="quantity_and_stock_status"> - <field name="attribute_id" xsi:type="number">113</field> + <field name="attribute_id" xsi:type="string">%id%</field> <field name="frontend_label" xsi:type="string">Quantity</field> <field name="attribute_code" xsi:type="string">quantity_and_stock_status</field> <field name="frontend_input" xsi:type="string">Dropdown</field> @@ -34,7 +34,7 @@ </dataset> <dataset name="tax_class_id"> - <field name="attribute_id" xsi:type="number">172</field> + <field name="attribute_id" xsi:type="string">%id%</field> <field name="frontend_label" xsi:type="string">Tax Class%isolation%</field> <field name="attribute_code" xsi:type="string">tax_class_id%isolation%</field> <field name="frontend_input" xsi:type="string">Dropdown</field> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index 83d736e479f94b8e9602221217410815ff687688..23c13fb1206df158e3f9824651cba9cb6a1ff30e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -1225,7 +1225,7 @@ </dataset> <dataset name="sample_data_simple_product"> - <field name="id" xsi:type="string">1</field> + <field name="id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">Overnight Duffle</field> <field name="sku" xsi:type="string">24-WB07</field> <field name="url_key" xsi:type="string">overnight-duffle</field> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml index 5e0d3af502d631cfa8cc0f34da3e7c9b133fefc7..30f870dea88f063a7278d7380f5d4fe24f508c9f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml @@ -18,13 +18,14 @@ </dataset> <dataset name="default_category"> + <field name="id" xsi:type="string">%id%</field> + <field name="parent_id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">Default Category</field> - <field name="parent_id" xsi:type="string">1</field> <field name="is_active" xsi:type="string">Yes</field> - <field name="id" xsi:type="string">2</field> </dataset> <dataset name="default_subcategory"> + <field name="id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">DefaultSubcategory%isolation%</field> <field name="url_key" xsi:type="string">default-subcategory-%isolation%</field> <field name="parent_id" xsi:type="array"> @@ -46,8 +47,8 @@ </dataset> <dataset name="root_category"> + <field name="parent_id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">RootCategory%isolation%</field> - <field name="parent_id" xsi:type="string">1</field> <field name="is_active" xsi:type="string">Yes</field> <field name="include_in_menu" xsi:type="string">Yes</field> </dataset> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php index 7daac0f1a12d3acbc5aa64851456c6a0fd07aa2e..ab0b558c9f5ee36e5ad488a2805907508a1553f6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/CreateProductsStep.php @@ -19,7 +19,7 @@ class CreateProductsStep implements TestStepInterface /** * Products names in data set * - * @var array + * @var string|array */ protected $products; @@ -42,10 +42,10 @@ class CreateProductsStep implements TestStepInterface * * @constructor * @param FixtureFactory $fixtureFactory - * @param array $products + * @param string|array $products * @param array $data [optional] */ - public function __construct(FixtureFactory $fixtureFactory, array $products, array $data = []) + public function __construct(FixtureFactory $fixtureFactory, $products, array $data = []) { $this->products = $products; $this->data = $data; @@ -60,6 +60,9 @@ class CreateProductsStep implements TestStepInterface public function run() { $products = []; + if (!is_array($this->products)) { // for backward compatible changes + $this->products = explode(',', $this->products); + } foreach ($this->products as $key => $productDataSet) { $productDataSet = explode('::', $productDataSet); $fixtureClass = $productDataSet[0]; diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml index 38e702c1a1953bf0a8e9880c3385a17264fb77f6..1c60b0f156bae087433d03ac12e84c733bb9258f 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.xml @@ -11,7 +11,7 @@ <data name="tag" xsi:type="string">test_type:extended_acceptance_test</data> <data name="originalProduct/0" xsi:type="string">catalogProductSimple::with_two_custom_option</data> <data name="checkoutData/dataset" xsi:type="string">simple_update_mini_shopping_cart</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductDataInMiniShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> </variation> <variation name="UpdateProductFromMiniShoppingCartEntityTestVariation2" summary="Update Configurable and verify previous product was updated to new one in shopping cart and mini shopping cart"> @@ -19,7 +19,7 @@ <data name="originalProduct/0" xsi:type="string">configurableProduct::default</data> <data name="checkoutData/dataset" xsi:type="string">configurable_update_mini_shopping_cart</data> <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductDataInMiniShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductOptionsAbsentInShoppingCart" /> </variation> @@ -28,7 +28,7 @@ <data name="originalProduct/0" xsi:type="string">bundleProduct::bundle_fixed_product</data> <data name="checkoutData/dataset" xsi:type="string">bundle_update_mini_shopping_cart</data> <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductDataInMiniShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductOptionsAbsentInShoppingCart" /> </variation> @@ -37,7 +37,7 @@ <data name="originalProduct/0" xsi:type="string">downloadableProduct::with_two_separately_links</data> <data name="checkoutData/dataset" xsi:type="string">downloadable_update_mini_shopping_cart</data> <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductDataInMiniShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductOptionsAbsentInShoppingCart" /> </variation> @@ -45,7 +45,7 @@ <data name="tag" xsi:type="string">test_type:extended_acceptance_test</data> <data name="originalProduct/0" xsi:type="string">catalogProductVirtual::default</data> <data name="checkoutData/dataset" xsi:type="string">virtual_update_mini_shopping_cart</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductDataInMiniShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> </variation> </testCase> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml index c0d68a18b8c4694a939dc8d32cbdb5ff14592a3f..42428189f44b06b3c33550efb453d34900045133 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml @@ -15,7 +15,7 @@ <data name="product/data/checkout_data/cartItem/subtotal" xsi:type="string">300</data> <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductDataInMiniShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> </variation> <variation name="UpdateShoppingCartTestVariation2"> @@ -26,7 +26,7 @@ <data name="product/data/checkout_data/cartItem/subtotal" xsi:type="string">715</data> <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductDataInMiniShoppingCart" /> <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> </variation> </testCase> diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData.xml index cea290304a771caf1d8ca19c6b671ced45fcfb2f..5d2c0338420b412cdb4a2759853483e4bd224fa5 100644 --- a/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData.xml @@ -14,7 +14,7 @@ repository_class="Magento\Config\Test\Repository\ConfigData" handler_interface="Magento\Config\Test\Handler\ConfigData\ConfigDataInterface" class="Magento\Config\Test\Fixture\ConfigData"> - <field name="section" /> + <field name="section" source="Magento\Config\Test\Fixture\ConfigData\Section" /> <field name="config_id" is_required="1" /> <field name="scope" is_required="" /> <field name="scope_id" is_required="" /> diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData/Section.php b/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData/Section.php new file mode 100644 index 0000000000000000000000000000000000000000..60d43e1da95f7edf29a012c4da95d0450a47b2f9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData/Section.php @@ -0,0 +1,170 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Config\Test\Fixture\ConfigData; + +use Magento\Store\Test\Fixture\Store; +use Magento\Store\Test\Fixture\Website; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\DataSource; + +/** + * Prepare Section entity. + */ +class Section extends DataSource +{ + /** + * Code of website. + */ + const WEBSITE_CODE = 'website'; + + /** + * Code of store view. + */ + const STORE_CODE = 'store'; + + /** + * Store View or Website fixture. + * + * @var Store|Website + */ + private $scope; + + /** + * Scope type. [website|store] + * + * @var string + */ + private $scopeType; + + /** + * Fixture Factory instance. + * + * @var FixtureFactory + */ + private $fixtureFactory; + + /** + * Rough fixture field data. + * + * @var array|null + */ + private $fixtureData = null; + + /** + * Scope data. + * + * @var array|null + */ + private $scopeData = null; + + /** + * Level of scope for set. + * If 'scope_type' = 'website', then 'set_level' MUST be 'website' only. + * + * @var string + */ + private $setLevel = null; + + /** + * @constructor + * @param FixtureFactory $fixtureFactory + * @param array $params + * @param array $data [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) + { + $this->fixtureFactory = $fixtureFactory; + $this->params = $params; + $this->fixtureData = $data; + } + + /** + * Return prepared data set. + * + * @param string $key [optional] + * @return mixed + */ + public function getData($key = null) + { + if ($this->data === null) { + if (isset($this->fixtureData['scope']['scope_type'])) { + $this->scopeData = $this->fixtureData['scope']; + $this->scopeType = $this->fixtureData['scope']['scope_type']; + $this->setLevel = $this->fixtureData['scope']['set_level']; + $this->prepareScopeData(); + unset($this->fixtureData['scope']); + } + $this->data = $this->fixtureData; + } + + return parent::getData($key); + } + + /** + * Prepare scope data. + * + * @return void + * @throws \Exception + */ + private function prepareScopeData() + { + if (isset($this->scopeData['dataset'])) { + /** @var Store|Website $store */ + $this->scope = $this->fixtureFactory->createByCode( + $this->scopeType, + ['dataset' => $this->scopeData['dataset']] + ); + if (!$this->scope->hasData($this->scopeType . '_id')) { + $this->scope->persist(); + } + } elseif (isset($this->scopeData['fixture'])) { + $this->scope = $this->scopeData['fixture']; + } else { + throw new \Exception('Parameters "dataset" and "fixture" aren\'t identify.'); + } + + $this->prepareScope(); + } + + /** + * Prepare scope. + * + * @return void + * @throws \Exception + */ + private function prepareScope() + { + if ($this->setLevel == self::STORE_CODE && $this->scopeType == self::WEBSITE_CODE) { + throw new \Exception('Store level can\'t set to ["scope_type" = "website"].'); + } elseif ($this->setLevel == self::WEBSITE_CODE && $this->scopeType == self::STORE_CODE) { + $this->scopeType = $this->setLevel; + $this->scope = $this->scope + ->getDataFieldConfig('group_id')['source']->getStoreGroup() + ->getDataFieldConfig('website_id')['source']->getWebsite(); + } + } + + /** + * Return Store View or Website fixture. + * + * @return Store|Website + */ + public function getScope() + { + return $this->scope; + } + + /** + * Get get scope type [website|store]. + * + * @return string + */ + public function getScopeType() + { + return $this->scopeType; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/Curl.php b/dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/Curl.php index 32672d63873b03a57c7de48e4ceeeef1c55204f7..aed3510118a2d579f7c998950c1c061da4d2fa4f 100644 --- a/dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/Curl.php @@ -6,16 +6,26 @@ namespace Magento\Config\Test\Handler\ConfigData; +use Magento\Config\Test\Fixture\ConfigData\Section; use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\Handler\Curl as AbstractCurl; use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; +use Magento\Store\Test\Fixture\Store; +use Magento\Store\Test\Fixture\Website; /** * Setting config. */ class Curl extends AbstractCurl implements ConfigDataInterface { + /** + * FixtureInterface object. + * + * @var FixtureInterface + */ + private $fixture; + /** * Mapping values for data. * @@ -37,6 +47,7 @@ class Curl extends AbstractCurl implements ConfigDataInterface */ public function persist(FixtureInterface $fixture = null) { + $this->fixture = $fixture; $data = $this->prepareData($fixture); foreach ($data as $scope => $item) { $this->applyConfigSettings($item, $scope); @@ -121,7 +132,9 @@ class Curl extends AbstractCurl implements ConfigDataInterface if (strpos($response, 'data-ui-id="messages-message-success"') === false) { $this->_eventManager->dispatchEvent(['curl_failed'], [$response]); - throw new \Exception("Configuration settings are not applied! Url: $url"); + throw new \Exception( + "Configuration settings are not applied! Url: $url" . PHP_EOL . "data: " . print_r($data, true) + ); } } @@ -133,6 +146,26 @@ class Curl extends AbstractCurl implements ConfigDataInterface */ protected function getUrl($section) { - return $_ENV['app_backend_url'] . 'admin/system_config/save/section/' . $section; + return $_ENV['app_backend_url'] . 'admin/system_config/save/section/' . $section . $this->getStoreViewUrl(); + } + + /** + * Get store view url. + * + * @return string + */ + private function getStoreViewUrl() + { + $result = ''; + /** @var Section $source */ + $source = $this->fixture->getDataFieldConfig('section')['source']; + /** @var Store|Website $scope */ + $scope = $source->getScope(); + if ($scope !== null) { + $code = $source->getScopeType(); + $result = $code . '/' . $scope->getData($code . '_id'); + } + + return $result ? '/' . $result : ''; } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroup.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroup.xml index 0813e2b52c69236224953ed7d2e9324a9037a737..f72d6279f3a37ba92976b3cbaae8f49a6444262a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroup.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroup.xml @@ -15,7 +15,7 @@ </dataset> <dataset name="General"> - <field name="customer_group_id" xsi:type="string">1</field> + <field name="customer_group_id" xsi:type="string">%id%</field> <field name="customer_group_code" xsi:type="string">General</field> <field name="tax_class_id" xsi:type="array"> <item name="dataset" xsi:type="string">retail_customer</item> @@ -23,7 +23,7 @@ </dataset> <dataset name="Retailer"> - <field name="customer_group_id" xsi:type="string">3</field> + <field name="customer_group_id" xsi:type="string">%id%</field> <field name="customer_group_code" xsi:type="string">Retailer</field> <field name="tax_class_id" xsi:type="array"> <item name="dataset" xsi:type="string">retail_customer</item> @@ -31,7 +31,7 @@ </dataset> <dataset name="Wholesale"> - <field name="customer_group_id" xsi:type="string">2</field> + <field name="customer_group_id" xsi:type="string">%id%</field> <field name="customer_group_code" xsi:type="string">Wholesale</field> <field name="tax_class_id" xsi:type="array"> <item name="dataset" xsi:type="string">retail_customer</item> @@ -39,12 +39,12 @@ </dataset> <dataset name="all_customer_groups"> - <field name="customer_group_id" xsi:type="string">0</field> + <field name="customer_group_id" xsi:type="string">%id%</field> <field name="customer_group_code" xsi:type="string">All Customer Groups</field> </dataset> <dataset name="NOT_LOGGED_IN"> - <field name="customer_group_id" xsi:type="string">0</field> + <field name="customer_group_id" xsi:type="string">%id%</field> <field name="customer_group_code" xsi:type="string">NOT LOGGED IN</field> <field name="tax_class_id" xsi:type="array"> <item name="dataset" xsi:type="string">retail_customer</item> @@ -52,7 +52,7 @@ </dataset> <dataset name="ALL_GROUPS"> - <field name="customer_group_id" xsi:type="string">32000</field> + <field name="customer_group_id" xsi:type="string">%id%</field> <field name="customer_group_code" xsi:type="string">ALL GROUPS</field> <field name="tax_class_id" xsi:type="array"> <item name="dataset" xsi:type="string">retail_customer</item> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml index a4141b79e9e64ef5d246c887746f6ac0ea0f2b95..e2f49d40cac7395734acc42783f5fce6b0c74083 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml @@ -284,5 +284,17 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> </variation> + <variation name="CreateDownloadableProductEntityTestVariation16" summary="Create downloadable product and assign it to custom website"> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">350</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/downloadable_links/dataset" xsi:type="string">one_separately_link</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <data name="product/data/website_ids/0/dataset" xsi:type="string">custom_store</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOnCustomWebsite" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.xml index 2b460e9fe6a6f6a986f524b9b7b55e7802f0d58b..3913817d8f3205105356b39d39e48bc212e6ca66 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.xml +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.xml @@ -8,7 +8,8 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\GiftMessage\Test\TestCase\CheckoutWithGiftMessagesTest" summary="One Page Checkout with Gift Messages" ticketId="MAGETWO-28978"> <variation name="CheckoutWithGiftMessagesTestVariation1"> - <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> + <data name="products/0" xsi:type="string">catalogProductSimple::default</data> + <data name="products/1" xsi:type="string">catalogProductVirtual::default</data> <data name="customer/dataset" xsi:type="string">default</data> <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> <data name="checkoutMethod" xsi:type="string">login</data> @@ -26,7 +27,8 @@ <constraint name="Magento\GiftMessage\Test\Constraint\AssertGiftMessageInFrontendOrder" /> </variation> <variation name="CheckoutWithGiftMessagesTestVariation2"> - <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> + <data name="products/0" xsi:type="string">catalogProductSimple::default</data> + <data name="products/1" xsi:type="string">catalogProductVirtual::default</data> <data name="customer/dataset" xsi:type="string">default</data> <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> <data name="checkoutMethod" xsi:type="string">login</data> diff --git a/dev/tests/functional/tests/app/Magento/PageCache/Test/Block/Cache/Grid.php b/dev/tests/functional/tests/app/Magento/PageCache/Test/Block/Cache/Grid.php index 4398f42cb11f28d8907924685a232b58b1177eba..a2d9dac2442f777eefb3fb68b217ff2184d77dbb 100644 --- a/dev/tests/functional/tests/app/Magento/PageCache/Test/Block/Cache/Grid.php +++ b/dev/tests/functional/tests/app/Magento/PageCache/Test/Block/Cache/Grid.php @@ -6,6 +6,7 @@ namespace Magento\PageCache\Test\Block\Cache; +use Magento\Mtf\Client\Locator; use Magento\Backend\Test\Block\Widget\Grid as ParentGrid; /** @@ -13,6 +14,13 @@ use Magento\Backend\Test\Block\Widget\Grid as ParentGrid; */ class Grid extends ParentGrid { + /** + * Locator value for cache status. + * + * @var string + */ + private $cacheStatus = "//tr[td[contains(text(), '%s')]]/td//span[contains(text(), '%s')]"; + /** * Search for item and select it. * @@ -29,4 +37,17 @@ class Grid extends ParentGrid throw new \Exception("Searched item was not found by filter\n" . print_r($filter, true)); } } + + /** + * Checks cache status. + * + * @param string $cacheType + * @param string $cacheStatus + * @return bool + */ + public function isCacheStatusCorrect($cacheType, $cacheStatus) + { + return $this->_rootElement->find(sprintf($this->cacheStatus, $cacheType, $cacheStatus), Locator::SELECTOR_XPATH) + ->isVisible(); + } } diff --git a/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheInvalidateNotice.php b/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheInvalidateNotice.php new file mode 100644 index 0000000000000000000000000000000000000000..bedaebbd4c7dbccb13a649ca5e630c946bcaaab9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheInvalidateNotice.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\PageCache\Test\Constraint; + +use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert cache invalidate notice. + */ +class AssertCacheInvalidateNotice extends AbstractConstraint +{ + /** + * Cache types array. + * + * @var array + */ + private $cacheTypes = [ + 'block_html' => "Blocks HTML output", + ]; + + /** + * Assert cache invalidate notice. + * + * @param AdminCache $adminCache + * @param array $caches + * @return void + */ + public function processAssert(AdminCache $adminCache, array $caches) + { + $adminCache->getSystemMessageDialog()->closePopup(); + foreach ($caches as $cacheType => $cacheStatus) { + if ($cacheStatus === 'Invalidated') { + \PHPUnit_Framework_Assert::assertContains( + $this->cacheTypes[$cacheType], + $adminCache->getSystemMessageBlock()->getContent() + ); + } else { + \PHPUnit_Framework_Assert::assertNotContains( + $this->cacheTypes[$cacheType], + $adminCache->getSystemMessageBlock()->getContent() + ); + } + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cache invalidate notice is correct.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheInvalidatePopUp.php b/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheInvalidatePopUp.php new file mode 100644 index 0000000000000000000000000000000000000000..27b77110c47b9f0e45ce8d709315f6bffda9b5b0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheInvalidatePopUp.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\PageCache\Test\Constraint; + +use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert cache invalidate pop up. + */ +class AssertCacheInvalidatePopUp extends AbstractConstraint +{ + /** + * Cache types array. + * + * @var array + */ + private $cacheTypes = [ + 'block_html' => "Blocks HTML output", + ]; + + /** + * Assert cache invalidate pop up. + * + * @param AdminCache $adminCache + * @param array $caches + * @return void + */ + public function processAssert(AdminCache $adminCache, array $caches) + { + foreach ($caches as $cacheType => $cacheStatus) { + if ($cacheStatus === 'Invalidated') { + \PHPUnit_Framework_Assert::assertContains( + $this->cacheTypes[$cacheType], + $adminCache->getSystemMessageDialog()->getPopupText() + ); + } else { + \PHPUnit_Framework_Assert::assertNotContains( + $this->cacheTypes[$cacheType], + $adminCache->getSystemMessageDialog()->getPopupText() + ); + } + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cache invalidate pop up is correct.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheStatus.php b/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheStatus.php new file mode 100644 index 0000000000000000000000000000000000000000..22adf03401c77b8fb7663ad6a234f4141cd3cb79 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/PageCache/Test/Constraint/AssertCacheStatus.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\PageCache\Test\Constraint; + +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\PageCache\Test\Page\Adminhtml\AdminCache; + +/** + * Assert cache status. + */ +class AssertCacheStatus extends AbstractConstraint +{ + /** + * Cache types array. + * + * @var array + */ + private $cacheTypes = [ + 'block_html' => "Blocks HTML output", + ]; + + /** + * Assert cache status equals to passed from variation. + * + * @param AdminCache $adminCache + * @param array $caches + * @return void + */ + public function processAssert(AdminCache $adminCache, array $caches) + { + $adminCache->open(); + foreach ($caches as $cacheType => $cacheStatus) { + \PHPUnit_Framework_Assert::assertTrue( + $adminCache->getGridBlock()->isCacheStatusCorrect($this->cacheTypes[$cacheType], $cacheStatus), + $this->cacheTypes[$cacheType] . " cache status in grid does not equal to " . $cacheStatus + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cache status is correct.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/PageCache/Test/Page/Adminhtml/AdminCache.xml b/dev/tests/functional/tests/app/Magento/PageCache/Test/Page/Adminhtml/AdminCache.xml index 8e4f538d9e6ca1da6a2f4cb1120733b0a7abb91e..8e067e92c1ddc52454c554cf70bed8e3a6c41174 100644 --- a/dev/tests/functional/tests/app/Magento/PageCache/Test/Page/Adminhtml/AdminCache.xml +++ b/dev/tests/functional/tests/app/Magento/PageCache/Test/Page/Adminhtml/AdminCache.xml @@ -12,5 +12,7 @@ <block name="additionalBlock" class="Magento\PageCache\Test\Block\Cache\Additional" locator="div.additional-cache-management" strategy="css selector"/> <block name="gridBlock" class="Magento\PageCache\Test\Block\Cache\Grid" locator="div#cache_grid" strategy="css selector"/> <block name="modalBlock" class="Magento\Ui\Test\Block\Adminhtml\Modal" locator="._show[data-role=modal]" strategy="css selector"/> + <block name="systemMessageDialog" class="Magento\AdminNotification\Test\Block\System\Messages" locator='.ui-popup-message .modal-inner-wrap' strategy="css selector" /> + <block name="systemMessageBlock" class="Magento\AdminNotification\Test\Block\System\Messages\System" locator="#system_messages" strategy="css selector" /> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReviewIsAvailableForProduct.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReviewIsAvailableForProduct.php index 485a7abf63f64e22c6829e82cdabab4b212099b9..a68749473dee5d18335b2ea65cdde866051f0618 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReviewIsAvailableForProduct.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertProductReviewIsAvailableForProduct.php @@ -6,6 +6,7 @@ namespace Magento\Reports\Test\Constraint; +use Magento\Mtf\Fixture\FixtureInterface; use Magento\Reports\Test\Page\Adminhtml\ProductReportReview; use Magento\Review\Test\Constraint\AssertProductReviewInGrid; use Magento\Review\Test\Fixture\Review; @@ -13,31 +14,32 @@ use Magento\Review\Test\Page\Adminhtml\ReviewIndex; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertProductReviewIsVisibleInGrid - * Assert that review is visible in review grid for select product + * Assert that review is visible in review grid for select product. */ class AssertProductReviewIsAvailableForProduct extends AbstractConstraint { /** - * Assert that review is visible in review grid for select product + * Assert that review is visible in review grid for select product. * * @param ReviewIndex $reviewIndex * @param Review $review * @param ProductReportReview $productReportReview * @param AssertProductReviewInGrid $assertProductReviewInGrid + * @param FixtureInterface $product * @return void */ public function processAssert( ReviewIndex $reviewIndex, Review $review, ProductReportReview $productReportReview, - AssertProductReviewInGrid $assertProductReviewInGrid + AssertProductReviewInGrid $assertProductReviewInGrid, + FixtureInterface $product ) { $productReportReview->open(); - $product = $review->getDataFieldConfig('entity_id')['source']->getEntity(); $productReportReview->getGridBlock()->openReview($product->getName()); unset($assertProductReviewInGrid->filter['visible_in']); $filter = $assertProductReviewInGrid->prepareFilter($product, $review->getData(), ''); + $reviewIndex->getReviewGrid()->resetFilter(); \PHPUnit_Framework_Assert::assertTrue( $reviewIndex->getReviewGrid()->isRowVisible($filter, false), 'Review for ' . $product->getName() . ' product is not visible in reports grid.' @@ -45,7 +47,7 @@ class AssertProductReviewIsAvailableForProduct extends AbstractConstraint } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductReviewReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductReviewReportEntityTest.php deleted file mode 100644 index cdc7f443132a39aa49619b6cdd81e0b6c47147d5..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductReviewReportEntityTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Reports\Test\TestCase; - -use Magento\Review\Test\Fixture\Review; -use Magento\Mtf\TestCase\Injectable; - -/** - * Preconditions: - * 1. Create simple product - * 2. Create review for this product - * - * Test Flow: - * 1. Login as admin - * 2. Navigate to the Reports>Reviews>By Products - * 3. Perform appropriate assertions. - * - * @group Reports_(MX) - * @ZephyrId MAGETWO-27223 - */ -class ProductReviewReportEntityTest extends Injectable -{ - /* tags */ - const MVP = 'no'; - const DOMAIN = 'MX'; - /* end tags */ - - /** - * Creation product review report entity - * - * @param Review $review - * @return void - */ - public function test(Review $review) - { - // Preconditions - $review->persist(); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductReviewReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductReviewReportEntityTest.xml deleted file mode 100644 index 4299894c46f99c35855110e7b1943449a811cd5c..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductReviewReportEntityTest.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © 2016 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Reports\Test\TestCase\ProductReviewReportEntityTest" summary="Product Review Report" ticketId="MAGETWO-27223"> - <variation name="ProductReviewReportEntityTestVariation1"> - <data name="review/dataset" xsi:type="string">frontend_review</data> - <constraint name="Magento\Reports\Test\Constraint\AssertProductReviewReportIsVisibleInGrid" /> - <constraint name="Magento\Reports\Test\Constraint\AssertProductReviewIsAvailableForProduct" /> - </variation> - </testCase> -</config> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.php similarity index 62% rename from dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php rename to dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.php index 208fba464a3bc224490a0e774a3301beb7d39a8a..9ed56a46e565ef0c489229d3b89af959cad8fc5b 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.php @@ -3,7 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Reports\Test\TestCase; use Magento\Catalog\Test\Fixture\CatalogProductSimple; @@ -20,25 +19,23 @@ use Magento\Mtf\TestCase\Injectable; /** * Preconditions: - * 1. Create customer - * 2. Create simple product - * 3. Open Product created in preconditions - * 4. Click "Be the first to review this product " - * 5. Fill data according to DataSet - * 6. Click Submit review + * 1. Create customer. + * 2. Create simple product. * * Steps: - * 1. Open Reports -> Review : By Customers - * 2. Assert Reviews qty - * 3. Click Show Reviews - * 4. Perform appropriate assertions. + * 1. Open Product created in preconditions. + * 2. Click "Be the first to review this product". + * 3. Fill data according to DataSet. + * 4. Click Submit review. + * 5. Perform appropriate assertions. * * @group Reports_(MX) * @ZephyrId MAGETWO-27555 + * @ZephyrId MAGETWO-27223 * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class CustomerReviewReportEntityTest extends Injectable +class ReviewReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; @@ -46,42 +43,42 @@ class CustomerReviewReportEntityTest extends Injectable /* end tags */ /** - * Customer frontend logout page + * Customer frontend logout page. * * @var CustomerAccountLogout */ protected $customerAccountLogout; /** - * Product reviews report page + * Product reviews report page. * * @var ProductReportReview */ protected $productReportReview; /** - * Frontend product view page + * Frontend product view page. * * @var CatalogProductView */ protected $pageCatalogProductView; /** - * Cms Index page + * Cms Index page. * * @var CmsIndex */ protected $cmsIndex; /** - * Catalog Category page + * Catalog Category page. * * @var CatalogCategoryView */ protected $catalogCategoryView; /** - * Prepare data + * Prepare data. * * @param FixtureFactory $fixtureFactory * @return array @@ -90,12 +87,11 @@ class CustomerReviewReportEntityTest extends Injectable { $customer = $fixtureFactory->createByCode('customer', ['dataset' => 'johndoe_unique']); $customer->persist(); - return ['customer' => $customer]; } /** - * Preparing pages for test + * Preparing pages for test. * * @param ProductReportReview $productReportReview * @param CatalogProductView $pageCatalogProductView @@ -119,44 +115,58 @@ class CustomerReviewReportEntityTest extends Injectable } /** - * Test Creation for CustomerReviewReportEntity + * Test Creation for ReviewReportEntity. * * @param Review $review * @param Customer $customer - * @param $customerLogin - * @param CatalogProductSimple $product * @param BrowserInterface $browser + * @param CatalogProductSimple $product [optional] + * @param bool $isCustomerLoggedIn [optional] * @return array - * - * @SuppressWarnings(PHPMD.ConstructorWithNameAsEnclosingClass) */ public function test( Review $review, Customer $customer, - CatalogProductSimple $product, BrowserInterface $browser, - $customerLogin + CatalogProductSimple $product = null, + $isCustomerLoggedIn = false ) { // Preconditions - $product->persist(); $this->cmsIndex->open(); - if ($customerLogin == 'Yes') { - $this->objectManager->create( - \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class, - ['customer' => $customer] - )->run(); + if ($isCustomerLoggedIn) { + $this->loginCustomer($customer); } // Steps - $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); - $this->pageCatalogProductView->getReviewSummary()->getAddReviewLink()->click(); - $this->pageCatalogProductView->getReviewFormBlock()->fill($review); - $this->pageCatalogProductView->getReviewFormBlock()->submit(); - + if ($review->getType() === "Administrator") { + $review->persist(); + $product = $review->getDataFieldConfig('entity_id')['source']->getEntity(); + } else { + $product->persist(); + $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $this->pageCatalogProductView->getReviewSummary()->getAddReviewLink()->click(); + $this->pageCatalogProductView->getReviewFormBlock()->fill($review); + $this->pageCatalogProductView->getReviewFormBlock()->submit(); + } + return ['product' => $product]; } /** - * Logout customer from frontend account + * Login customer on frontend. + * + * @param Customer $customer + * @return void + */ + private function loginCustomer(Customer $customer) + { + $this->objectManager->create( + 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + } + + /** + * Logout customer from frontend account. * * return void */ diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.xml similarity index 64% rename from dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.xml rename to dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.xml index 9fd2c98536d357582e6ad32cf00012e2bedb7f34..0a6a95eecccde07d25c75951528462feb0643303 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ReviewReportEntityTest.xml @@ -6,9 +6,9 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Reports\Test\TestCase\CustomerReviewReportEntityTest" summary="Customer Review Report" ticketId="MAGETWO-27555"> - <variation name="CustomerReviewReportEntityTestVariation1"> - <data name="customerLogin" xsi:type="string">Yes</data> + <testCase name="Magento\Reports\Test\TestCase\ReviewReportEntityTest" summary="Review Report"> + <variation name="CustomerReviewReportEntityTestVariation1" summary="Customer Review Report" ticketId="MAGETWO-27555"> + <data name="isCustomerLoggedIn" xsi:type="boolean">true</data> <data name="product/dataset" xsi:type="string">default</data> <data name="review/data/type" xsi:type="string">Customer</data> <data name="review/data/nickname" xsi:type="string">name_upd_%isolation%</data> @@ -18,8 +18,8 @@ <constraint name="Magento\Reports\Test\Constraint\AssertProductReviewsQtyByCustomer" /> <constraint name="Magento\Reports\Test\Constraint\AssertProductReportByCustomerInGrid" /> </variation> - <variation name="CustomerReviewReportEntityTestVariation2"> - <data name="customerLogin" xsi:type="string">Yes</data> + <variation name="CustomerReviewReportEntityTestVariation2" summary="Customer Review Report" ticketId="MAGETWO-27555"> + <data name="isCustomerLoggedIn" xsi:type="boolean">true</data> <data name="product/dataset" xsi:type="string">default</data> <data name="review/data/type" xsi:type="string">Customer</data> <data name="review/data/nickname" xsi:type="string">name_upd_%isolation%</data> @@ -29,9 +29,9 @@ <constraint name="Magento\Reports\Test\Constraint\AssertProductReviewsQtyByCustomer" /> <constraint name="Magento\Reports\Test\Constraint\AssertProductReportByCustomerInGrid" /> </variation> - <variation name="CustomerReviewReportEntityTestVariation3"> - <data name="customerLogin" xsi:type="string">No</data> + <variation name="CustomerReviewReportEntityTestVariation3" summary="Guest Review Report by Customer" ticketId="MAGETWO-27555"> <data name="product/dataset" xsi:type="string">default</data> + <data name="review/data/type" xsi:type="string">Guest</data> <data name="review/data/nickname" xsi:type="string">name_upd_%isolation%</data> <data name="review/data/title" xsi:type="string">title_upd_%isolation%</data> <data name="review/data/detail" xsi:type="string">review_upd_%isolation%</data> @@ -39,5 +39,15 @@ <constraint name="Magento\Reports\Test\Constraint\AssertProductReviewsQtyByCustomer" /> <constraint name="Magento\Reports\Test\Constraint\AssertProductReportByCustomerNotInGrid" /> </variation> + <variation name="ProductReviewReportEntityTestVariation4" summary="Assert product review report by guest" ticketId="MAGETWO-27223"> + <data name="product/dataset" xsi:type="string">default</data> + <data name="review/dataset" xsi:type="string">frontend_guest</data> + <constraint name="Magento\Reports\Test\Constraint\AssertProductReviewIsAvailableForProduct" /> + </variation> + <variation name="ProductReviewReportEntityTestVariation5" summary="Assert product Review Report by Administrator" ticketId="MAGETWO-27223"> + <data name="review/dataset" xsi:type="string">frontend_review</data> + <constraint name="Magento\Reports\Test\Constraint\AssertProductReviewReportIsVisibleInGrid" /> + <constraint name="Magento\Reports\Test\Constraint\AssertProductReviewIsAvailableForProduct" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Repository/Review.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Repository/Review.xml index 9a6431ce1a54b8d7fa0b4c36c11cded99e4edec0..05c96f78ad7834603aeb43d34c8d01020e03259d 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Repository/Review.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Repository/Review.xml @@ -57,6 +57,21 @@ <field name="entity_id" xsi:type="array"> <item name="dataset" xsi:type="string">catalogProductSimple::default</item> </field> + <field name="type" xsi:type="string">Administrator</field> + </dataset> + + <dataset name="frontend_guest"> + <field name="status_id" xsi:type="string">Pending</field> + <field name="select_stores" xsi:type="array"> + <item name="0" xsi:type="string">Main Website/Main Website Store/Default Store View</item> + </field> + <field name="nickname" xsi:type="string">Guest customer %isolation%</field> + <field name="title" xsi:type="string">Summary review %isolation%</field> + <field name="detail" xsi:type="string">Text review %isolation%</field> + <field name="entity_id" xsi:type="array"> + <item name="dataset" xsi:type="string">catalogProductSimple::default</item> + </field> + <field name="type" xsi:type="string">Guest</field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.php index c389725c1bd858bc5b7684aeffc65b3d58ba2b00..0fa3a67c8122ec5c0d86bfec707f528621904f8e 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Widget/Guest/Form.php @@ -43,16 +43,18 @@ class Form extends \Magento\Mtf\Block\Form public function fill(FixtureInterface $fixture, SimpleElement $element = null, $isSearchByEmail = true) { /** @var OrderInjectable $fixture */ - /** @var Customer $customer */ - $customer = $fixture->getDataFieldConfig('customer_id')['source']->getCustomer(); + $searchData = $fixture->getData('customer_id') + ? $fixture->getDataFieldConfig('customer_id')['source']->getCustomer()->getData() + : $fixture->getDataFieldConfig('billing_address_id')['source']->getData(); + $data = [ 'order_id' => $fixture->getId(), - 'billing_last_name' => $customer->getLastname(), + 'billing_last_name' => $searchData['lastname'], ]; if ($isSearchByEmail) { $data['find_order_by'] = 'Email'; - $data['email_address'] = $customer->getEmail(); + $data['email_address'] = $searchData['email']; } else { $data['find_order_by'] = 'ZIP Code'; $data['billing_zip_code'] = $fixture->getDataFieldConfig('billing_address_id')['source']->getPostcode(); diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Webapi.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Webapi.php index ea4eb3ef9ec8681ed35b81d6939c6929001871f2..1286064662ebe097ae1239da04419ac1bad8b8a9 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Webapi.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Handler/OrderInjectable/Webapi.php @@ -49,6 +49,13 @@ class Webapi extends AbstractWebapi implements OrderInjectableInterface */ protected $url; + /** + * Either customer is a guest or not. + * + * @var bool + */ + private $isCustomerGuest; + /** * Creating order using quote via web API. * @@ -57,9 +64,14 @@ class Webapi extends AbstractWebapi implements OrderInjectableInterface */ public function persist(FixtureInterface $fixture = null) { + $this->isCustomerGuest = $fixture->getData('customer_id') ? false : true; + /** @var OrderInjectable $fixture */ $this->createQuote($fixture); - $this->url = $_ENV['app_frontend_url'] . 'rest/V1/carts/' . (int)$this->quote; + + $url = $this->isCustomerGuest ? 'guest-carts/' . $this->quote : 'carts/' . (int)$this->quote; + $this->url = $_ENV['app_frontend_url'] . 'rest/V1/' . $url; + $this->setProducts($fixture); $this->setCoupon($fixture); $this->setBillingAddress($fixture); @@ -79,16 +91,28 @@ class Webapi extends AbstractWebapi implements OrderInjectableInterface */ protected function createQuote(OrderInjectable $order) { - $url = $_ENV['app_frontend_url'] . 'rest/V1/customers/' . $order->getCustomerId()->getId() . '/carts'; - $data = '{"customerId": "' . $order->getCustomerId()->getId() . '"}'; - $this->webapiTransport->write($url, $data); - $response = json_decode($this->webapiTransport->read(), true); - $this->webapiTransport->close(); - if (!is_numeric($response)) { - $this->eventManager->dispatchEvent(['webapi_failed'], [$response]); - throw new \Exception('Could not create a checkout quote using web API.'); + if ($this->isCustomerGuest) { + $url = $_ENV['app_frontend_url'] . 'rest/V1/guest-carts'; + $this->webapiTransport->write($url); + $response = json_decode($this->webapiTransport->read(), true); + $this->webapiTransport->close(); + if (!is_string($response)) { + $this->eventManager->dispatchEvent(['webapi_failed'], [$response]); + throw new \Exception('Could not create a checkout quote using web API.'); + } + $this->quote = $response; + } else { + $url = $_ENV['app_frontend_url'] . 'rest/V1/customers/' . $order->getCustomerId()->getId() . '/carts'; + $data = '{"customerId": "' . $order->getCustomerId()->getId() . '"}'; + $this->webapiTransport->write($url, $data); + $response = json_decode($this->webapiTransport->read(), true); + $this->webapiTransport->close(); + if (!is_numeric($response)) { + $this->eventManager->dispatchEvent(['webapi_failed'], [$response]); + throw new \Exception('Could not create a checkout quote using web API.'); + } + $this->quote = $response; } - $this->quote = $response; } /** @@ -100,7 +124,7 @@ class Webapi extends AbstractWebapi implements OrderInjectableInterface */ protected function setProducts(OrderInjectable $order) { - $url = $_ENV['app_frontend_url'] . 'rest/V1/carts/' . $this->quote . '/items'; + $url = $this->url . '/items'; $products = $order->getEntityId()['products']; foreach ($products as $product) { $data = [ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable.xml index d734a9a26906fb9892a1b334fb64719795ea4749..65335ced8ed4c24f2bee701f1be039274585fd55 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable.xml @@ -230,5 +230,26 @@ <field name="base_currency_code" xsi:type="string">0</field> <field name="order_currency_code" xsi:type="string">USD</field> </dataset> + + <dataset name="guest"> + <field name="entity_id" xsi:type="array"> + <item name="products" xsi:type="string">catalogProductSimple::default</item> + </field> + <field name="billing_address_id" xsi:type="array"> + <item name="dataset" xsi:type="string">US_address</item> + </field> + <field name="store_id" xsi:type="array"> + <item name="dataset" xsi:type="string">default_store_view</item> + </field> + <field name="shipping_method" xsi:type="string">flatrate_flatrate</field> + <field name="payment_auth_expiration" xsi:type="array"> + <item name="method" xsi:type="string">checkmo</item> + </field> + <field name="payment_authorization_amount" xsi:type="array"> + <item name="method" xsi:type="string">free</item> + </field> + <field name="base_currency_code" xsi:type="string">0</field> + <field name="order_currency_code" xsi:type="string">USD</field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/Curl.php b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/Curl.php index b8ac08b09054fe0c69778321fd20d8fa3578a75f..6d7eefa7889dfd272a9ed7a8a476bae453907f48 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Handler/Website/Curl.php @@ -6,6 +6,7 @@ namespace Magento\Store\Test\Handler\Website; +use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\Handler\Curl as AbstractCurl; use Magento\Mtf\Util\Protocol\CurlInterface; @@ -14,6 +15,7 @@ use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; use Magento\Mtf\Config\DataInterface; use Magento\Mtf\System\Event\EventManagerInterface; use Magento\Mtf\Util\Command\Website; +use Magento\Store\Test\Fixture\Website as WebsiteFixture; /** * Curl handler for creating Website. @@ -27,19 +29,36 @@ class Curl extends AbstractCurl implements WebsiteInterface */ private $website; + /** + * Website fixture. + * + * @var WebsiteFixture + */ + private $fixture; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + private $fixtureFactory; + /** * @constructor * @param DataInterface $configuration * @param EventManagerInterface $eventManager * @param Website $website + * @param FixtureFactory $fixtureFactory */ public function __construct( DataInterface $configuration, EventManagerInterface $eventManager, - Website $website + Website $website, + FixtureFactory $fixtureFactory ) { parent::__construct($configuration, $eventManager); $this->website = $website; + $this->fixtureFactory = $fixtureFactory; } /** @@ -63,9 +82,14 @@ class Curl extends AbstractCurl implements WebsiteInterface $websiteId = $this->getWebSiteIdByWebsiteName($fixture->getName()); + // Update website fixture data. + $this->fixture = $this->fixtureFactory->createByCode( + 'website', + ['data' => array_merge($fixture->getData(), ['website_id' => $websiteId])] + ); // Creates Website folder in root directory. $this->website->create($data['website']['code']); - $this->setConfiguration($data, $websiteId); + $this->setConfiguration($data); return ['website_id' => $websiteId]; } @@ -120,30 +144,19 @@ class Curl extends AbstractCurl implements WebsiteInterface * Set Website configuration Base url. * * @param array $data - * @param int $websiteId * @return void * @throws \Exception */ - private function setConfiguration($data, $websiteId) + private function setConfiguration(array $data) { $configData = [ - 'groups' => [ - 'unsecure' => [ - 'fields' => [ - 'base_link_url' => - [ - 'value' => '{{unsecure_base_url}}websites/' . $data['website']['code'] . '/', - ] - ] - ] - ] + 'web/unsecure/base_link_url' => [ + 'value' => '{{unsecure_base_url}}websites/' . $data['website']['code'] . '/' + ], + 'scope' => ['fixture' => $this->fixture, 'scope_type' => 'website', 'set_level' => 'website'] ]; - $url = $_ENV['app_backend_url'] . - 'admin/system_config/save/section/web/website/' . $websiteId . '/'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->write($url, $configData); - $curl->read(); - $curl->close(); + $configFixture = $this->fixtureFactory->createByCode('configData', ['data' => $configData]); + $configFixture->persist(); } } diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.xml b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.xml index 09a78be796b01000c806231d87ade6c0a761cda4..12ca9f5e03a20568423ee565030c785e9eec5bba 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Store.xml @@ -8,13 +8,13 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> <repository class="Magento\Store\Test\Repository\Store"> <dataset name="default"> + <field name="store_id" xsi:type="string">%id%</field> <field name="group_id" xsi:type="array"> <item name="dataset" xsi:type="string">default</item> </field> <field name="name" xsi:type="string">Default Store View</field> <field name="code" xsi:type="string">default</field> <field name="is_active" xsi:type="string">Enabled</field> - <field name="store_id" xsi:type="string">1</field> </dataset> <dataset name="custom"> @@ -27,13 +27,13 @@ </dataset> <dataset name="default_store_view"> + <field name="store_id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">Default Store View</field> - <field name="store_id" xsi:type="string">1</field> </dataset> <dataset name="all_store_views"> + <field name="store_id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">All Store Views</field> - <field name="store_id" xsi:type="string">0</field> </dataset> <dataset name="german"> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/StoreGroup.xml b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/StoreGroup.xml index cbda2a02eda72020b5da48e0d89fd44c0bd40bac..f07c79a8967d56b5b241feb049cd402f6d90ddef 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/StoreGroup.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/StoreGroup.xml @@ -8,11 +8,11 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> <repository class="Magento\Store\Test\Repository\StoreGroup"> <dataset name="default"> + <field name="group_id" xsi:type="string">%id%</field> <field name="website_id" xsi:type="array"> <item name="dataset" xsi:type="string">main_website</item> </field> <field name="name" xsi:type="string">Main Website Store</field> - <field name="group_id" xsi:type="string">1</field> <field name="root_category_id" xsi:type="array"> <item name="dataset" xsi:type="string">default_category</item> </field> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Website.xml b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Website.xml index 8b90722866ae9be0204730f8ce851e14258acd20..5c2ec69efca98b581708ffd2eb4441d8275ee073 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Website.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Repository/Website.xml @@ -8,21 +8,21 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> <repository class="Magento\Store\Test\Repository\Website"> <dataset name="default"> + <field name="website_id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">Main Website</field> <field name="code" xsi:type="string">base</field> - <field name="website_id" xsi:type="string">1</field> </dataset> <dataset name="all_websites"> + <field name="website_id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">All Websites</field> - <field name="website_id" xsi:type="string">0</field> </dataset> <dataset name="main_website"> + <field name="website_id" xsi:type="string">%id%</field> <field name="name" xsi:type="string">Main Website</field> <field name="code" xsi:type="string">base</field> <field name="sort_order" xsi:type="string">0</field> - <field name="website_id" xsi:type="string">1</field> </dataset> <dataset name="custom_website"> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxClass.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxClass.xml index 35ece9e1fa394b1fba480c7b25486e78cc2c02b0..061bc05c07891a433ae37327c5e403e121870dec 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxClass.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxClass.xml @@ -12,17 +12,17 @@ </dataset> <dataset name="taxable_goods"> - <field name="class_id" xsi:type="string">2</field> + <field name="id" xsi:type="string">%id%</field> + <field name="class_id" xsi:type="string">%id%</field> <field name="class_name" xsi:type="string">Taxable Goods</field> <field name="class_type" xsi:type="string">PRODUCT</field> - <field name="id" xsi:type="string">2</field> </dataset> <dataset name="retail_customer"> - <field name="class_id" xsi:type="string">3</field> + <field name="id" xsi:type="string">%id%</field> + <field name="class_id" xsi:type="string">%id%</field> <field name="class_name" xsi:type="string">Retail Customer</field> <field name="class_type" xsi:type="string">CUSTOMER</field> - <field name="id" xsi:type="string">3</field> </dataset> <dataset name="customer_tax_class"> @@ -36,9 +36,9 @@ </dataset> <dataset name="None"> + <field name="id" xsi:type="string">%id%</field> <field name="class_name" xsi:type="string">None</field> <field name="class_type" xsi:type="string">PRODUCT</field> - <field name="id" xsi:type="string">0</field> </dataset> <dataset name="all"> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRate.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRate.xml index e60032248ab54be2b9f44b03b33a7ca42f5e43b2..acd8ef1d8cc9da9e6feb63d231f17174d859696a 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRate.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/TaxRate.xml @@ -16,9 +16,9 @@ </dataset> <dataset name="US-CA-Rate_1"> - <field name="tax_calculation_rate_id" xsi:type="string">1</field> + <field name="tax_calculation_rate_id" xsi:type="string">%id%</field> + <field name="tax_region_id" xsi:type="string">%id%</field> <field name="tax_country_id" xsi:type="string">US</field> - <field name="tax_region_id" xsi:type="string">12</field> <field name="tax_postcode" xsi:type="string">*</field> <field name="code" xsi:type="string">US-CA-*-Rate 1</field> <field name="rate" xsi:type="string">8.2500</field> @@ -34,13 +34,13 @@ <field name="rate" xsi:type="string">8.25</field> <field name="tax_country_id" xsi:type="string">United States</field> <field name="tax_postcode" xsi:type="string">*</field> - <field name="tax_region_id" xsi:type="string">23</field> + <field name="tax_region_id" xsi:type="string">%id%</field> </dataset> <dataset name="US-NY-Rate_1"> - <field name="tax_calculation_rate_id" xsi:type="string">2</field> + <field name="tax_calculation_rate_id" xsi:type="string">%id%</field> + <field name="tax_region_id" xsi:type="string">%id%</field> <field name="tax_country_id" xsi:type="string">US</field> - <field name="tax_region_id" xsi:type="string">43</field> <field name="tax_postcode" xsi:type="string">*</field> <field name="code" xsi:type="string">US-NY-*-Rate 1</field> <field name="rate" xsi:type="string">8.3750</field> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml b/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml index 7aa989352a65658294050dd02eb6247b6aee129e..25b812bf77665d09877835e676fc5d11fdd1434a 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml @@ -8,13 +8,13 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> <repository class="Magento\User\Test\Repository\User"> <dataset name="default"> + <field name="user_id" xsi:type="string">%id%</field> <field name="username" xsi:type="string">admin</field> <field name="firstname" xsi:type="string">FirstName%isolation%</field> <field name="lastname" xsi:type="string">LastName%isolation%</field> <field name="email" xsi:type="string">email%isolation%@example.com</field> <field name="password" xsi:type="string">123123q</field> <field name="password_confirmation" xsi:type="string">123123q</field> - <field name="user_id" xsi:type="string">1</field> <field name="current_password" xsi:type="string">%current_password%</field> </dataset> diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/Parameters.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/Parameters.php index 10d578adb9c36723d08b91d6831fcba2d0ba277a..f015be4ddcbbe30b767478e83b76e78ab453613e 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/Parameters.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/Parameters.php @@ -28,7 +28,7 @@ class Parameters extends Tab * * @var string */ - protected $path = 'Magento\Widget\Test\Block\Adminhtml\Widget\Instance\Edit\Tab\ParametersType\\'; + protected $path = 'Magento\*\Test\Block\Adminhtml\Widget\Instance\Edit\Tab\ParametersType\\'; /** * Fill Widget options form. @@ -40,14 +40,29 @@ class Parameters extends Tab public function setFieldsData(array $fields, SimpleElement $element = null) { $data = $fields['parameters']['value']; - $path = $this->path . str_replace(' ', '', $fields['code']); /** @var ParametersForm $parametersForm */ $parametersForm = $this->blockFactory->create( - $path, + $this->getElementClass($fields), ['element' => $this->_rootElement->find($this->formSelector)] ); $parametersForm->fillForm($data, $element); return $this; } + + /** + * Get element class. + * + * @param array $fields + * @return string + */ + private function getElementClass(array $fields) + { + $path = $this->path . str_replace(' ', '', $fields['code']) . '.php'; + $path = str_replace('\\', DIRECTORY_SEPARATOR, MTF_TESTS_PATH . $path); + $paths = glob($path); + $path = str_replace([MTF_TESTS_PATH, '.php'], '', $paths[0]); + + return str_replace('/', '\\', $path); + } } diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/ParametersType/CatalogNewProductsList.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/ParametersType/CatalogNewProductsList.php new file mode 100644 index 0000000000000000000000000000000000000000..f86ce2c4cddd94c79275deb1282b033e3f2f418d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/ParametersType/CatalogNewProductsList.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Widget\Test\Block\Adminhtml\Widget\Instance\Edit\Tab\ParametersType; + +use Magento\Mtf\Fixture\InjectableFixture; + +/** + * Filling Widget Options that have catalog new products list type. + */ +class CatalogNewProductsList extends ParametersForm +{ + /** + * Catalog New Products List grid block. + * + * @var string + */ + protected $gridBlock = './ancestor::body//*[contains(@id, "options_fieldset")]//div[contains(@class, "main-col")]'; +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/ParametersType/CatalogNewProductsList.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/ParametersType/CatalogNewProductsList.xml new file mode 100644 index 0000000000000000000000000000000000000000..9adce39f8464b2ee742b58d69edbd05c2fee7b06 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/ParametersType/CatalogNewProductsList.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="1"> + <fields> + <display_type> + <selector>.control [name="parameters[display_type]"]</selector> + <input>select</input> + </display_type> + <show_pager> + <selector>.control [name="parameters[show_pager]"]</selector> + <input>select</input> + </show_pager> + <products_count> + <selector>.control [name="parameters[products_count]"]</selector> + </products_count> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/WidgetView.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/WidgetView.php index 4e0e3634ae3887e25ef035065497708d0b9ac9a5..e1a8bfcc990e5cc75ed07ee21736e88443872c09 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/WidgetView.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/WidgetView.php @@ -16,18 +16,18 @@ use Magento\Mtf\Client\Locator; class WidgetView extends Block { /** - * Widgets selectors. + * Widgets link selector. * - * @var array + * @var string */ - protected $widgetSelectors = [ - 'cmsPageLink' => '/descendant-or-self::div//a[contains(.,"%s")]', - 'catalogCategoryLink' => '//a[contains(.,"%s")]', - 'catalogProductLink' => '//a[contains(.,"%s")]', - 'recentlyComparedProducts' => '/descendant-or-self::div[contains(.,"%s")]', - 'recentlyViewedProducts' => '/descendant-or-self::div[contains(.,"%s")]', - 'cmsStaticBlock' => '/descendant-or-self::div[contains(.,"%s")]', - ]; + protected $widgetLinkSelector = '//a[contains(.,"%s")]'; + + /** + * Widgets selector. + * + * @var string + */ + protected $widgetSelector = '//div[contains(.,"%s")]'; /** * Check is visible widget selector. @@ -47,9 +47,9 @@ class WidgetView extends Block ['widget' => $widget, 'widgetText' => $widgetText] ); } else { - if (isset($this->widgetSelectors[$widgetType])) { + if (isset($this->widgetSelector)) { return $this->_rootElement->find( - sprintf($this->widgetSelectors[$widgetType], $widgetText), + sprintf($this->widgetSelector, $widgetText), Locator::SELECTOR_XPATH )->isVisible(); } else { @@ -72,9 +72,9 @@ class WidgetView extends Block if ($this->hasRender($widgetType)) { $this->callRender($widgetType, 'clickToWidget', ['widget' => $widget, 'widgetText' => $widgetText]); } else { - if (isset($this->widgetSelectors[$widgetType])) { + if (isset($this->widgetLinkSelector)) { $this->_rootElement->find( - sprintf($this->widgetSelectors[$widgetType], $widgetText), + sprintf($this->widgetLinkSelector, $widgetText), Locator::SELECTOR_XPATH )->click(); } else { diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetAbsentOnFrontendHome.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetAbsentOnFrontendHome.php index 0de089a7aee5d085b6c1358e42322b33c3217801..f45b6184eec24506e6affa9b6fd24ea6d5a4fdf4 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetAbsentOnFrontendHome.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetAbsentOnFrontendHome.php @@ -6,34 +6,35 @@ namespace Magento\Widget\Test\Constraint; -use Magento\PageCache\Test\Page\Adminhtml\AdminCache; use Magento\Cms\Test\Page\CmsIndex; use Magento\Widget\Test\Fixture\Widget; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Util\Command\Cli\Cache; /** - * Check that created widget does NOT displayed on frontend on Home page + * Check that created widget does NOT displayed on frontend on Home page. */ class AssertWidgetAbsentOnFrontendHome extends AbstractConstraint { /** - * Assert that created widget is absent on frontend on Home page + * Assert that created widget is absent on frontend on Home page. * * @param CmsIndex $cmsIndex * @param Widget $widget - * @param AdminCache $adminCache + * @param Cache $cache + * @param array $caches [optional] * @return void */ public function processAssert( CmsIndex $cmsIndex, Widget $widget, - AdminCache $adminCache + Cache $cache, + array $caches = [] ) { // Flush cache - $adminCache->open(); - $adminCache->getActionsBlock()->flushMagentoCache(); - $adminCache->getMessagesBlock()->waitSuccessMessage(); - + if (!in_array('Invalidated', $caches)) { + $cache->flush(); + } $cmsIndex->open(); $widgetText = $widget->getParameters()['anchor_text']; \PHPUnit_Framework_Assert::assertFalse( @@ -43,7 +44,7 @@ class AssertWidgetAbsentOnFrontendHome extends AbstractConstraint } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string * @return string diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCatalogCategoryLink.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCatalogCategoryLink.php index 6fc8d33130cd77136f633f3c40b74bfa836e9b58..e66899b6580757e99805fef84e1f02e8420f05a5 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCatalogCategoryLink.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCatalogCategoryLink.php @@ -6,7 +6,7 @@ namespace Magento\Widget\Test\Constraint; -use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Mtf\Util\Command\Cli\Cache; use Magento\Catalog\Test\Page\Category\CatalogCategoryView; use Magento\Cms\Test\Page\CmsIndex; use Magento\Widget\Test\Fixture\Widget; @@ -29,19 +29,17 @@ class AssertWidgetCatalogCategoryLink extends AbstractConstraint * @param CmsIndex $cmsIndex * @param CatalogCategoryView $categoryView * @param Widget $widget - * @param AdminCache $adminCache + * @param Cache $cache * @return void */ public function processAssert( CmsIndex $cmsIndex, CatalogCategoryView $categoryView, Widget $widget, - AdminCache $adminCache + Cache $cache ) { // Flush cache - $adminCache->open(); - $adminCache->getActionsBlock()->flushMagentoCache(); - $adminCache->getMessagesBlock()->waitSuccessMessage(); + $cache->flush(); $cmsIndex->open(); $widgetText = $widget->getParameters()['anchor_text']; diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCatalogNewProductsList.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCatalogNewProductsList.php new file mode 100644 index 0000000000000000000000000000000000000000..dbb9a5012c0945525bb68cec6f369edb673aa809 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCatalogNewProductsList.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Widget\Test\Constraint; + +use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Widget\Test\Fixture\Widget; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; + +/** + * Check that created Catalog New Products List widget displayed on frontend on Category Page. + */ +class AssertWidgetCatalogNewProductsList extends AbstractConstraint +{ + /** + * Category Page on Frontend. + * + * @var CatalogCategoryView + */ + protected $catalogCategoryView; + + /** + * Assert that created Catalog New Products List widget displayed on frontend on Category Page. + * + * @param CmsIndex $cmsIndex + * @param CatalogCategoryView $catalogCategoryView + * @param CatalogProductSimple $productSimple1 + * @param CatalogProductSimple $productSimple2 + * @param Widget $widget + * @param AdminCache $adminCache + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + CatalogCategoryView $catalogCategoryView, + CatalogProductSimple $productSimple1, + CatalogProductSimple $productSimple2, + Widget $widget, + AdminCache $adminCache + ) { + $this->catalogCategoryView = $catalogCategoryView; + + // Flush cache + $adminCache->open(); + $adminCache->getActionsBlock()->flushMagentoCache(); + $adminCache->getMessagesBlock()->waitSuccessMessage(); + + $productSimple1->persist(); + $productSimple2->persist(); + $products[] = $productSimple2->getName(); + $products[] = $productSimple1->getName(); + + $cmsIndex->open(); + $categoryName = $widget->getWidgetInstance()[0]['entities']->getName(); + $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); + \PHPUnit_Framework_Assert::assertTrue( + $catalogCategoryView->getWidgetView()->isWidgetVisible($widget, 'New Products'), + 'Widget is absent on Category page.' + ); + \PHPUnit_Framework_Assert::assertEquals( + $products, + $this->catalogCategoryView->getViewBlock()->getProductsFromCatalogNewProductsListBlock(), + 'There are wrong products or products are absent on Catalog New Products List block on Category page.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return "Catalog New Products List widget is present on Category page."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php index 448b9be9fc68f74888ff4fe48436ebb88c82ec9b..e0369dde574589bc4234191ef45636f99ce38dcf 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetCmsPageLink.php @@ -6,7 +6,7 @@ namespace Magento\Widget\Test\Constraint; -use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Mtf\Util\Command\Cli\Cache; use Magento\Cms\Test\Page\CmsIndex; use Magento\Widget\Test\Fixture\Widget; use Magento\Mtf\Constraint\AbstractConstraint; @@ -23,18 +23,16 @@ class AssertWidgetCmsPageLink extends AbstractConstraint * * @param CmsIndex $cmsIndex * @param Widget $widget - * @param AdminCache $adminCache + * @param Cache $cache * @return void */ public function processAssert( CmsIndex $cmsIndex, Widget $widget, - AdminCache $adminCache + Cache $cache ) { // Flush cache - $adminCache->open(); - $adminCache->getActionsBlock()->flushMagentoCache(); - $adminCache->getMessagesBlock()->waitSuccessMessage(); + $cache->flush(); $cmsIndex->open(); $widgetText = $widget->getParameters()['anchor_text']; diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetOnFrontendInCatalog.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetOnFrontendInCatalog.php index d3af59e62a9fd0ca43eb8c9b8004a549a07dde06..4825fd4958ff845b5113635e2f3ee852852286e3 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetOnFrontendInCatalog.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetOnFrontendInCatalog.php @@ -6,36 +6,34 @@ namespace Magento\Widget\Test\Constraint; -use Magento\PageCache\Test\Page\Adminhtml\AdminCache; use Magento\Catalog\Test\Page\Category\CatalogCategoryView; use Magento\Cms\Test\Page\CmsIndex; use Magento\Widget\Test\Fixture\Widget; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Util\Command\Cli\Cache; /** - * Check that created widget displayed on frontent in Catalog. + * Check that created widget displayed on frontend in Catalog. */ class AssertWidgetOnFrontendInCatalog extends AbstractConstraint { /** - * Assert that created widget displayed on frontent in Catalog. + * Assert that created widget displayed on frontend in Catalog. * * @param CmsIndex $cmsIndex * @param CatalogCategoryView $catalogCategoryView * @param Widget $widget - * @param AdminCache $adminCache + * @param Cache $cache * @return void */ public function processAssert( CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, Widget $widget, - AdminCache $adminCache + Cache $cache ) { // Flush cache - $adminCache->open(); - $adminCache->getActionsBlock()->flushMagentoCache(); - $adminCache->getMessagesBlock()->waitSuccessMessage(); + $cache->flush(); $cmsIndex->open(); if (isset($widget->getWidgetInstance()[0]['entities'])) { diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetOnProductPage.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetOnProductPage.php index ebdc3ececd062e3af4f326362c0d00f0701415d3..4912d2457b78dc7de25c657d38bfb80a5da847b9 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetOnProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetOnProductPage.php @@ -6,7 +6,7 @@ namespace Magento\Widget\Test\Constraint; -use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Mtf\Util\Command\Cli\Cache; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Widget\Test\Fixture\Widget; use Magento\Mtf\Client\BrowserInterface; @@ -23,19 +23,17 @@ class AssertWidgetOnProductPage extends AbstractConstraint * @param CatalogProductView $productView * @param BrowserInterface $browser * @param Widget $widget - * @param AdminCache $adminCache + * @param Cache $cache * @return void */ public function processAssert( CatalogProductView $productView, BrowserInterface $browser, Widget $widget, - AdminCache $adminCache + Cache $cache ) { // Flush cache - $adminCache->open(); - $adminCache->getActionsBlock()->flushMagentoCache(); - $adminCache->getMessagesBlock()->waitSuccessMessage(); + $cache->flush(); $urlKey = $widget->getWidgetInstance()[0]['entities']['url_key']; $browser->open($_ENV['app_frontend_url'] . $urlKey . '.html'); diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetProductLink.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetProductLink.php index 94cdded4b3234d8256b22d25f97753c43f04a736..28766632edd6b705444be93da2b2e4fd3db55117 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetProductLink.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetProductLink.php @@ -6,7 +6,7 @@ namespace Magento\Widget\Test\Constraint; -use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Mtf\Util\Command\Cli\Cache; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Cms\Test\Page\CmsIndex; use Magento\Widget\Test\Fixture\Widget; @@ -23,19 +23,17 @@ class AssertWidgetProductLink extends AbstractConstraint * @param CmsIndex $cmsIndex * @param CatalogProductView $productView * @param Widget $widget - * @param AdminCache $adminCache + * @param Cache $cache * @return void */ public function processAssert( CmsIndex $cmsIndex, CatalogProductView $productView, Widget $widget, - AdminCache $adminCache + Cache $cache ) { // Flush cache - $adminCache->open(); - $adminCache->getActionsBlock()->flushMagentoCache(); - $adminCache->getMessagesBlock()->waitSuccessMessage(); + $cache->flush(); $cmsIndex->open(); $cmsIndex->getTopmenu()->selectCategoryByName($widget->getWidgetInstance()[0]['entities']->getName()); diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetRecentlyComparedProducts.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetRecentlyComparedProducts.php index 3a9eab2ff8c4395dd77aead3528509fff990f156..745c3afe0aa91cc794d99e7312b620128d3306b4 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetRecentlyComparedProducts.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetRecentlyComparedProducts.php @@ -6,7 +6,7 @@ namespace Magento\Widget\Test\Constraint; -use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Mtf\Util\Command\Cli\Cache; use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Catalog\Test\Page\Product\CatalogProductCompare; use Magento\Catalog\Test\Page\Product\CatalogProductView; @@ -58,7 +58,7 @@ class AssertWidgetRecentlyComparedProducts extends AbstractConstraint * @param Widget $widget * @param CatalogProductSimple $productSimple1 * @param CatalogProductSimple $productSimple2 - * @param AdminCache $adminCache + * @param Cache $cache * @var string * @return void */ @@ -70,12 +70,10 @@ class AssertWidgetRecentlyComparedProducts extends AbstractConstraint Widget $widget, CatalogProductSimple $productSimple1, CatalogProductSimple $productSimple2, - AdminCache $adminCache + Cache $cache ) { // Flush cache - $adminCache->open(); - $adminCache->getActionsBlock()->flushMagentoCache(); - $adminCache->getMessagesBlock()->waitSuccessMessage(); + $cache->flush(); $this->catalogProductCompare = $catalogProductCompare; $this->catalogProductView = $catalogProductView; diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetRecentlyViewedProducts.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetRecentlyViewedProducts.php index 30a8c755b5d0675662e0ec5a3cf7c263ff291dff..f2d4a3146fc3aadbfb47eab26d62104e166c48f6 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetRecentlyViewedProducts.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Constraint/AssertWidgetRecentlyViewedProducts.php @@ -6,7 +6,7 @@ namespace Magento\Widget\Test\Constraint; -use Magento\PageCache\Test\Page\Adminhtml\AdminCache; +use Magento\Mtf\Util\Command\Cli\Cache; use Magento\Catalog\Test\Fixture\Category; use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Catalog\Test\Page\Category\CatalogCategoryView; @@ -45,7 +45,7 @@ class AssertWidgetRecentlyViewedProducts extends AbstractConstraint * Assert that widget with type Recently Viewed Products is present on category page * * @param CmsIndex $cmsIndex - * @param AdminCache $adminCache + * @param Cache $cache * @param CatalogCategoryView $catalogCategoryView * @param BrowserInterface $browser * @param CatalogProductSimple $productSimple @@ -55,7 +55,7 @@ class AssertWidgetRecentlyViewedProducts extends AbstractConstraint */ public function processAssert( CmsIndex $cmsIndex, - AdminCache $adminCache, + Cache $cache, CatalogCategoryView $catalogCategoryView, BrowserInterface $browser, CatalogProductSimple $productSimple, @@ -67,9 +67,7 @@ class AssertWidgetRecentlyViewedProducts extends AbstractConstraint $this->catalogCategoryView = $catalogCategoryView; // Flush cache - $adminCache->open(); - $adminCache->getActionsBlock()->flushMagentoCache(); - $adminCache->getMessagesBlock()->waitSuccessMessage(); + $cache->flush(); // Log in customer $customer->persist(); diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget/Parameters.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget/Parameters.xml index 46e71d910006a3481ab023b14746d55cd900a0f0..6b1651de83234d8baa1ae7774f3e6138ba872960 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget/Parameters.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget/Parameters.xml @@ -31,10 +31,10 @@ </field> </dataset> - <dataset name="catalogNewProductList"> + <dataset name="catalogNewProductsList"> <field name="display_type" xsi:type="string">All products</field> - <field name="show_pager" xsi:type="string">Yes</field> - <field name="products_count" xsi:type="string">4</field> + <field name="show_pager" xsi:type="string">No</field> + <field name="products_count" xsi:type="string">2</field> </dataset> <dataset name="catalogProductLink"> diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget/WidgetInstance.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget/WidgetInstance.xml index 7c417cd0a902b802781217e984dd0ed445f4cbbb..b463ef34f6855be0eca87f1cb28b207789051eb2 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget/WidgetInstance.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Repository/Widget/WidgetInstance.xml @@ -41,6 +41,16 @@ </field> </dataset> + <dataset name="for_new_products_list"> + <field name="0" xsi:type="array"> + <item name="page_group" xsi:type="string">Categories/Non-Anchor Categories</item> + <item name="for" xsi:type="string">Yes</item> + <item name="entities" xsi:type="string">category::default_subcategory</item> + <item name="block" xsi:type="string">Main Content Area</item> + <item name="template" xsi:type="string">New Products List Template</item> + </field> + </dataset> + <dataset name="for_compared_products"> <field name="0" xsi:type="array"> <item name="page_group" xsi:type="string">Generic Pages/All Pages</item> diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php index 123e5381e69191dc5607d489eb510c8b2d498cd5..235361aee8b7eea30618663ecf1067a6dbc303a0 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/AbstractCreateWidgetEntityTest.php @@ -6,11 +6,12 @@ namespace Magento\Widget\Test\TestCase; -use Magento\Widget\Test\Fixture\Widget; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceEdit; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceIndex; use Magento\Widget\Test\Page\Adminhtml\WidgetInstanceNew; use Magento\Mtf\TestCase\Injectable; +use Magento\Mtf\Util\Command\Cli\Cache; +use Magento\Cms\Test\Page\CmsIndex; /** * Test Creation for New Instance of WidgetEntity. @@ -38,22 +39,42 @@ abstract class AbstractCreateWidgetEntityTest extends Injectable */ protected $widgetInstanceEdit; + /** + * CmsIndex page. + * + * @var WidgetInstanceIndex + */ + protected $cmsIndex; + + /** + * Handle cache for tests executions. + * + * @var Cache + */ + protected $cache; + /** * Injection data. * * @param WidgetInstanceIndex $widgetInstanceIndex * @param WidgetInstanceNew $widgetInstanceNew * @param WidgetInstanceEdit $widgetInstanceEdit + * @param CmsIndex $cmsIndex + * @param Cache $cache * @return void */ public function __inject( WidgetInstanceIndex $widgetInstanceIndex, WidgetInstanceNew $widgetInstanceNew, - WidgetInstanceEdit $widgetInstanceEdit + WidgetInstanceEdit $widgetInstanceEdit, + CmsIndex $cmsIndex, + Cache $cache ) { $this->widgetInstanceIndex = $widgetInstanceIndex; $this->widgetInstanceNew = $widgetInstanceNew; $this->widgetInstanceEdit = $widgetInstanceEdit; + $this->cmsIndex = $cmsIndex; + $this->cache = $cache; } /** diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php index 46383765d2520f5fe09d044b44dc592d870d76eb..0583cacb1a40bf655c9c146a3c13a6d1bb71efa9 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.php @@ -29,18 +29,61 @@ class CreateWidgetEntityTest extends AbstractCreateWidgetEntityTest const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ + /** + * Cache data. + * + * @var array + */ + private $caches = []; + /** * Create for New Widget. * * @param Widget $widget + * @param array $caches [optional] * @return void */ - public function test(Widget $widget) + public function test(Widget $widget, array $caches = []) { + // Preconditions + $this->caches = $caches; + $this->adjustCacheSettings(); + // Steps $this->widgetInstanceIndex->open(); $this->widgetInstanceIndex->getPageActionsBlock()->addNew(); $this->widgetInstanceNew->getWidgetForm()->fill($widget); $this->widgetInstanceEdit->getPageActionsBlock()->save(); } + + /** + * Adjust cache settings. + * + * @return void + */ + private function adjustCacheSettings() + { + $this->cache->flush(); + foreach ($this->caches as $cacheType => $cacheStatus) { + if ($cacheStatus === 'Disabled') { + $this->cache->disableCache($cacheType); + } + } + if (in_array('Invalidated', $this->caches)) { + $this->cmsIndex->open(); + } + } + + /** + * Enable and flush all cache. + * + * return void + */ + public function tearDown() + { + parent::tearDown(); + if (!empty($this->caches)) { + $this->cache->enableCache(); + } + } } diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml index 9f7640830b074964564085d81d07d552200e57e5..42d81d2f16c812933292f6355c2a0e5eb0842f88 100644 --- a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/CreateWidgetEntityTest.xml @@ -76,5 +76,43 @@ <constraint name="Magento\Widget\Test\Constraint\AssertWidgetOnFrontendInCatalog" /> <constraint name="Magento\Widget\Test\Constraint\AssertWidgetProductLink" /> </variation> + <variation name="CreateWidgetEntityTestVariation7" summary="Assert widget with disabled block_html cache type"> + <data name="caches/block_html" xsi:type="string">Disabled</data> + <data name="widget/data/code" xsi:type="string">CMS Static Block</data> + <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data> + <data name="widget/data/title" xsi:type="string">Title_%isolation%</data> + <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data> + <data name="widget/data/widget_instance/dataset" xsi:type="string">on_category</data> + <data name="widget/data/parameters/dataset" xsi:type="string">cmsStaticBlock</data> + <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" /> + <constraint name="Magento\PageCache\Test\Constraint\AssertCacheInvalidatePopUp" /> + <constraint name="Magento\PageCache\Test\Constraint\AssertCacheInvalidateNotice" /> + <constraint name="Magento\PageCache\Test\Constraint\AssertCacheStatus" /> + <constraint name="Magento\Widget\Test\Constraint\AssertWidgetOnFrontendInCatalog" /> + </variation> + <variation name="CreateWidgetEntityTestVariation8" summary="Assert widget with invalidated block_html cache type"> + <data name="caches/block_html" xsi:type="string">Invalidated</data> + <data name="widget/data/code" xsi:type="string">Catalog Category Link</data> + <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data> + <data name="widget/data/title" xsi:type="string">Title_%isolation%</data> + <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data> + <data name="widget/data/widget_instance/dataset" xsi:type="string">for_category_link</data> + <data name="widget/data/parameters/dataset" xsi:type="string">catalogCategoryLink</data> + <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" /> + <constraint name="Magento\PageCache\Test\Constraint\AssertCacheInvalidatePopUp" /> + <constraint name="Magento\PageCache\Test\Constraint\AssertCacheInvalidateNotice" /> + <constraint name="Magento\PageCache\Test\Constraint\AssertCacheStatus" /> + <constraint name="Magento\Widget\Test\Constraint\AssertWidgetAbsentOnFrontendHome" /> + </variation> + <variation name="CreateWidgetEntityTestVariation9" summary="Create Catalog New Products List type widget"> + <data name="widget/data/code" xsi:type="string">Catalog New Products List</data> + <data name="widget/data/theme_id" xsi:type="string">Magento Luma</data> + <data name="widget/data/title" xsi:type="string">Title_%isolation%</data> + <data name="widget/data/store_ids/dataset" xsi:type="string">all_store_views</data> + <data name="widget/data/widget_instance/dataset" xsi:type="string">for_new_products_list</data> + <data name="widget/data/parameters/dataset" xsi:type="string">catalogNewProductsList</data> + <constraint name="Magento\Widget\Test\Constraint\AssertWidgetSuccessSaveMessage" /> + <constraint name="Magento\Widget\Test\Constraint\AssertWidgetCatalogNewProductsList" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/utils/command.php b/dev/tests/functional/utils/command.php index da1775f6f340ab3a1cac411f41daeb533721f473..4061b07c783e4b0e8cbf4a7e4daa08d445834f68 100644 --- a/dev/tests/functional/utils/command.php +++ b/dev/tests/functional/utils/command.php @@ -6,7 +6,7 @@ if (isset($_GET['command'])) { $command = urldecode($_GET['command']); - exec('../../../../bin/magento ' . $command); + exec('php -f ../../../../bin/magento ' . $command); } else { throw new \Exception("Command GET parameter is not set."); }