From ea50a0e86f337b2dc9ee51e6eeeb9e756ad2a8d7 Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Thu, 9 Feb 2017 12:51:24 +0300 Subject: [PATCH 01/18] MTO-112: [Variation] Use Layered Navigation by Price (Navigation Step = Manual, MySQL) - Functional test implemented --- .../Test/TestCase/FilterProductListTest.php | 22 ++++++++++-- .../Test/TestCase/FilterProductListTest.xml | 34 +++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php index 30e3d28ecf97b..efafa0585b098 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php @@ -7,13 +7,16 @@ namespace Magento\LayeredNavigation\Test\TestCase; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Catalog\Test\Fixture\Category; use Magento\Mtf\TestCase\Injectable; +use Magento\Mtf\Util\Command\Cli\Cache; +use Magento\Mtf\Util\Command\Cli\Indexer; /** * Preconditions: * 1. Setup Layered Navigation configuration. + * 2. Run full reindex. + * 3. Clear cache. * * Steps: * 1. Create category. @@ -41,10 +44,20 @@ class FilterProductListTest extends Injectable * * @param string $configData * @param Category $category + * @param Indexer $indexer + * @param Cache $cache + * @param string $runReindex + * @param string $flushCache * @return array */ - public function test($configData, Category $category) - { + public function test( + $configData, + Category $category, + Indexer $indexer, + Cache $cache, + $runReindex = "No", + $flushCache = "No" + ) { $this->configData = $configData; // Preconditions @@ -53,6 +66,9 @@ public function test($configData, Category $category) ['configData' => $this->configData] )->run(); + $runReindex == 'Yes' ? $indexer->reindex() : null; + $flushCache == 'Yes' ? $cache->flush() : null; + // Steps $category->persist(); } diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml index 9f9279d31ce75..7b4245768c419 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml @@ -113,5 +113,39 @@ + + layered_navigation_manual_range_10 + Yes + Yes + default_anchor_subcategory + + catalogProductSimple::product_1_dollar, catalogProductSimple::product_5_dollar, catalogProductSimple::product_9_99_dollar, catalogProductSimple::product_10_dollar, catalogProductSimple::product_15_dollar, catalogProductSimple::product_21_dollar + + + + + Price + `^.+0\.00 - .+9\.99 3$`m + product_0, product_1, product_2 + + + + + Price + `^.+10\.00 - .+19\.99 2$`m + product_3, product_4 + + + + + Price + `^.+20\.00 and above 1$`m + product_5 + + + + + + From 149d7d307418cdbe31b260e84df6c88aac4dff7c Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Fri, 10 Feb 2017 12:36:48 +0300 Subject: [PATCH 02/18] MTO-108: [Test] Observe Different Base Currency per Website - Test implemented --- .../Catalog/Test/Block/AbstractPriceBlock.php | 11 ++ .../Catalog/Test/Block/Product/Price.php | 10 ++ ...rrencySymbolOnProductPageCustomWebsite.php | 57 ++++++++ ...CurrencySymbolOnProductPageMainWebsite.php | 55 ++++++++ .../Test/Repository/ConfigData.xml | 22 +++ .../EditCurrencyCustomWebsiteTest.php | 126 ++++++++++++++++++ .../EditCurrencyCustomWebsiteTest.xml | 31 +++++ 7 files changed, 312 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php create mode 100644 dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php create mode 100644 dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php create mode 100644 dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php index 1e906b91cf18f..97403ae18a39e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php @@ -35,6 +35,17 @@ protected function getTypePrice($type, $currency = '$') return $typePriceElement->isVisible() ? $this->trimPrice($typePriceElement->getText(), $currency) : null; } + /** + * Get price with currency symbol. + * + * @param string $type + * @return string|null + */ + protected function getTypePriceWithCurrencySymbol($type) + { + return $this->getTypePriceElement($type)->getText(); + } + /** * Get specify type price element. * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php index 729aa0ed0be66..aae918d8106aa 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php @@ -77,6 +77,16 @@ public function getSpecialPrice($currency = '$') return $this->getTypePrice('special_price', $currency); } + /** + * This method returns price with currency symbol represented by the block. + * + * @return string|null + */ + public function getPriceWithCurrency() + { + return $this->getTypePriceWithCurrencySymbol('regular_price'); + } + /** * This method returns the old price represented by the block. * diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php new file mode 100644 index 0000000000000..2ecdbc9515975 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php @@ -0,0 +1,57 @@ +getDataFieldConfig('website_ids')['source']->getWebsites()[0]; + $url = $_ENV['app_frontend_url'] . 'websites/' . $website->getCode() . '/' . $product->getUrlKey() . '.html'; + $browser->open($url); + $price = $catalogProductView->getViewBlock()->getPriceBlock()->getPriceWithCurrency(); + preg_match('`(.*?)\d`', $price, $matches); + + $symbolOnPage = isset($matches[1]) ? $matches[1] : null; + \PHPUnit_Framework_Assert::assertEquals( + $currencySymbol['customWebsite'], + $symbolOnPage, + 'Wrong Currency Symbol is displayed on Product page in Custom website.' + ); + } + + /** + * Returns a string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Correct Currency Symbol displayed on Product page in Custom website."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php new file mode 100644 index 0000000000000..a1ba67950bc95 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php @@ -0,0 +1,55 @@ +open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $price = $catalogProductView->getViewBlock()->getPriceBlock()->getPriceWithCurrency(); + preg_match('`(.*?)\d`', $price, $matches); + + $symbolOnPage = isset($matches[1]) ? $matches[1] : null; + \PHPUnit_Framework_Assert::assertEquals( + $currencySymbol['mainWebsite'], + $symbolOnPage, + 'Wrong Currency Symbol is displayed on Product page in the Main Website.' + ); + } + + /** + * Returns a string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Correct Currency Symbol displayed on Product page in the Main Website."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml index d892968b5cf49..5fde907e668e8 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml @@ -61,6 +61,28 @@ + + + currency + 1 + + EUR + + + + currency + Euro + 1 + EUR + + + currency + Euro + 1 + EUR + + + currency diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php new file mode 100644 index 0000000000000..eb8bf428538a7 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php @@ -0,0 +1,126 @@ +fixtureFactory = $fixtureFactory; + $this->stepFactory = $stepFactory; + } + + /** + * Change Currency on Custom Website test. + * + * @param string $configData + * @param string $product + * @param Store $store + * @param array|null $currencies + * @return void + */ + public function test($configData, $product, Store $store, array $currencies = []) + { + // Preconditions + $this->stepFactory->create( + \Magento\Config\Test\TestStep\SetupConfigurationStep::class, + ['configData' => $configData] + )->run(); + + $store->persist(); + $product = $this->fixtureFactory->createByCode( + 'catalogProductSimple', + ['dataset' => $product['dataset'], 'data' => ['website_ids' => [['store' => $store]]]] + ); + $product->persist(); + $websites = $product->getDataFieldConfig('website_ids')['source']->getWebsites(); + + // Steps + $configFixture = $this->fixtureFactory->createByCode( + 'configData', + [ + 'data' => [ + 'currency/options/allow' => [ + 'value' => $currencies[0]['allowedCurrencies'] + ], + 'currency/options/base' => [ + 'value' => $currencies[0]['baseCurrency'] + ], + 'currency/options/default' => [ + 'value' => $currencies[0]['defaultCurrency'] + ], + 'scope' => [ + 'fixture' => $websites[0], + 'scope_type' => 'website', + 'website_id' => $websites[0]->getWebsiteId(), + 'set_level' => 'website', + ] + ] + ] + ); + $configFixture->persist(); + + return [ + 'product' => $product, + ]; + } + + /** + * Reverting of currency settings to the default value. + * + * @return void + */ + public function tearDown() + { + $this->stepFactory->create( + \Magento\Config\Test\TestStep\SetupConfigurationStep::class, + ['configData' => 'config_currency_symbols_usd, price_scope_website_rollback'] + )->run(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml new file mode 100644 index 0000000000000..2ad7856f675f6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml @@ -0,0 +1,31 @@ + + + + + + price_scope_website + product_with_category + custom_store + + + + EUR + + EUR + EUR + + + + $ + + + + + + + From de140ed27c8133d6aeb9eed00cf62d346d45662a Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Mon, 13 Feb 2017 16:29:33 +0300 Subject: [PATCH 03/18] MTO-108: [Test] Observe Different Base Currency per Website - Defect fixed --- .../tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php index 97403ae18a39e..3b0b7c819e04a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php @@ -39,7 +39,7 @@ protected function getTypePrice($type, $currency = '$') * Get price with currency symbol. * * @param string $type - * @return string|null + * @return string */ protected function getTypePriceWithCurrencySymbol($type) { From 85965cc3a5a63cb3f7c417a1c097ec0facd8e6a5 Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Mon, 13 Feb 2017 18:11:33 +0300 Subject: [PATCH 04/18] MTO-112: [Variation] Use Layered Navigation by Price (Navigation Step = Manual, MySQL) - Edit 'flushCache' method --- .../Test/TestCase/FilterProductListTest.php | 20 +++++++++++-------- .../Test/TestCase/FilterProductListTest.xml | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php index efafa0585b098..fb8ed5de37b9e 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php @@ -9,7 +9,6 @@ use Magento\Catalog\Test\Fixture\Category; use Magento\Mtf\TestCase\Injectable; -use Magento\Mtf\Util\Command\Cli\Cache; use Magento\Mtf\Util\Command\Cli\Indexer; /** @@ -39,35 +38,40 @@ class FilterProductListTest extends Injectable */ protected $configData; + /** + * Should cache be flushed. + * + * @var bool + */ + private $flushCache; + /** * Filtering product in the Frontend via layered navigation. * * @param string $configData * @param Category $category * @param Indexer $indexer - * @param Cache $cache * @param string $runReindex - * @param string $flushCache + * @param bool $flushCache * @return array */ public function test( $configData, Category $category, Indexer $indexer, - Cache $cache, $runReindex = "No", - $flushCache = "No" + $flushCache = false ) { $this->configData = $configData; + $this->flushCache = $flushCache; // Preconditions $this->objectManager->create( \Magento\Config\Test\TestStep\SetupConfigurationStep::class, - ['configData' => $this->configData] + ['configData' => $this->configData, 'flushCache' => $this->flushCache] )->run(); $runReindex == 'Yes' ? $indexer->reindex() : null; - $flushCache == 'Yes' ? $cache->flush() : null; // Steps $category->persist(); @@ -82,7 +86,7 @@ public function tearDown() { $this->objectManager->create( \Magento\Config\Test\TestStep\SetupConfigurationStep::class, - ['configData' => $this->configData, 'rollback' => true] + ['configData' => $this->configData, 'rollback' => true, 'flushCache' => $this->flushCache] )->run(); } } diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml index 7b4245768c419..8f07c1b8e76ee 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml @@ -113,10 +113,10 @@ - + layered_navigation_manual_range_10 Yes - Yes + true default_anchor_subcategory catalogProductSimple::product_1_dollar, catalogProductSimple::product_5_dollar, catalogProductSimple::product_9_99_dollar, catalogProductSimple::product_10_dollar, catalogProductSimple::product_15_dollar, catalogProductSimple::product_21_dollar From 10cde3e03fbf6c2132e4e25ac8e21aa7d165d2aa Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Mon, 13 Feb 2017 18:57:53 +0300 Subject: [PATCH 05/18] MTO-112: [Variation] Use Layered Navigation by Price (Navigation Step = Manual, MySQL) - Defects fixed. --- .../Test/TestCase/FilterProductListTest.php | 8 +++++--- .../Test/TestCase/FilterProductListTest.xml | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php index fb8ed5de37b9e..504e7b3423ea0 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php @@ -51,7 +51,7 @@ class FilterProductListTest extends Injectable * @param string $configData * @param Category $category * @param Indexer $indexer - * @param string $runReindex + * @param bool $runReindex * @param bool $flushCache * @return array */ @@ -59,7 +59,7 @@ public function test( $configData, Category $category, Indexer $indexer, - $runReindex = "No", + $runReindex = false, $flushCache = false ) { $this->configData = $configData; @@ -71,7 +71,9 @@ public function test( ['configData' => $this->configData, 'flushCache' => $this->flushCache] )->run(); - $runReindex == 'Yes' ? $indexer->reindex() : null; + if ($runReindex) { + $indexer->reindex(); + } // Steps $category->persist(); diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml index 8f07c1b8e76ee..af77e4d0a9b2b 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml @@ -10,7 +10,7 @@ test_type:acceptance_test, test_type:extended_acceptance_test layered_navigation_manual_range_10 - Yes + true default_anchor_subcategory catalogProductSimple::product_20_dollar, configurableProduct::filterable_two_options_with_zero_price @@ -35,7 +35,7 @@ test_type:acceptance_test, test_type:extended_acceptance_test layered_navigation_automatic_equalize_price_range - Yes + true default_anchor_subcategory catalogProductSimple::product_1_dollar, catalogProductSimple::product_5_dollar, catalogProductSimple::product_9_99_dollar, catalogProductSimple::product_10_dollar, catalogProductSimple::product_15_dollar, catalogProductSimple::product_21_dollar @@ -69,7 +69,7 @@ test_type:acceptance_test, test_type:extended_acceptance_test layered_navigation_automatic_equalize_product_counts - Yes + true default_anchor_subcategory catalogProductSimple::product_1_dollar, catalogProductSimple::product_5_dollar, catalogProductSimple::product_9_99_dollar, catalogProductSimple::product_10_dollar, catalogProductSimple::product_15_dollar, catalogProductSimple::product_21_dollar @@ -115,7 +115,7 @@ layered_navigation_manual_range_10 - Yes + true true default_anchor_subcategory From b4503fde0544f44122e790b71c0b82793397ab9b Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Mon, 13 Feb 2017 19:00:48 +0300 Subject: [PATCH 06/18] MTO-112: [Variation] Use Layered Navigation by Price (Navigation Step = Manual, MySQL) - Defects fixed. --- .../LayeredNavigation/Test/TestCase/FilterProductListTest.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml index af77e4d0a9b2b..f6046b1f984df 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.xml @@ -144,7 +144,6 @@ - From 40c5f527007cd5faec289bb5c3eafa56ada6a72f Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Tue, 14 Feb 2017 10:59:32 +0300 Subject: [PATCH 07/18] MTO-112: [Variation] Use Layered Navigation by Price (Navigation Step = Manual, MySQL) - Blank line deleted. --- .../LayeredNavigation/Test/TestCase/FilterProductListTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php index 504e7b3423ea0..1960f94a1a651 100644 --- a/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php +++ b/dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/TestCase/FilterProductListTest.php @@ -1,5 +1,4 @@ Date: Mon, 13 Feb 2017 15:22:37 +0300 Subject: [PATCH 08/18] MTO-117: [Variation] Use attribute in the Advanced Search - Variations added --- .../Repository/CatalogProductAttribute.xml | 24 +++++++++ .../UpdateProductAttributeEntityTest.php | 2 +- .../UpdateProductAttributeEntityTest.xml | 17 +++++++ .../AssertAdvancedSearchAttributeIsAbsent.php | 49 +++++++++++++++++++ 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php 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 91f23574f9b4d..8509ddb62ca51 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 @@ -84,6 +84,30 @@ + + attribute_multipleselect%isolation% + attribute_multipleselect%isolation% + Multiple Select + No + + + Yes + black + option_0_%isolation% + + + No + white + option_1_%isolation% + + + No + green + option_2_%isolation% + + + + attribute_dropdown%isolation% attribute_dropdown%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php index c6de3421867a5..808382c52d957 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php @@ -29,7 +29,7 @@ * 6. Perform all assertions * * @group Product_Attributes - * @ZephyrId MAGETWO-23459 + * @ZephyrId MAGETWO-23459, MAGETWO-12941 */ class UpdateProductAttributeEntityTest extends Injectable { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml index da6e2e4b953d9..bc632cfef6a50 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml @@ -66,5 +66,22 @@ + + custom_attribute_set + attribute_type_dropdown + Dropdown + Dropdown_%isolation% + Yes + No + + + + custom_attribute_set + attribute_type_dropdown + Dropdown_%isolation% + Yes + No + + diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php new file mode 100644 index 0000000000000..9d65c224dc189 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php @@ -0,0 +1,49 @@ +reindex(); + $advancedSearch->open(); + $formLabels = $advancedSearch->getForm()->getFormlabels(); + $label = $attribute->hasData('manage_frontend_label') + ? $attribute->getManageFrontendLabel() + : $attribute->getFrontendLabel(); + \PHPUnit_Framework_Assert::assertFalse( + in_array($label, $formLabels), + 'Attribute is present on advanced search form.' + ); + } + + /** + * Returns string representation of object. + * + * @return string + */ + public function toString() + { + return 'Attribute is absent on advanced search form.'; + } +} From 6f5d3c00a7424d520aa344eb10ccee681a052c9c Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Mon, 13 Feb 2017 17:54:32 +0300 Subject: [PATCH 09/18] MTO-117: [Variation] Use attribute in the Advanced Search - Functional implemented --- .../Catalog/Test/Repository/CatalogProductAttribute.xml | 4 ++-- .../ProductAttribute/CreateProductAttributeEntityTest.xml | 4 ++-- .../ProductAttribute/UpdateProductAttributeEntityTest.xml | 2 +- .../Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) 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 8509ddb62ca51..8020dd423a853 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 @@ -85,8 +85,8 @@ - attribute_multipleselect%isolation% - attribute_multipleselect%isolation% + multipleselect%isolation% + multipleselect%isolation% Multiple Select No diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml index e4ea37c7fb77d..39b9efa63efa8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml @@ -84,7 +84,7 @@ - + custom_attribute_set Multiple_Select_Admin_%isolation% Multiple Select @@ -114,7 +114,7 @@ - + test_type:extended_acceptance_test custom_attribute_set Dropdown_Admin_%isolation% diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml index bc632cfef6a50..dfc64d8eee8e4 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml @@ -77,7 +77,7 @@ custom_attribute_set - attribute_type_dropdown + attribute_type_multiple_select Dropdown_%isolation% Yes No diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php index 9d65c224dc189..4c7b3d22c3e0e 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php @@ -12,7 +12,7 @@ use Magento\Mtf\Util\Command\Cli\Indexer; /** - * Check whether attribute is displayed in the advanced search form on the frontend. + * Check whether attribute is absent in the advanced search form on the frontend. */ class AssertAdvancedSearchAttributeIsAbsent extends AbstractConstraint { @@ -21,6 +21,7 @@ class AssertAdvancedSearchAttributeIsAbsent extends AbstractConstraint * * @param CatalogProductAttribute $attribute * @param AdvancedSearch $advancedSearch + * @param Indexer $cli * @return void */ public function processAssert(CatalogProductAttribute $attribute, AdvancedSearch $advancedSearch, Indexer $cli) From f1327a01a86d0b5a728c835aa462779baf42639c Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Tue, 14 Feb 2017 12:30:54 +0300 Subject: [PATCH 10/18] MTO-117: [Variation] Use attribute in the Advanced Search - Defects fixed --- .../AssertAdvancedSearchAttributeIsAbsent.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php index 4c7b3d22c3e0e..0e9e391b5eca6 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php @@ -12,12 +12,12 @@ use Magento\Mtf\Util\Command\Cli\Indexer; /** - * Check whether attribute is absent in the advanced search form on the frontend. + * Assert that created custom product attribute is absent in the advanced search form on the frontend. */ class AssertAdvancedSearchAttributeIsAbsent extends AbstractConstraint { /** - * Check that the attribute is absent in the advanced search form on the frontend. + * Assert that created custom product attribute is absent in the advanced search form on the frontend. * * @param CatalogProductAttribute $attribute * @param AdvancedSearch $advancedSearch @@ -28,13 +28,13 @@ public function processAssert(CatalogProductAttribute $attribute, AdvancedSearch { $cli->reindex(); $advancedSearch->open(); - $formLabels = $advancedSearch->getForm()->getFormlabels(); + $formLabels = $advancedSearch->getForm()->getFormLabels(); $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel(); \PHPUnit_Framework_Assert::assertFalse( in_array($label, $formLabels), - 'Attribute is present on advanced search form.' + 'Created custom product attribute is present in advanced search form on frontend but must be absent.' ); } @@ -45,6 +45,6 @@ public function processAssert(CatalogProductAttribute $attribute, AdvancedSearch */ public function toString() { - return 'Attribute is absent on advanced search form.'; + return 'Created custom product attribute is absent in advanced search form on frontend.'; } } From 25e6257dac0d708529e37ba67ebe12de7d7ddb0e Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Tue, 14 Feb 2017 15:45:44 +0300 Subject: [PATCH 11/18] MTO-108: [Test] Observe Different Base Currency per Website - Defects fixed --- .../Catalog/Test/Block/AbstractPriceBlock.php | 11 --------- .../Catalog/Test/Block/Product/Price.php | 24 +++++++++++-------- ...rrencySymbolOnProductPageCustomWebsite.php | 24 +++++++++---------- ...CurrencySymbolOnProductPageMainWebsite.php | 24 +++++++++---------- .../EditCurrencyCustomWebsiteTest.php | 10 ++++---- .../EditCurrencyCustomWebsiteTest.xml | 7 ++++-- 6 files changed, 48 insertions(+), 52 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php index 3b0b7c819e04a..1e906b91cf18f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php @@ -35,17 +35,6 @@ protected function getTypePrice($type, $currency = '$') return $typePriceElement->isVisible() ? $this->trimPrice($typePriceElement->getText(), $currency) : null; } - /** - * Get price with currency symbol. - * - * @param string $type - * @return string - */ - protected function getTypePriceWithCurrencySymbol($type) - { - return $this->getTypePriceElement($type)->getText(); - } - /** * Get specify type price element. * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php index aae918d8106aa..c7f8d529e00a3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php @@ -77,16 +77,6 @@ public function getSpecialPrice($currency = '$') return $this->getTypePrice('special_price', $currency); } - /** - * This method returns price with currency symbol represented by the block. - * - * @return string|null - */ - public function getPriceWithCurrency() - { - return $this->getTypePriceWithCurrencySymbol('regular_price'); - } - /** * This method returns the old price represented by the block. * @@ -120,6 +110,20 @@ public function getPriceTo($currency = '$') return $this->getTypePrice('price_to', $currency); } + /** + * Get currency symbol. + * + * @param string $price + * @return string + */ + public function getCurrencySymbol($price) + { + preg_match('`(.*?)\d`', $price, $matches); + return $matches; + } + + + /** * Get price excluding tax. * diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php index 2ecdbc9515975..b41f7f4fa0110 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php @@ -6,27 +6,27 @@ namespace Magento\CurrencySymbol\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Mtf\Fixture\InjectableFixture; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Mtf\Client\BrowserInterface; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Check that correct currency symbol displayed on Product Page in Custom Website. + * Check that correct currency symbol displayed on Product Page on Custom Website. */ class AssertCurrencySymbolOnProductPageCustomWebsite extends AbstractConstraint { /** - * Assert that correct currency symbol displayed on Product Page in Custom Website. + * Assert that correct currency symbol displayed on Product Page on Custom Website. * - * @param CatalogProductSimple $product + * @param InjectableFixture $product, * @param BrowserInterface $browser * @param CatalogProductView $catalogProductView - * @param array|null $currencySymbol + * @param array $currencySymbol * @return void */ public function processAssert( - CatalogProductSimple $product, + InjectableFixture $product, BrowserInterface $browser, CatalogProductView $catalogProductView, array $currencySymbol = [] @@ -34,14 +34,14 @@ public function processAssert( $website = $product->getDataFieldConfig('website_ids')['source']->getWebsites()[0]; $url = $_ENV['app_frontend_url'] . 'websites/' . $website->getCode() . '/' . $product->getUrlKey() . '.html'; $browser->open($url); - $price = $catalogProductView->getViewBlock()->getPriceBlock()->getPriceWithCurrency(); - preg_match('`(.*?)\d`', $price, $matches); + $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); + $price = $priceBlock->getPrice(''); + $symbolOnPage = $priceBlock->getCurrencySymbol($price); - $symbolOnPage = isset($matches[1]) ? $matches[1] : null; \PHPUnit_Framework_Assert::assertEquals( $currencySymbol['customWebsite'], - $symbolOnPage, - 'Wrong Currency Symbol is displayed on Product page in Custom website.' + $symbolOnPage[1], + 'Wrong Currency Symbol is displayed on Product page on Custom website.' ); } @@ -52,6 +52,6 @@ public function processAssert( */ public function toString() { - return "Correct Currency Symbol displayed on Product page in Custom website."; + return "Correct Currency Symbol displayed on Product page on Custom website."; } } diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php index a1ba67950bc95..51b4ac84dccd5 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php @@ -6,40 +6,40 @@ namespace Magento\CurrencySymbol\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Mtf\Fixture\InjectableFixture; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Mtf\Client\BrowserInterface; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Check that correct currency symbol displayed on Product Page in Main Website. + * Check that correct currency symbol displayed on Product Page on Main Website. */ class AssertCurrencySymbolOnProductPageMainWebsite extends AbstractConstraint { /** - * Assert that correct currency symbol displayed on Product Page in Main Website. + * Assert that correct currency symbol displayed on Product Page on Main Website. * - * @param CatalogProductSimple $product + * @param InjectableFixture $product, * @param BrowserInterface $browser * @param CatalogProductView $catalogProductView - * @param array|null $currencySymbol + * @param array $currencySymbol * @return void */ public function processAssert( - CatalogProductSimple $product, + InjectableFixture $product, BrowserInterface $browser, CatalogProductView $catalogProductView, array $currencySymbol = [] ) { $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); - $price = $catalogProductView->getViewBlock()->getPriceBlock()->getPriceWithCurrency(); - preg_match('`(.*?)\d`', $price, $matches); + $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); + $price = $priceBlock->getPrice(''); + $symbolOnPage = $priceBlock->getCurrencySymbol($price); - $symbolOnPage = isset($matches[1]) ? $matches[1] : null; \PHPUnit_Framework_Assert::assertEquals( $currencySymbol['mainWebsite'], - $symbolOnPage, - 'Wrong Currency Symbol is displayed on Product page in the Main Website.' + $symbolOnPage[1], + 'Wrong Currency Symbol is displayed on Product page on the Main Website.' ); } @@ -50,6 +50,6 @@ public function processAssert( */ public function toString() { - return "Correct Currency Symbol displayed on Product page in the Main Website."; + return "Correct Currency Symbol displayed on Product page on the Main Website."; } } diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php index eb8bf428538a7..7aef03fd17e71 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php @@ -60,12 +60,12 @@ public function __inject( * Change Currency on Custom Website test. * * @param string $configData - * @param string $product + * @param array $product * @param Store $store * @param array|null $currencies - * @return void + * @return array */ - public function test($configData, $product, Store $store, array $currencies = []) + public function test($configData, array $product, Store $store, array $currencies = []) { // Preconditions $this->stepFactory->create( @@ -75,8 +75,8 @@ public function test($configData, $product, Store $store, array $currencies = [] $store->persist(); $product = $this->fixtureFactory->createByCode( - 'catalogProductSimple', - ['dataset' => $product['dataset'], 'data' => ['website_ids' => [['store' => $store]]]] + $product[0], + ['dataset' => $product[1], 'data' => ['website_ids' => [['store' => $store]]]] ); $product->persist(); $websites = $product->getDataFieldConfig('website_ids')['source']->getWebsites(); diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml index 2ad7856f675f6..9de868845b75a 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml @@ -7,9 +7,12 @@ --> - + price_scope_website - product_with_category + + catalogProductSimple + default + custom_store From e2fda94cd8aeefcbdf8da28b1c9738041b508aab Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Wed, 15 Feb 2017 13:01:50 +0300 Subject: [PATCH 12/18] MTO-108: [Test] Observe Different Base Currency per Website - Defects fixed --- .../Magento/Catalog/Test/Block/Product/Price.php | 13 ++++++------- ...sertCurrencySymbolOnProductPageCustomWebsite.php | 5 ++--- ...AssertCurrencySymbolOnProductPageMainWebsite.php | 5 ++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php index c7f8d529e00a3..26716485b0ce7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php @@ -111,19 +111,18 @@ public function getPriceTo($currency = '$') } /** - * Get currency symbol. + * Get currency symbol from price block on the product page. * - * @param string $price - * @return string + * @param string $currency + * @return array|null */ - public function getCurrencySymbol($price) + public function getCurrencySymbol($currency = '$') { + $price = $this->getPrice($currency); preg_match('`(.*?)\d`', $price, $matches); - return $matches; + return $matches[1]; } - - /** * Get price excluding tax. * diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php index b41f7f4fa0110..c74a5790674ad 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php @@ -35,12 +35,11 @@ public function processAssert( $url = $_ENV['app_frontend_url'] . 'websites/' . $website->getCode() . '/' . $product->getUrlKey() . '.html'; $browser->open($url); $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); - $price = $priceBlock->getPrice(''); - $symbolOnPage = $priceBlock->getCurrencySymbol($price); + $symbolOnPage = $priceBlock->getCurrencySymbol(''); \PHPUnit_Framework_Assert::assertEquals( $currencySymbol['customWebsite'], - $symbolOnPage[1], + $symbolOnPage, 'Wrong Currency Symbol is displayed on Product page on Custom website.' ); } diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php index 51b4ac84dccd5..aeafe1dfee5bc 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php @@ -33,12 +33,11 @@ public function processAssert( ) { $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); - $price = $priceBlock->getPrice(''); - $symbolOnPage = $priceBlock->getCurrencySymbol($price); + $symbolOnPage = $priceBlock->getCurrencySymbol(''); \PHPUnit_Framework_Assert::assertEquals( $currencySymbol['mainWebsite'], - $symbolOnPage[1], + $symbolOnPage, 'Wrong Currency Symbol is displayed on Product page on the Main Website.' ); } From 991956d33503c0eeedcdb19570b10d5c3f44b37b Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Wed, 15 Feb 2017 13:22:10 +0300 Subject: [PATCH 13/18] MTO-108: [Test] Observe Different Base Currency per Website - Defects fixed --- .../tests/app/Magento/Catalog/Test/Block/Product/Price.php | 7 +++---- .../AssertCurrencySymbolOnProductPageCustomWebsite.php | 2 +- .../AssertCurrencySymbolOnProductPageMainWebsite.php | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php index 26716485b0ce7..f88e460adffbd 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php @@ -113,12 +113,11 @@ public function getPriceTo($currency = '$') /** * Get currency symbol from price block on the product page. * - * @param string $currency - * @return array|null + * @return string */ - public function getCurrencySymbol($currency = '$') + public function getCurrencySymbol() { - $price = $this->getPrice($currency); + $price = $this->getPrice(''); preg_match('`(.*?)\d`', $price, $matches); return $matches[1]; } diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php index c74a5790674ad..ad418b1c8047e 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php @@ -35,7 +35,7 @@ public function processAssert( $url = $_ENV['app_frontend_url'] . 'websites/' . $website->getCode() . '/' . $product->getUrlKey() . '.html'; $browser->open($url); $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); - $symbolOnPage = $priceBlock->getCurrencySymbol(''); + $symbolOnPage = $priceBlock->getCurrencySymbol(); \PHPUnit_Framework_Assert::assertEquals( $currencySymbol['customWebsite'], diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php index aeafe1dfee5bc..b475264de2493 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php @@ -33,7 +33,7 @@ public function processAssert( ) { $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); - $symbolOnPage = $priceBlock->getCurrencySymbol(''); + $symbolOnPage = $priceBlock->getCurrencySymbol(); \PHPUnit_Framework_Assert::assertEquals( $currencySymbol['mainWebsite'], From ce246038ad2fcc0bec435950c42bb428872e2561 Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Thu, 16 Feb 2017 12:11:49 +0300 Subject: [PATCH 14/18] MTO-108: [Test] Observe Different Base Currency per Website - Codestyle fixed --- .../AssertCurrencySymbolOnProductPageCustomWebsite.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php index ad418b1c8047e..2637062e9466a 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php @@ -29,7 +29,7 @@ public function processAssert( InjectableFixture $product, BrowserInterface $browser, CatalogProductView $catalogProductView, - array $currencySymbol = [] + array $currencySymbol = [] ) { $website = $product->getDataFieldConfig('website_ids')['source']->getWebsites()[0]; $url = $_ENV['app_frontend_url'] . 'websites/' . $website->getCode() . '/' . $product->getUrlKey() . '.html'; From 7a5e4a7c152f3b0de2d4da9e86b59402eb86d639 Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Thu, 16 Feb 2017 14:14:20 +0300 Subject: [PATCH 15/18] MTO-108: [Test] Observe Different Base Currency per Website - Codestyle fixed --- .../Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php index b475264de2493..c94720bc4461b 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php @@ -29,7 +29,7 @@ public function processAssert( InjectableFixture $product, BrowserInterface $browser, CatalogProductView $catalogProductView, - array $currencySymbol = [] + array $currencySymbol = [] ) { $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); From ec0fab4e317e55169ca318476be387bae74da759 Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Thu, 16 Feb 2017 15:17:34 +0300 Subject: [PATCH 16/18] MTO-108: [Test] Observe Different Base Currency per Website - Codestyle fixed --- .../Test/TestCase/EditCurrencyCustomWebsiteTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php index 7aef03fd17e71..6ae75ce3f70f0 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php @@ -13,13 +13,13 @@ /** * Preconditions: - * 1. Change configuration of Main Website. - * 1. Create custom website. - * 2. Create simple product. - * 3. Assign created product to the main and custom websites. + * 1. Setup configuration of main website. + * 2. Create custom website. + * 3. Create product. + * 4. Assign created product to the main and custom websites. * * Steps: - * 1. Change currency settings for custom website. + * 1. Setup configuration of custom website. * 2. Perform all asserts. * * @group Currency @@ -46,7 +46,7 @@ class EditCurrencyCustomWebsiteTest extends Injectable * * @param FixtureFactory $fixtureFactory * @param TestStepFactory $stepFactory - * @return array + * @return void */ public function __inject( FixtureFactory $fixtureFactory, From ba9fc39a536674fc4021de55fa1c2d9f0a1fef69 Mon Sep 17 00:00:00 2001 From: Andrei_Ziblitski Date: Thu, 16 Feb 2017 15:52:13 +0300 Subject: [PATCH 17/18] MTO-109: [Variation] Create and use XML Sitemap with submission to Robots.txt - Functional test implemented. --- .../AssertSitemapSubmissionToRobotsTxt.php | 60 ++++++++ .../Sitemap/Test/Repository/ConfigData.xml | 27 ++++ .../TestCase/GenerateSitemapEntityTest.php | 143 ++++++++++++++++++ .../TestCase/GenerateSitemapEntityTest.xml | 32 ++++ .../Test/TestCase/UpdateSitemapEntityTest.php | 89 +++++++++++ .../Test/TestCase/UpdateSitemapEntityTest.xml | 20 +++ 6 files changed, 371 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapSubmissionToRobotsTxt.php create mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/Repository/ConfigData.xml create mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/GenerateSitemapEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/GenerateSitemapEntityTest.xml create mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/UpdateSitemapEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/UpdateSitemapEntityTest.xml diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapSubmissionToRobotsTxt.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapSubmissionToRobotsTxt.php new file mode 100644 index 0000000000000..0eba3b72cdc09 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Constraint/AssertSitemapSubmissionToRobotsTxt.php @@ -0,0 +1,60 @@ +open($_ENV['app_frontend_url'] . $this->filename); + \PHPUnit_Framework_Assert::assertNotEquals( + self::HTTP_NOT_FOUND, + $browser->getTitle(), + 'File ' . $this->filename . ' is not readable or not exists.' + ); + + $expectedRobotsContent = 'Sitemap: ' . $_ENV['app_frontend_url'] . 'sitemap.xml'; + \PHPUnit_Framework_Assert::assertTrue( + strpos($browser->getHtmlSource(), $expectedRobotsContent) !== false, + 'File ' . $this->filename . ' contains incorrect data.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'File ' . $this->filename . ' contains correct content.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Repository/ConfigData.xml new file mode 100644 index 0000000000000..d9ff30a9edcd6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Repository/ConfigData.xml @@ -0,0 +1,27 @@ + + + + + + + 0 + Yes + 1 + + + + + + default + 1 + No + 0 + + + + diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/GenerateSitemapEntityTest.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/GenerateSitemapEntityTest.php new file mode 100644 index 0000000000000..232b4a3124eef --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/GenerateSitemapEntityTest.php @@ -0,0 +1,143 @@ + SEO and Search > Site Map. + * 3. Click "Add Sitemap" button. + * 4. Fill out all data according to data set. + * 5. Click "Save" button. + * 6. Perform all assertions. + * + * @group XML_Sitemap + * @ZephyrId MAGETWO-25124 + */ +class GenerateSitemapEntityTest extends Injectable +{ + /* tags */ + const MVP = 'no'; + const SEVERITY = 'S1'; + /* end tags */ + + /** + * Step factory. + * + * @var TestStepFactory + */ + private $stepFactory; + + /** + * Sitemap grid page + * + * @var SitemapIndex + */ + protected $sitemapIndex; + + /** + * Sitemap new page + * + * @var SitemapNew + */ + protected $sitemapNew; + + /** + * Configuration setting. + * + * @var string + */ + private $configData; + + /** + * Inject data + * + * @param SitemapIndex $sitemapIndex + * @param SitemapNew $sitemapNew + * @param TestStepFactory $stepFactory + * @return void + */ + public function __inject( + SitemapIndex $sitemapIndex, + SitemapNew $sitemapNew, + TestStepFactory $stepFactory + ) { + $this->sitemapIndex = $sitemapIndex; + $this->sitemapNew = $sitemapNew; + $this->stepFactory = $stepFactory; + } + + /** + * Generate Sitemap Entity + * + * @param Sitemap $sitemap + * @param CatalogProductSimple $product + * @param Category $catalog + * @param CmsPage $cmsPage + * @param null|string $configData + * @return void + */ + public function testGenerateSitemap( + Sitemap $sitemap, + CatalogProductSimple $product, + Category $catalog, + CmsPage $cmsPage, + $configData = null + ) { + $this->configData = $configData; + + // Preconditions + if ($this->configData !== null) { + $this->stepFactory->create( + \Magento\Config\Test\TestStep\SetupConfigurationStep::class, + ['configData' => $this->configData] + )->run(); + } + + $product->persist(); + $catalog->persist(); + $cmsPage->persist(); + + // Steps + $this->sitemapIndex->open(); + $this->sitemapIndex->getGridPageActions()->addNew(); + $this->sitemapNew->getSitemapForm()->fill($sitemap); + $this->sitemapNew->getSitemapPageActions()->saveAndGenerate(); + } + + /** + * Set default configuration. + * + * @return void + */ + public function tearDown() + { + if ($this->configData !== null) { + $this->stepFactory->create( + \Magento\Config\Test\TestStep\SetupConfigurationStep::class, + ['configData' => $this->configData, 'rollback' => true] + )->run(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/GenerateSitemapEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/GenerateSitemapEntityTest.xml new file mode 100644 index 0000000000000..7541a7fd82330 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/GenerateSitemapEntityTest.xml @@ -0,0 +1,32 @@ + + + + + + stable:no, severity:S1 + default_subcategory + default + default + sitemap.xml + / + + + + + + default_subcategory + default + default + sitemap.xml + / + enable_submission_to_robots + + + + + diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/UpdateSitemapEntityTest.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/UpdateSitemapEntityTest.php new file mode 100644 index 0000000000000..556087846986e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/UpdateSitemapEntityTest.php @@ -0,0 +1,89 @@ + SEO & Search: Site Map + * 3. Click 'Generate' In the grid for sitemap from preconditions + * 4. Perform all assertions + * + * @group XML_Sitemap + * @ZephyrId MAGETWO-25362 + */ +class UpdateSitemapEntityTest extends Injectable +{ + /* tags */ + const MVP = 'no'; + const SEVERITY = 'S1'; + /* end tags */ + + /** + * Sitemap grid page + * + * @var SitemapIndex + */ + protected $sitemapIndex; + + /** + * Inject data + * + * @param SitemapIndex $sitemapIndex + * @return void + */ + public function __inject(SitemapIndex $sitemapIndex) + { + $this->sitemapIndex = $sitemapIndex; + } + + /** + * Update Sitemap Entity + * + * @param Sitemap $sitemap + * @param CatalogProductSimple $product + * @param Category $catalog + * @param CmsPage $cmsPage + * @return void + */ + public function testUpdateSitemap( + Sitemap $sitemap, + CatalogProductSimple $product, + Category $catalog, + CmsPage $cmsPage + ) { + // Preconditions + $sitemap->persist(); + $product->persist(); + $catalog->persist(); + $cmsPage->persist(); + $filter = [ + 'sitemap_filename' => $sitemap->getSitemapFilename(), + 'sitemap_path' => $sitemap->getSitemapPath(), + 'sitemap_id' => $sitemap->getSitemapId(), + ]; + + // Steps + $this->sitemapIndex->open()->getSitemapGrid()->search($filter); + $this->sitemapIndex->getSitemapGrid()->generate(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/UpdateSitemapEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/UpdateSitemapEntityTest.xml new file mode 100644 index 0000000000000..f3c9490db07e4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/UpdateSitemapEntityTest.xml @@ -0,0 +1,20 @@ + + + + + + to_maintain:yes, severity:S1 + default_subcategory + default + default + default + + + + + From 7e2a83679b6dfb108a3c372b6e1c971283c9b509 Mon Sep 17 00:00:00 2001 From: Vital Sery Date: Thu, 16 Feb 2017 16:04:40 +0300 Subject: [PATCH 18/18] MTO-108: [Test] Observe Different Base Currency per Website - Defects fixed --- .../Test/TestCase/EditCurrencyCustomWebsiteTest.php | 4 ++-- .../Test/TestCase/EditCurrencyCustomWebsiteTest.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php index 6ae75ce3f70f0..390b9029b56fa 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.php @@ -75,8 +75,8 @@ public function test($configData, array $product, Store $store, array $currencie $store->persist(); $product = $this->fixtureFactory->createByCode( - $product[0], - ['dataset' => $product[1], 'data' => ['website_ids' => [['store' => $store]]]] + $product['fixture'], + ['dataset' => $product['dataset'], 'data' => ['website_ids' => [['store' => $store]]]] ); $product->persist(); $websites = $product->getDataFieldConfig('website_ids')['source']->getWebsites(); diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml index 9de868845b75a..00e92f18dec53 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml @@ -10,8 +10,8 @@ price_scope_website - catalogProductSimple - default + catalogProductSimple + default custom_store