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..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 @@ -110,6 +110,18 @@ public function getPriceTo($currency = '$') return $this->getTypePrice('price_to', $currency); } + /** + * Get currency symbol from price block on the product page. + * + * @return string + */ + public function getCurrencySymbol() + { + $price = $this->getPrice(''); + preg_match('`(.*?)\d`', $price, $matches); + return $matches[1]; + } + /** * Get price excluding tax. * 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..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 @@ -84,6 +84,30 @@ + + multipleselect%isolation% + 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/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.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..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 @@ -66,5 +66,22 @@ + + custom_attribute_set + attribute_type_dropdown + Dropdown + Dropdown_%isolation% + Yes + No + + + + custom_attribute_set + 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 new file mode 100644 index 0000000000000..0e9e391b5eca6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchAttributeIsAbsent.php @@ -0,0 +1,50 @@ +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), + 'Created custom product attribute is present in advanced search form on frontend but must be absent.' + ); + } + + /** + * Returns string representation of object. + * + * @return string + */ + public function toString() + { + return 'Created custom product attribute is absent in advanced search form on frontend.'; + } +} 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..2637062e9466a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageCustomWebsite.php @@ -0,0 +1,56 @@ +getDataFieldConfig('website_ids')['source']->getWebsites()[0]; + $url = $_ENV['app_frontend_url'] . 'websites/' . $website->getCode() . '/' . $product->getUrlKey() . '.html'; + $browser->open($url); + $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); + $symbolOnPage = $priceBlock->getCurrencySymbol(); + + \PHPUnit_Framework_Assert::assertEquals( + $currencySymbol['customWebsite'], + $symbolOnPage, + 'Wrong Currency Symbol is displayed on Product page on Custom website.' + ); + } + + /** + * Returns a string representation of successful assertion. + * + * @return string + */ + public function toString() + { + 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 new file mode 100644 index 0000000000000..c94720bc4461b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnProductPageMainWebsite.php @@ -0,0 +1,54 @@ +open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); + $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); + $symbolOnPage = $priceBlock->getCurrencySymbol(); + + \PHPUnit_Framework_Assert::assertEquals( + $currencySymbol['mainWebsite'], + $symbolOnPage, + 'Wrong Currency Symbol is displayed on Product page on the Main Website.' + ); + } + + /** + * Returns a string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return "Correct Currency Symbol displayed on Product page on 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..390b9029b56fa --- /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 array $product + * @param Store $store + * @param array|null $currencies + * @return array + */ + public function test($configData, array $product, Store $store, array $currencies = []) + { + // Preconditions + $this->stepFactory->create( + \Magento\Config\Test\TestStep\SetupConfigurationStep::class, + ['configData' => $configData] + )->run(); + + $store->persist(); + $product = $this->fixtureFactory->createByCode( + $product['fixture'], + ['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..00e92f18dec53 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencyCustomWebsiteTest.xml @@ -0,0 +1,34 @@ + + + + + + price_scope_website + + catalogProductSimple + default + + custom_store + + + + EUR + + EUR + EUR + + + + $ + + + + + + + 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..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 @@ 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(); + if ($runReindex) { + $indexer->reindex(); + } + // Steps $category->persist(); } @@ -66,7 +87,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 9f9279d31ce75..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 @@ -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 @@ -113,5 +113,38 @@ + + layered_navigation_manual_range_10 + true + 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 + + + + + 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 + + + + + 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 + + + + +