Skip to content

Commit c7fff61

Browse files
authoredFeb 20, 2017
Merge pull request #853 from magento-epam/pr1
[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
2 parents c98828b + afe52d0 commit c7fff61

19 files changed

+832
-12
lines changed
 

‎dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php

+12
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ public function getPriceTo($currency = '$')
110110
return $this->getTypePrice('price_to', $currency);
111111
}
112112

113+
/**
114+
* Get currency symbol from price block on the product page.
115+
*
116+
* @return string
117+
*/
118+
public function getCurrencySymbol()
119+
{
120+
$price = $this->getPrice('');
121+
preg_match('`(.*?)\d`', $price, $matches);
122+
return $matches[1];
123+
}
124+
113125
/**
114126
* Get price excluding tax.
115127
*

‎dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml

+24
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,30 @@
8484
</field>
8585
</dataset>
8686

87+
<dataset name="attribute_type_multiple_select">
88+
<field name="frontend_label" xsi:type="string">multipleselect%isolation%</field>
89+
<field name="attribute_code" xsi:type="string">multipleselect%isolation%</field>
90+
<field name="frontend_input" xsi:type="string">Multiple Select</field>
91+
<field name="is_required" xsi:type="string">No</field>
92+
<field name="options" xsi:type="array">
93+
<item name="0" xsi:type="array">
94+
<item name="is_default" xsi:type="string">Yes</item>
95+
<item name="admin" xsi:type="string">black</item>
96+
<item name="view" xsi:type="string">option_0_%isolation%</item>
97+
</item>
98+
<item name="1" xsi:type="array">
99+
<item name="is_default" xsi:type="string">No</item>
100+
<item name="admin" xsi:type="string">white</item>
101+
<item name="view" xsi:type="string">option_1_%isolation%</item>
102+
</item>
103+
<item name="2" xsi:type="array">
104+
<item name="is_default" xsi:type="string">No</item>
105+
<item name="admin" xsi:type="string">green</item>
106+
<item name="view" xsi:type="string">option_2_%isolation%</item>
107+
</item>
108+
</field>
109+
</dataset>
110+
87111
<dataset name="attribute_type_dropdown_two_options">
88112
<field name="frontend_label" xsi:type="string">attribute_dropdown%isolation%</field>
89113
<field name="attribute_code" xsi:type="string">attribute_dropdown%isolation%</field>

‎dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" />
8585
<constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" />
8686
</variation>
87-
<variation name="CreateProductAttributeEntityTestVariation5">
87+
<variation name="CreateProductAttributeEntityTestVariation5" summary="Create custom multiple select attribute product field" ticketId="MAGETWO-14862">
8888
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
8989
<data name="productAttribute/data/frontend_label" xsi:type="string">Multiple_Select_Admin_%isolation%</data>
9090
<data name="productAttribute/data/frontend_input" xsi:type="string">Multiple Select</data>
@@ -114,7 +114,7 @@
114114
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertAttributeSearchableByLabel" />
115115
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeOptionsOnProductForm" />
116116
</variation>
117-
<variation name="CreateProductAttributeEntityTestVariation6" summary="Create custom dropdown attribute product field" ticketId="MAGETWO-17475">
117+
<variation name="CreateProductAttributeEntityTestVariation6" summary="Create custom dropdown attribute product field" ticketId="MAGETWO-17475, MAGETWO-14862">
118118
<data name="tag" xsi:type="string">test_type:extended_acceptance_test</data>
119119
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
120120
<data name="productAttribute/data/frontend_label" xsi:type="string">Dropdown_Admin_%isolation%</data>

‎dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* 6. Perform all assertions
3030
*
3131
* @group Product_Attributes
32-
* @ZephyrId MAGETWO-23459
32+
* @ZephyrId MAGETWO-23459, MAGETWO-12941
3333
*/
3434
class UpdateProductAttributeEntityTest extends Injectable
3535
{

‎dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml

+17
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,22 @@
6666
<constraint name="Magento\PageCache\Test\Constraint\AssertCacheIsRefreshableAndInvalidated" />
6767
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchProductByAttribute" />
6868
</variation>
69+
<variation name="UpdateProductAttributeEntityTestVariation4" summary="Create product attribute of type Dropdown and check its visibility on frontend in Advanced Search form" ticketId="MAGETWO-12941">
70+
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
71+
<data name="productAttributeOriginal/dataset" xsi:type="string">attribute_type_dropdown</data>
72+
<data name="attribute/data/frontend_input" xsi:type="string">Dropdown</data>
73+
<data name="attribute/data/frontend_label" xsi:type="string">Dropdown_%isolation%</data>
74+
<data name="attribute/data/is_searchable" xsi:type="string">Yes</data>
75+
<data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">No</data>
76+
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchAttributeIsAbsent" />
77+
</variation>
78+
<variation name="UpdateProductAttributeEntityTestVariation5" summary="Create product attribute of type Multiple Select and check its visibility on frontend in Advanced Search form" ticketId="MAGETWO-12941">
79+
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
80+
<data name="productAttributeOriginal/dataset" xsi:type="string">attribute_type_multiple_select</data>
81+
<data name="attribute/data/frontend_label" xsi:type="string">Dropdown_%isolation%</data>
82+
<data name="attribute/data/is_searchable" xsi:type="string">Yes</data>
83+
<data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">No</data>
84+
<constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchAttributeIsAbsent" />
85+
</variation>
6986
</testCase>
7087
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CatalogSearch\Test\Constraint;
8+
9+
use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
10+
use Magento\CatalogSearch\Test\Page\AdvancedSearch;
11+
use Magento\Mtf\Constraint\AbstractConstraint;
12+
use Magento\Mtf\Util\Command\Cli\Indexer;
13+
14+
/**
15+
* Assert that created custom product attribute is absent in the advanced search form on the frontend.
16+
*/
17+
class AssertAdvancedSearchAttributeIsAbsent extends AbstractConstraint
18+
{
19+
/**
20+
* Assert that created custom product attribute is absent in the advanced search form on the frontend.
21+
*
22+
* @param CatalogProductAttribute $attribute
23+
* @param AdvancedSearch $advancedSearch
24+
* @param Indexer $cli
25+
* @return void
26+
*/
27+
public function processAssert(CatalogProductAttribute $attribute, AdvancedSearch $advancedSearch, Indexer $cli)
28+
{
29+
$cli->reindex();
30+
$advancedSearch->open();
31+
$formLabels = $advancedSearch->getForm()->getFormLabels();
32+
$label = $attribute->hasData('manage_frontend_label')
33+
? $attribute->getManageFrontendLabel()
34+
: $attribute->getFrontendLabel();
35+
\PHPUnit_Framework_Assert::assertFalse(
36+
in_array($label, $formLabels),
37+
'Created custom product attribute is present in advanced search form on frontend but must be absent.'
38+
);
39+
}
40+
41+
/**
42+
* Returns string representation of object.
43+
*
44+
* @return string
45+
*/
46+
public function toString()
47+
{
48+
return 'Created custom product attribute is absent in advanced search form on frontend.';
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CurrencySymbol\Test\Constraint;
8+
9+
use Magento\Mtf\Fixture\InjectableFixture;
10+
use Magento\Catalog\Test\Page\Product\CatalogProductView;
11+
use Magento\Mtf\Client\BrowserInterface;
12+
use Magento\Mtf\Constraint\AbstractConstraint;
13+
14+
/**
15+
* Check that correct currency symbol displayed on Product Page on Custom Website.
16+
*/
17+
class AssertCurrencySymbolOnProductPageCustomWebsite extends AbstractConstraint
18+
{
19+
/**
20+
* Assert that correct currency symbol displayed on Product Page on Custom Website.
21+
*
22+
* @param InjectableFixture $product,
23+
* @param BrowserInterface $browser
24+
* @param CatalogProductView $catalogProductView
25+
* @param array $currencySymbol
26+
* @return void
27+
*/
28+
public function processAssert(
29+
InjectableFixture $product,
30+
BrowserInterface $browser,
31+
CatalogProductView $catalogProductView,
32+
array $currencySymbol = []
33+
) {
34+
$website = $product->getDataFieldConfig('website_ids')['source']->getWebsites()[0];
35+
$url = $_ENV['app_frontend_url'] . 'websites/' . $website->getCode() . '/' . $product->getUrlKey() . '.html';
36+
$browser->open($url);
37+
$priceBlock = $catalogProductView->getViewBlock()->getPriceBlock();
38+
$symbolOnPage = $priceBlock->getCurrencySymbol();
39+
40+
\PHPUnit_Framework_Assert::assertEquals(
41+
$currencySymbol['customWebsite'],
42+
$symbolOnPage,
43+
'Wrong Currency Symbol is displayed on Product page on Custom website.'
44+
);
45+
}
46+
47+
/**
48+
* Returns a string representation of successful assertion.
49+
*
50+
* @return string
51+
*/
52+
public function toString()
53+
{
54+
return "Correct Currency Symbol displayed on Product page on Custom website.";
55+
}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CurrencySymbol\Test\Constraint;
8+
9+
use Magento\Mtf\Fixture\InjectableFixture;
10+
use Magento\Catalog\Test\Page\Product\CatalogProductView;
11+
use Magento\Mtf\Client\BrowserInterface;
12+
use Magento\Mtf\Constraint\AbstractConstraint;
13+
14+
/**
15+
* Check that correct currency symbol displayed on Product Page on Main Website.
16+
*/
17+
class AssertCurrencySymbolOnProductPageMainWebsite extends AbstractConstraint
18+
{
19+
/**
20+
* Assert that correct currency symbol displayed on Product Page on Main Website.
21+
*
22+
* @param InjectableFixture $product,
23+
* @param BrowserInterface $browser
24+
* @param CatalogProductView $catalogProductView
25+
* @param array $currencySymbol
26+
* @return void
27+
*/
28+
public function processAssert(
29+
InjectableFixture $product,
30+
BrowserInterface $browser,
31+
CatalogProductView $catalogProductView,
32+
array $currencySymbol = []
33+
) {
34+
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
35+
$priceBlock = $catalogProductView->getViewBlock()->getPriceBlock();
36+
$symbolOnPage = $priceBlock->getCurrencySymbol();
37+
38+
\PHPUnit_Framework_Assert::assertEquals(
39+
$currencySymbol['mainWebsite'],
40+
$symbolOnPage,
41+
'Wrong Currency Symbol is displayed on Product page on the Main Website.'
42+
);
43+
}
44+
45+
/**
46+
* Returns a string representation of successful assertion.
47+
*
48+
* @return string
49+
*/
50+
public function toString()
51+
{
52+
return "Correct Currency Symbol displayed on Product page on the Main Website.";
53+
}
54+
}

‎dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml

+22
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,28 @@
6161
</field>
6262
</dataset>
6363

64+
<dataset name="config_currency_custom_website_eur">
65+
<field name="currency/options/allow" xsi:type="array">
66+
<item name="scope" xsi:type="string">currency</item>
67+
<item name="scope_id" xsi:type="number">1</item>
68+
<item name="value" xsi:type="array">
69+
<item name="Euro" xsi:type="string">EUR</item>
70+
</item>
71+
</field>
72+
<field name="currency/options/base" xsi:type="array">
73+
<item name="scope" xsi:type="string">currency</item>
74+
<item name="label" xsi:type="string">Euro</item>
75+
<item name="scope_id" xsi:type="number">1</item>
76+
<item name="value" xsi:type="string">EUR</item>
77+
</field>
78+
<field name="currency/options/default" xsi:type="array">
79+
<item name="scope" xsi:type="string">currency</item>
80+
<item name="label" xsi:type="string">Euro</item>
81+
<item name="scope_id" xsi:type="number">1</item>
82+
<item name="value" xsi:type="string">EUR</item>
83+
</field>
84+
</dataset>
85+
6486
<dataset name="config_base_currency_ch">
6587
<field name="currency/options/allow" xsi:type="array">
6688
<item name="scope" xsi:type="string">currency</item>

0 commit comments

Comments
 (0)
Please sign in to comment.