Skip to content

Commit

Permalink
Merge pull request #853 from magento-epam/pr1
Browse files Browse the repository at this point in the history
[Epam] Extend functional test sprint 1

- Tasks:
- MTO-112: [Variation] Use Layered Navigation by Price (Navigation Step = Manual, MySQL)
- MTO-108: [Test] Observe Different Base Currency per Website
- MTO-117: [Variation] Use attribute in the Advanced Search
- MTO-109: [Variation] Create and use XML Sitemap with submission to Robots.txt
  • Loading branch information
okolesnyk authored Feb 20, 2017
2 parents c98828b + afe52d0 commit c7fff61
Show file tree
Hide file tree
Showing 19 changed files with 832 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,30 @@
</field>
</dataset>

<dataset name="attribute_type_multiple_select">
<field name="frontend_label" xsi:type="string">multipleselect%isolation%</field>
<field name="attribute_code" xsi:type="string">multipleselect%isolation%</field>
<field name="frontend_input" xsi:type="string">Multiple Select</field>
<field name="is_required" xsi:type="string">No</field>
<field name="options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="is_default" xsi:type="string">Yes</item>
<item name="admin" xsi:type="string">black</item>
<item name="view" xsi:type="string">option_0_%isolation%</item>
</item>
<item name="1" xsi:type="array">
<item name="is_default" xsi:type="string">No</item>
<item name="admin" xsi:type="string">white</item>
<item name="view" xsi:type="string">option_1_%isolation%</item>
</item>
<item name="2" xsi:type="array">
<item name="is_default" xsi:type="string">No</item>
<item name="admin" xsi:type="string">green</item>
<item name="view" xsi:type="string">option_2_%isolation%</item>
</item>
</field>
</dataset>

<dataset name="attribute_type_dropdown_two_options">
<field name="frontend_label" xsi:type="string">attribute_dropdown%isolation%</field>
<field name="attribute_code" xsi:type="string">attribute_dropdown%isolation%</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" />
<constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" />
</variation>
<variation name="CreateProductAttributeEntityTestVariation5">
<variation name="CreateProductAttributeEntityTestVariation5" summary="Create custom multiple select attribute product field" ticketId="MAGETWO-14862">
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
<data name="productAttribute/data/frontend_label" xsi:type="string">Multiple_Select_Admin_%isolation%</data>
<data name="productAttribute/data/frontend_input" xsi:type="string">Multiple Select</data>
Expand Down Expand Up @@ -114,7 +114,7 @@
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertAttributeSearchableByLabel" />
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeOptionsOnProductForm" />
</variation>
<variation name="CreateProductAttributeEntityTestVariation6" summary="Create custom dropdown attribute product field" ticketId="MAGETWO-17475">
<variation name="CreateProductAttributeEntityTestVariation6" summary="Create custom dropdown attribute product field" ticketId="MAGETWO-17475, MAGETWO-14862">
<data name="tag" xsi:type="string">test_type:extended_acceptance_test</data>
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
<data name="productAttribute/data/frontend_label" xsi:type="string">Dropdown_Admin_%isolation%</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* 6. Perform all assertions
*
* @group Product_Attributes
* @ZephyrId MAGETWO-23459
* @ZephyrId MAGETWO-23459, MAGETWO-12941
*/
class UpdateProductAttributeEntityTest extends Injectable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,22 @@
<constraint name="Magento\PageCache\Test\Constraint\AssertCacheIsRefreshableAndInvalidated" />
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchProductByAttribute" />
</variation>
<variation name="UpdateProductAttributeEntityTestVariation4" summary="Create product attribute of type Dropdown and check its visibility on frontend in Advanced Search form" ticketId="MAGETWO-12941">
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
<data name="productAttributeOriginal/dataset" xsi:type="string">attribute_type_dropdown</data>
<data name="attribute/data/frontend_input" xsi:type="string">Dropdown</data>
<data name="attribute/data/frontend_label" xsi:type="string">Dropdown_%isolation%</data>
<data name="attribute/data/is_searchable" xsi:type="string">Yes</data>
<data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">No</data>
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchAttributeIsAbsent" />
</variation>
<variation name="UpdateProductAttributeEntityTestVariation5" summary="Create product attribute of type Multiple Select and check its visibility on frontend in Advanced Search form" ticketId="MAGETWO-12941">
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
<data name="productAttributeOriginal/dataset" xsi:type="string">attribute_type_multiple_select</data>
<data name="attribute/data/frontend_label" xsi:type="string">Dropdown_%isolation%</data>
<data name="attribute/data/is_searchable" xsi:type="string">Yes</data>
<data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">No</data>
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchAttributeIsAbsent" />
</variation>
</testCase>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\CatalogSearch\Test\Constraint;

use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
use Magento\CatalogSearch\Test\Page\AdvancedSearch;
use Magento\Mtf\Constraint\AbstractConstraint;
use Magento\Mtf\Util\Command\Cli\Indexer;

/**
* Assert that created custom product attribute is absent in the advanced search form on the frontend.
*/
class AssertAdvancedSearchAttributeIsAbsent extends AbstractConstraint
{
/**
* Assert that created custom product attribute is absent in the advanced search form on the frontend.
*
* @param CatalogProductAttribute $attribute
* @param AdvancedSearch $advancedSearch
* @param Indexer $cli
* @return void
*/
public function processAssert(CatalogProductAttribute $attribute, AdvancedSearch $advancedSearch, Indexer $cli)
{
$cli->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.';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\CurrencySymbol\Test\Constraint;

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 on Custom Website.
*/
class AssertCurrencySymbolOnProductPageCustomWebsite extends AbstractConstraint
{
/**
* Assert that correct currency symbol displayed on Product Page on Custom Website.
*
* @param InjectableFixture $product,
* @param BrowserInterface $browser
* @param CatalogProductView $catalogProductView
* @param array $currencySymbol
* @return void
*/
public function processAssert(
InjectableFixture $product,
BrowserInterface $browser,
CatalogProductView $catalogProductView,
array $currencySymbol = []
) {
$website = $product->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.";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\CurrencySymbol\Test\Constraint;

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 on Main Website.
*/
class AssertCurrencySymbolOnProductPageMainWebsite extends AbstractConstraint
{
/**
* Assert that correct currency symbol displayed on Product Page on Main Website.
*
* @param InjectableFixture $product,
* @param BrowserInterface $browser
* @param CatalogProductView $catalogProductView
* @param array $currencySymbol
* @return void
*/
public function processAssert(
InjectableFixture $product,
BrowserInterface $browser,
CatalogProductView $catalogProductView,
array $currencySymbol = []
) {
$browser->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.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,28 @@
</field>
</dataset>

<dataset name="config_currency_custom_website_eur">
<field name="currency/options/allow" xsi:type="array">
<item name="scope" xsi:type="string">currency</item>
<item name="scope_id" xsi:type="number">1</item>
<item name="value" xsi:type="array">
<item name="Euro" xsi:type="string">EUR</item>
</item>
</field>
<field name="currency/options/base" xsi:type="array">
<item name="scope" xsi:type="string">currency</item>
<item name="label" xsi:type="string">Euro</item>
<item name="scope_id" xsi:type="number">1</item>
<item name="value" xsi:type="string">EUR</item>
</field>
<field name="currency/options/default" xsi:type="array">
<item name="scope" xsi:type="string">currency</item>
<item name="label" xsi:type="string">Euro</item>
<item name="scope_id" xsi:type="number">1</item>
<item name="value" xsi:type="string">EUR</item>
</field>
</dataset>

<dataset name="config_base_currency_ch">
<field name="currency/options/allow" xsi:type="array">
<item name="scope" xsi:type="string">currency</item>
Expand Down
Loading

0 comments on commit c7fff61

Please sign in to comment.