Skip to content

Commit b52a6da

Browse files
Dmytro AponasenkoOleksandr Manchenko
authored andcommitted
MTA-2343: Move all test data to repositories
1 parent 3e0708b commit b52a6da

File tree

33 files changed

+289
-135
lines changed

33 files changed

+289
-135
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" />
338338
</variation>
339339
<variation name="CreateSimpleProductEntityTestVariation19">
340-
<data name="description" xsi:type="string">Create product with cross-sell products</data>
340+
<data name="description" xsi:type="string">MAGETWO-29081: Create product with cross-sell products</data>
341341
<data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data>
342342
<data name="product/data/name" xsi:type="string">Simple Product %isolation%</data>
343343
<data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data>
@@ -354,7 +354,7 @@
354354
<constraint name="Magento\Catalog\Test\Constraint\AssertProductCrossSells" />
355355
</variation>
356356
<variation name="CreateSimpleProductEntityTestVariation20">
357-
<data name="description" xsi:type="string">Create product with up-sell products</data>
357+
<data name="description" xsi:type="string">MAGETWO-29105: Create product with up-sell products</data>
358358
<data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data>
359359
<data name="product/data/name" xsi:type="string">Simple Product %isolation%</data>
360360
<data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data>
@@ -371,7 +371,7 @@
371371
<constraint name="Magento\Catalog\Test\Constraint\AssertProductUpSells" />
372372
</variation>
373373
<variation name="CreateSimpleProductEntityTestVariation21">
374-
<data name="description" xsi:type="string">Create product with related products</data>
374+
<data name="description" xsi:type="string">MAGETWO-29352: Create product with related products</data>
375375
<data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data>
376376
<data name="product/data/name" xsi:type="string">Simple Product %isolation%</data>
377377
<data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data>

dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public function processAssert(
4646
$categoryName = $product->getCategoryIds()[0];
4747
$cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName);
4848
$priceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductItem($product)->getPriceBlock();
49-
$actualPrice['regular'] = $priceBlock->getOldPrice();
50-
$actualPrice['special'] = $priceBlock->getSpecialPrice();
49+
$actualPrice['regular'] = (float)$priceBlock->getOldPrice();
50+
$actualPrice['special'] = (float)$priceBlock->getSpecialPrice();
5151
$actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special'];
5252
$diff = $this->verifyData($actualPrice, $productPrice[$key]);
5353
\PHPUnit_Framework_Assert::assertTrue(

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/AbstractCartItem.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Magento\Mtf\Block\Block;
1010

1111
/**
12-
* Class AbstractCartItem
1312
* Base product item block on checkout page
1413
*/
1514
class AbstractCartItem extends Block
@@ -35,6 +34,13 @@ class AbstractCartItem extends Block
3534
*/
3635
protected $priceInclTax = './/td[@class="col price"]/*[@class="price-including-tax"]/span';
3736

37+
/**
38+
* Selector for unit price excluding tax
39+
*
40+
* @var string
41+
*/
42+
protected $priceExclTax = './/td[@class="col price"]/*[@class="price-excluding-tax"]/span';
43+
3844
/**
3945
* Quantity input selector
4046
*
@@ -47,16 +53,21 @@ class AbstractCartItem extends Block
4753
*
4854
* @var string
4955
*/
50-
protected $subtotalPrice = './/td[@class="col subtotal"]//*[@class="price-excluding-tax"]//span[@class="price"]';
56+
protected $subtotalPrice = '.col.subtotal .price';
57+
58+
/**
59+
* Cart item sub-total excluding tax xpath selector
60+
*
61+
* @var string
62+
*/
63+
protected $subTotalPriceExclTax = '.col.subtotal .price-excluding-tax .price';
5164

52-
// @codingStandardsIgnoreStart
5365
/**
5466
* Cart item sub-total including tax xpath selector
5567
*
5668
* @var string
5769
*/
58-
protected $subTotalPriceInclTax = '//td[@class="col subtotal"]//span[@class="price"]';
59-
// @codingStandardsIgnoreEnd
70+
protected $subTotalPriceInclTax = '.col.subtotal .price-including-tax .price';
6071

6172
/**
6273
* Selector for options block

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/CartItem.php

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ class CartItem extends AbstractCartItem
4949
*/
5050
protected $name = '.product-item-name a';
5151

52-
/**
53-
* Cart item sub-total xpath selector
54-
*
55-
* @var string
56-
*/
57-
protected $subtotalPrice = './/td[@class="col subtotal"]//*[@class="price-excluding-tax"]//span[@class="price"]';
58-
5952
/**
6053
* Get product name
6154
*
@@ -92,6 +85,19 @@ public function getPriceInclTax()
9285
: null;
9386
}
9487

88+
/**
89+
* Get product price excluding tax
90+
*
91+
* @return string|null
92+
*/
93+
public function getPriceExclTax()
94+
{
95+
$cartProductPrice = $this->_rootElement->find($this->priceExclTax, Locator::SELECTOR_XPATH);
96+
return $cartProductPrice->isVisible()
97+
? str_replace(',', '', $this->escapeCurrency($cartProductPrice->getText()))
98+
: null;
99+
}
100+
95101
/**
96102
* Set product quantity
97103
*
@@ -120,7 +126,20 @@ public function getQty()
120126
*/
121127
public function getSubtotalPrice()
122128
{
123-
$cartProductPrice = $this->_rootElement->find($this->subtotalPrice, Locator::SELECTOR_XPATH);
129+
$cartProductPrice = $this->_rootElement->find($this->subtotalPrice);
130+
return $cartProductPrice->isVisible()
131+
? str_replace(',', '', $this->escapeCurrency($cartProductPrice->getText()))
132+
: null;
133+
}
134+
135+
/**
136+
* Get sub-total excluding tax for the specified item in the cart
137+
*
138+
* @return string|null
139+
*/
140+
public function getSubtotalPriceExclTax()
141+
{
142+
$cartProductPrice = $this->_rootElement->find($this->subTotalPriceExclTax);
124143
return $cartProductPrice->isVisible()
125144
? str_replace(',', '', $this->escapeCurrency($cartProductPrice->getText()))
126145
: null;
@@ -133,7 +152,7 @@ public function getSubtotalPrice()
133152
*/
134153
public function getSubtotalPriceInclTax()
135154
{
136-
$cartProductPrice = $this->_rootElement->find($this->subTotalPriceInclTax, Locator::SELECTOR_XPATH);
155+
$cartProductPrice = $this->_rootElement->find($this->subTotalPriceInclTax);
137156
return $cartProductPrice->isVisible()
138157
? str_replace(',', '', $this->escapeCurrency($cartProductPrice->getText()))
139158
: null;

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/AbstractReview.php

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ abstract class AbstractReview extends Block
2626
*/
2727
protected $continueCheckoutButton = '#review-buttons-container button';
2828

29+
/**
30+
* Product item block locator.
31+
*
32+
* @var string
33+
*/
34+
protected $productItemByName = './/li[contains(@class,"product-item") and contains(.,"%s")]';
35+
2936
/**
3037
* Grand total search mask.
3138
*
@@ -38,14 +45,14 @@ abstract class AbstractReview extends Block
3845
*
3946
* @var string
4047
*/
41-
protected $grandTotalExclTax = '[class="grand totals excl"] td>strong';
48+
protected $grandTotalExclTax = '.grand.totals.excl .price';
4249

4350
/**
4451
* Grand total including tax search mask.
4552
*
4653
* @var string
4754
*/
48-
protected $grandTotalInclTax = '[class="grand totals incl"] td>strong';
55+
protected $grandTotalInclTax = '.grand.totals.incl .price';
4956

5057
/**
5158
* Subtotal search mask.
@@ -59,28 +66,28 @@ abstract class AbstractReview extends Block
5966
*
6067
* @var string
6168
*/
62-
protected $subtotalExclTax = '[class="totals sub excl"] span';
69+
protected $subtotalExclTax = '.totals.sub.excl .price';
6370

6471
/**
6572
* Subtotal including tax search mask.
6673
*
6774
* @var string
6875
*/
69-
protected $subtotalInclTax = '[class="totals sub incl"] span';
76+
protected $subtotalInclTax = '.totals.sub.incl .price';
7077

7178
/**
7279
* Tax search mask.
7380
*
7481
* @var string
7582
*/
76-
protected $tax = '.totals-tax span';
83+
protected $tax = '.totals-tax .price';
7784

7885
/**
7986
* Discount search mask.
8087
*
8188
* @var string
8289
*/
83-
protected $discount = '[class="totals"] .amount>span';
90+
protected $discount = '.totals.discount .price';
8491

8592
/**
8693
* Shipping excluding tax search mask.
@@ -94,36 +101,36 @@ abstract class AbstractReview extends Block
94101
*
95102
* @var string
96103
*/
97-
protected $shippingInclTax = '[class="totals shipping incl"] span';
104+
protected $shippingInclTax = '.totals.shipping.incl .price';
98105

99106
/**
100107
* Product price excluding tax search mask.
101108
*
102109
* @var string
103110
*/
104-
protected $itemExclTax = '//tr[contains (.,"%s")]/td[@class="col price"]/span[@class="price-excluding-tax"]/span';
111+
protected $itemExclTax = '.price-excluding-tax .price';
105112

106113
/**
107114
* Product price including tax search mask.
108115
*
109116
* @var string
110117
*/
111-
protected $itemInclTax = '//tr[contains (.,"%s")]/td[@class="col price"]/span[@class="price-including-tax"]/span';
118+
protected $itemInclTax = '.price-including-tax .price';
112119

113120
// @codingStandardsIgnoreStart
114121
/**
115122
* Product price subtotal excluding tax search mask.
116123
*
117124
* @var string
118125
*/
119-
protected $itemSubExclTax = '//tr[contains (.,"%s")]/td[@class="col subtotal"]/span[@class="price-excluding-tax"]/span';
126+
protected $itemSubExclTax = '.subtotal .price-excluding-tax .price';
120127

121128
/**
122129
* Product price subtotal including tax search mask.
123130
*
124131
* @var string
125132
*/
126-
protected $itemSubInclTax = '//tr[contains (.,"%s")]/td[@class="col subtotal"]/span[@class="price-including-tax"]/span';
133+
protected $itemSubInclTax = '.subtotal .price-including-tax .price';
127134
// @codingStandardsIgnoreEnd
128135

129136
/**
@@ -163,8 +170,11 @@ public function getGrandTotal()
163170
*/
164171
public function getItemPriceExclTax($productName)
165172
{
166-
$locator = sprintf($this->itemExclTax, $productName);
167-
$price = $this->_rootElement->find($locator, Locator::SELECTOR_XPATH);
173+
$productItem = $this->_rootElement->find(
174+
sprintf($this->productItemByName, $productName),
175+
Locator::SELECTOR_XPATH
176+
);
177+
$price = $productItem->find($this->itemExclTax);
168178
return $price->isVisible() ? $this->escapeCurrency($price->getText()) : null;
169179
}
170180

@@ -176,8 +186,11 @@ public function getItemPriceExclTax($productName)
176186
*/
177187
public function getItemPriceInclTax($productName)
178188
{
179-
$locator = sprintf($this->itemInclTax, $productName);
180-
$price = $this->_rootElement->find($locator, Locator::SELECTOR_XPATH);
189+
$productItem = $this->_rootElement->find(
190+
sprintf($this->productItemByName, $productName),
191+
Locator::SELECTOR_XPATH
192+
);
193+
$price = $productItem->find($this->itemInclTax);
181194
return $price->isVisible() ? $this->escapeCurrency($price->getText()) : null;
182195
}
183196

@@ -189,8 +202,11 @@ public function getItemPriceInclTax($productName)
189202
*/
190203
public function getItemSubExclTax($productName)
191204
{
192-
$locator = sprintf($this->itemSubExclTax, $productName);
193-
$price = $this->_rootElement->find($locator, Locator::SELECTOR_XPATH);
205+
$productItem = $this->_rootElement->find(
206+
sprintf($this->productItemByName, $productName),
207+
Locator::SELECTOR_XPATH
208+
);
209+
$price = $productItem->find($this->itemSubExclTax);
194210
return $price->isVisible() ? $this->escapeCurrency($price->getText()) : null;
195211
}
196212

@@ -202,8 +218,11 @@ public function getItemSubExclTax($productName)
202218
*/
203219
public function getItemSubInclTax($productName)
204220
{
205-
$locator = sprintf($this->itemSubInclTax, $productName);
206-
$price = $this->_rootElement->find($locator, Locator::SELECTOR_XPATH);
221+
$productItem = $this->_rootElement->find(
222+
sprintf($this->productItemByName, $productName),
223+
Locator::SELECTOR_XPATH
224+
);
225+
$price = $productItem->find($this->itemSubInclTax);
207226
return $price->isVisible() ? $this->escapeCurrency($price->getText()) : null;
208227
}
209228

@@ -236,8 +255,8 @@ public function getGrandTotalInclTax()
236255
*/
237256
public function getTax()
238257
{
239-
$tax = $this->_rootElement->find($this->tax, Locator::SELECTOR_CSS)->getText();
240-
return $this->escapeCurrency($tax);
258+
$tax = $this->_rootElement->find($this->tax, Locator::SELECTOR_CSS);
259+
return $tax->isVisible() ? $this->escapeCurrency($tax->getText()) : null;
241260
}
242261

243262
/**
@@ -302,7 +321,6 @@ public function getShippingInclTax()
302321
*/
303322
public function getShippingExclTax()
304323
{
305-
$this->waitForElementVisible($this->shippingExclTax);
306324
$subTotal = $this->_rootElement->find($this->shippingExclTax, Locator::SELECTOR_CSS);
307325
return $subTotal->isVisible() ? $this->escapeCurrency($subTotal->getText()) : null;
308326
}

0 commit comments

Comments
 (0)