Skip to content

Commit 896d2d2

Browse files
authored
Merge pull request #755 from magento-qmt/FT-PR-3
[Epam] Extend functional test coverage 3 - Task: - MTO-3: [Test] Create test for CMS page mass grid functionality - MTO-6: [Variation] Add variation to Update Downloadable Product test to verify data overriding on Store View level - MTO-8: Add variation to create category test with a big nesting level - MTO-14: [Variation] Add variation to update Category on Store View level - MTO-15: [Variation] Manage customers via mass action - MTO-31: [Constraint] Verify auto-generate Request Path for product which is assigned to subcategory - MTO-34: [Constraint] Verify that product quantity is decreased after placing an order - MTO-36: [Constraint] Verify that product can be added to shopping cart from search page - MTO-38: [Constraint] Update synonym group search in a grid - MTO-39: [Test] Create multiple synonyms groups - MTO-45: [Constraint] Assert product can be found using advanced search - MTO-47: [Constraint] Assert item count in mini shopping cart - MTO-48: [Variation] Verify that first name and last name are put to address while checkout - MTO-49: [Test] Sales shipping report - MTO-51: [Variation] Product advanced inventory - MTO-52: [Constraint] Assert shopping cart sidebar - MTO-54: [Test] Shopping Cart and Mini Shopping Cart per Customer - MTO-66: [Variation] No XSS injection on Update User Account - MTO-72: [Variation] Use sorting category filter for applied layered navigation - MTO-73: Catalog Rules Indexer - MTO-79: [Variation] Autocreate URL Rewrite for a Product with Several Websites and Different Root Categories - MTO-80: [Constraint] Verify URL rewrite for nesting category - MTO-82: [Variation] Edit category to check URL rewrites - MTO-86: [Test] Cache invalidation when products website visibility change - MTO-87: [Test] Page cache for different CMS pages on multiple store views - MTO-90: [Test] Reports Refresh statistics - MTO-91: [Test] Url rewrites in catalog categories after changing url key for store view and moving category - MTO-97: [Test] Unlock Admin User - MTO-98: [Variation] Do Advanced Search without entering data
2 parents 270000b + 5ed7c61 commit 896d2d2

File tree

122 files changed

+4857
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+4857
-179
lines changed

dev/tests/functional/lib/Magento/Mtf/Client/Element/ConditionsElement.php

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* {Type|Param|Param|...|Param:[Type|Param|Param|...|Param]}
2626
* 4. Combination condition with list conditions
2727
* {Type|Param|Param|...|Param:[[Type|Param|...|Param][Type|Param|...|Param]...[Type|Param|...|Param]]}
28+
* 5. Top level condition
29+
* {TopLevelCondition:[ANY|FALSE]}{Type|Param|Param|...|Param:[[Type|Param|...|Param]...[Type|Param|...|Param]]}
2830
*
2931
* Example value:
3032
* {Products subselection|total amount|greater than|135|ANY:[[Price in cart|is|100][Quantity in cart|is|100]]}
@@ -195,10 +197,16 @@ class ConditionsElement extends SimpleElement
195197
public function setValue($value)
196198
{
197199
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
198-
200+
$this->clear();
199201
$conditions = $this->decodeValue($value);
200202
$context = $this->find($this->mainCondition, Locator::SELECTOR_XPATH);
201-
$this->clear();
203+
if (!empty($conditions[0]['TopLevelCondition'])) {
204+
array_unshift($this->mapParams, 'aggregator');
205+
$condition = $this->parseTopLevelCondition($conditions[0]['TopLevelCondition']);
206+
$this->fillCondition($condition['rules'], $context);
207+
unset($conditions[0]);
208+
array_shift($this->mapParams);
209+
}
202210
$this->addMultipleCondition($conditions, $context);
203211
}
204212

@@ -430,7 +438,6 @@ protected function decodeValue($value)
430438
$value = preg_replace('/\[([^\[{])/', '"$1', $value);
431439
$value = preg_replace('/([^\]}])\]/', '$1"', $value);
432440
$value = str_replace(array_keys($this->decodeChars), $this->decodeChars, $value);
433-
434441
$value = "[{$value}]";
435442
$value = json_decode($value, true);
436443
if (null === $value) {
@@ -461,6 +468,24 @@ protected function parseCondition($condition)
461468
];
462469
}
463470

471+
/**
472+
* Parse top level condition.
473+
*
474+
* @param string $condition
475+
* @return array
476+
* @throws \Exception
477+
*/
478+
protected function parseTopLevelCondition($condition)
479+
{
480+
if (preg_match_all('/([^|]+)\|?/', $condition, $match) === false) {
481+
throw new \Exception('Bad format condition');
482+
}
483+
484+
return [
485+
'rules' => $match[1],
486+
];
487+
}
488+
464489
/**
465490
* Find next param of condition for fill.
466491
*
@@ -496,6 +521,7 @@ protected function resetKeyParam()
496521
* Param wait loader.
497522
*
498523
* @param ElementInterface $element
524+
* @return void
499525
*/
500526
protected function waitForCondition(ElementInterface $element)
501527
{

dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php

Lines changed: 158 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,126 @@
66

77
namespace Magento\Backend\Test\Block;
88

9+
use Magento\Mtf\Block\Block;
910
use Magento\Mtf\Client\Locator;
1011

1112
/**
12-
* Backend Messages block.
13+
* Global messages block.
1314
*/
14-
class Messages extends \Magento\Ui\Test\Block\Messages
15+
class Messages extends Block
1516
{
17+
/**
18+
* Success message selector.
19+
*
20+
* @var string
21+
*/
22+
protected $successMessage = '[data-ui-id$=message-success]';
23+
24+
/**
25+
* Last success message selector.
26+
*
27+
* @var string
28+
*/
29+
protected $lastSuccessMessage = '[data-ui-id$=message-success]:last-child';
30+
1631
/**
1732
* Message link.
1833
*
1934
* @var string
2035
*/
2136
protected $messageLink = "//a[contains(.,'%s')]";
2237

38+
/**
39+
* Error message selector.
40+
*
41+
* @var string
42+
*/
43+
protected $errorMessage = '[data-ui-id$=message-error], .message-error';
44+
45+
/**
46+
* Notice message selector.
47+
*
48+
* @var string
49+
*/
50+
protected $noticeMessage = '[data-ui-id$=message-notice], .message-notice';
51+
52+
/**
53+
* Warning message selector.
54+
*
55+
* @var string
56+
*/
57+
protected $warningMessage = '[data-ui-id$=message-warning]';
58+
59+
/**
60+
* Wait for success message.
61+
*
62+
* @return bool
63+
*/
64+
public function waitSuccessMessage()
65+
{
66+
return $this->waitForElementVisible($this->successMessage, Locator::SELECTOR_CSS);
67+
}
68+
69+
/**
70+
* Get all success messages which are present on the page.
71+
*
72+
* @return array
73+
*/
74+
public function getSuccessMessages()
75+
{
76+
$this->waitForElementVisible($this->successMessage);
77+
$elements = $this->_rootElement->getElements($this->successMessage);
78+
79+
$messages = [];
80+
foreach ($elements as $element) {
81+
$messages[] = $element->getText();
82+
}
83+
84+
return $messages;
85+
}
86+
87+
/**
88+
* Get last success message which is present on the page.
89+
*
90+
* @return string
91+
*/
92+
public function getSuccessMessage()
93+
{
94+
$this->waitForElementVisible($this->successMessage);
95+
96+
return $this->_rootElement->find($this->lastSuccessMessage)->getText();
97+
}
98+
99+
/**
100+
* Wait for element is visible in the page.
101+
*
102+
* @param string $selector
103+
* @param string $strategy
104+
* @return bool|null
105+
*/
106+
public function waitForElementVisible($selector, $strategy = Locator::SELECTOR_CSS)
107+
{
108+
$browser = $this->browser;
109+
return $browser->waitUntil(
110+
function () use ($browser, $selector, $strategy) {
111+
$message = $browser->find($selector, $strategy);
112+
return $message->isVisible() ? true : null;
113+
}
114+
);
115+
}
116+
117+
/**
118+
* Get all error message which is present on the page.
119+
*
120+
* @return string
121+
*/
122+
public function getErrorMessage()
123+
{
124+
$this->waitForElementVisible($this->errorMessage);
125+
126+
return $this->_rootElement->find($this->errorMessage)->getText();
127+
}
128+
23129
/**
24130
* Click on link in the message which is present on the page.
25131
*
@@ -60,6 +166,16 @@ public function assertErrorMessage()
60166
return $this->waitForElementVisible($this->errorMessage, Locator::SELECTOR_CSS);
61167
}
62168

169+
/**
170+
* Check for success message.
171+
*
172+
* @return bool
173+
*/
174+
public function assertSuccessMessage()
175+
{
176+
return $this->waitForElementVisible($this->successMessage, Locator::SELECTOR_CSS);
177+
}
178+
63179
/**
64180
* Check for notice message.
65181
*
@@ -69,4 +185,44 @@ public function assertNoticeMessage()
69185
{
70186
return $this->waitForElementVisible($this->noticeMessage, Locator::SELECTOR_CSS);
71187
}
188+
189+
/**
190+
* Get notice message which is present on the page.
191+
*
192+
* @return string
193+
*/
194+
public function getNoticeMessage()
195+
{
196+
$this->waitForElementVisible($this->noticeMessage);
197+
return $this->_rootElement->find($this->noticeMessage)->getText();
198+
}
199+
200+
/**
201+
* Get all notice messages which are present on the page.
202+
*
203+
* @return array
204+
*/
205+
public function getNoticeMessages()
206+
{
207+
$this->waitForElementVisible($this->noticeMessage);
208+
$elements = $this->_rootElement->getElements($this->noticeMessage);
209+
210+
$messages = [];
211+
foreach ($elements as $element) {
212+
$messages[] = $element->getText();
213+
}
214+
215+
return $messages;
216+
}
217+
218+
/**
219+
* Get warning message which is present on the page.
220+
*
221+
* @return string
222+
*/
223+
public function getWarningMessage()
224+
{
225+
$this->waitForElementVisible($this->warningMessage);
226+
return $this->_rootElement->find($this->warningMessage)->getText();
227+
}
72228
}

dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,56 @@
192192
</field>
193193
</dataset>
194194

195+
<dataset name="enable_https_frontend_admin_with_url">
196+
<field name="web/secure/use_in_frontend" xsi:type="array">
197+
<item name="scope" xsi:type="string">default</item>
198+
<item name="scope_id" xsi:type="number">0</item>
199+
<item name="label" xsi:type="string">Yes</item>
200+
<item name="value" xsi:type="number">1</item>
201+
</field>
202+
<field name="web/secure/use_in_adminhtml" xsi:type="array">
203+
<item name="scope" xsi:type="string">default</item>
204+
<item name="scope_id" xsi:type="number">0</item>
205+
<item name="label" xsi:type="string">Yes</item>
206+
<item name="value" xsi:type="number">1</item>
207+
</field>
208+
<field name="web/secure/base_url" xsi:type="array">
209+
<item name="scope" xsi:type="string">default</item>
210+
<item name="scope_id" xsi:type="number">0</item>
211+
<item name="value" xsi:type="string">{{basic_url_to_secure}}</item>
212+
</field>
213+
<field name="web/secure/base_link_url" xsi:type="array">
214+
<item name="scope" xsi:type="string">default</item>
215+
<item name="scope_id" xsi:type="number">0</item>
216+
<item name="value" xsi:type="string">{{basic_url_to_secure}}</item>
217+
</field>
218+
</dataset>
219+
220+
<dataset name="enable_https_frontend_admin_with_url_rollback">
221+
<field name="web/secure/use_in_frontend" xsi:type="array">
222+
<item name="scope" xsi:type="string">default</item>
223+
<item name="scope_id" xsi:type="number">0</item>
224+
<item name="label" xsi:type="string">No</item>
225+
<item name="value" xsi:type="number">0</item>
226+
</field>
227+
<field name="web/secure/use_in_adminhtml" xsi:type="array">
228+
<item name="scope" xsi:type="string">default</item>
229+
<item name="scope_id" xsi:type="number">0</item>
230+
<item name="label" xsi:type="string">No</item>
231+
<item name="value" xsi:type="number">0</item>
232+
</field>
233+
<field name="web/secure/base_url" xsi:type="array">
234+
<item name="scope" xsi:type="string">default</item>
235+
<item name="scope_id" xsi:type="number">0</item>
236+
<item name="value" xsi:type="string">{{basic_url_to_unsecure}}</item>
237+
</field>
238+
<field name="web/secure/base_link_url" xsi:type="array">
239+
<item name="scope" xsi:type="string">default</item>
240+
<item name="scope_id" xsi:type="number">0</item>
241+
<item name="value" xsi:type="string">{{basic_url_to_unsecure}}</item>
242+
</field>
243+
</dataset>
244+
195245
<dataset name="enable_hsts">
196246
<field name="web/secure/enable_hsts" xsi:type="array">
197247
<item name="scope" xsi:type="string">default</item>

dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ConfigureSecureUrlsTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ public function __inject(
117117
*/
118118
public function test($configData)
119119
{
120+
$this->markTestSkipped(
121+
'MAGETWO-63197: ConfigureSecureUrlsTest is failing and next functional tests are also failing after it'
122+
);
120123
$data = [
121124
'web/secure/base_url' => [
122125
'scope' => 'default',

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ public function fill(FixtureInterface $product, SimpleElement $element = null, F
108108
$this->getNewCategoryModalForm()->addNewCategory($category);
109109
}
110110
}
111+
if (empty($sections['product-details']['category_ids']['value'])) {
112+
// We need to clear 'category_ids' key in case of category(es) absence in Product Fixture
113+
// to avoid force clear related form input on edit product page
114+
unset($sections['product-details']['category_ids']);
115+
}
111116
}
112117
$this->fillContainers($sections, $element);
113118
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@
162162
<wrapper>product</wrapper>
163163
<fields>
164164
<url_key/>
165+
<use_default_url_key>
166+
<selector>[name="use_default[url_key]"]</selector>
167+
<input>checkbox</input>
168+
</use_default_url_key>
165169
</fields>
166170
</search-engine-optimization>
167171
<related>

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/ProductItem.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function getProductName()
8080
*/
8181
public function isVisibleAddToCardButton()
8282
{
83+
$this->_rootElement->hover();
8384
return $this->_rootElement->find($this->addToCard, Locator::SELECTOR_CSS)->isVisible();
8485
}
8586

@@ -90,6 +91,7 @@ public function isVisibleAddToCardButton()
9091
*/
9192
public function clickAddToCart()
9293
{
94+
$this->_rootElement->hover();
9395
$this->_rootElement->find($this->addToCard, Locator::SELECTOR_CSS)->click();
9496
}
9597

0 commit comments

Comments
 (0)