Skip to content

Commit 82ec7a7

Browse files
author
Oleksandr Manchenko
committed
MTA-1814: Analyse functional test failures - Sprint 9
1 parent e9de1d2 commit 82ec7a7

File tree

9 files changed

+47
-23
lines changed

9 files changed

+47
-23
lines changed

dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22
/**
3-
* {license_notice}
4-
*
5-
* @copyright {copyright}
6-
* @license {license_link}
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
75
*/
86

97
namespace Magento\AdminNotification\Test\Block\System;

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,14 @@ public function isSpecialPriceVisible()
151151
{
152152
return $this->getTypePriceElement('special_price')->isVisible();
153153
}
154+
155+
/**
156+
* This method returns if the old price is visible.
157+
*
158+
* @return bool
159+
*/
160+
public function isOldPriceVisible()
161+
{
162+
return $this->getTypePriceElement('old_price')->isVisible();
163+
}
154164
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCategory.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
use Magento\Mtf\Fixture\FixtureInterface;
1414

1515
/**
16-
* Class AssertProductInCategory
16+
* Checking the product in the page of its price.
1717
*/
1818
class AssertProductInCategory extends AbstractConstraint
1919
{
2020
/**
21-
* Checking the product in the page of its price
21+
* Checking the product in the page of its price.
2222
*
2323
* @param CatalogCategoryView $catalogCategoryView
2424
* @param CmsIndex $cmsIndex
@@ -56,25 +56,33 @@ public function processAssert(
5656
}
5757

5858
/**
59-
* Verify product price on category view page
59+
* Verify product price on category view page.
6060
*
6161
* @param FixtureInterface $product
6262
* @param CatalogCategoryView $catalogCategoryView
6363
* @return void
6464
*/
6565
protected function assertPrice(FixtureInterface $product, CatalogCategoryView $catalogCategoryView)
6666
{
67-
$price = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock()->getPrice();
67+
$priceBlock = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock();
6868

6969
\PHPUnit_Framework_Assert::assertEquals(
7070
number_format($product->getPrice(), 2, '.', ''),
71-
$price,
71+
$priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice(),
7272
'Product regular price on category page is not correct.'
7373
);
74+
75+
if ($product->hasData('special_price')) {
76+
\PHPUnit_Framework_Assert::assertEquals(
77+
number_format($product->getSpecialPrice(), 2, '.', ''),
78+
$priceBlock->getSpecialPrice(),
79+
'Product special price on category page is not correct.'
80+
);
81+
}
7482
}
7583

7684
/**
77-
* Returns a string representation of the object
85+
* Returns a string representation of the object.
7886
*
7987
* @return string
8088
*/

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,15 @@ protected function verifyPrice()
110110
return null;
111111
}
112112

113-
$fixtureProductPrice = number_format($this->product->getPrice(), 2);
114-
$formProductPrice = $this->productView->getPriceBlock()->getPrice();
113+
$priceBlock = $this->productView->getPriceBlock();
114+
$formPrice = $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice();
115+
$fixturePrice = number_format($this->product->getPrice(), 2, '.', '');
115116

116-
if ($fixtureProductPrice == $formProductPrice) {
117-
return null;
117+
if ($fixturePrice != $formPrice) {
118+
return "Displayed product price on product page(front-end) not equals passed from fixture. "
119+
. "Actual: {$fixturePrice}, expected: {$formPrice}.";
118120
}
119-
return "Displayed product price on product page(front-end) not equals passed from fixture. "
120-
. "Actual: {$formProductPrice}, expected: {$fixtureProductPrice}.";
121+
return null;
121122
}
122123

123124
/**

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Sidebar extends Block
2121
*
2222
* @var string
2323
*/
24-
protected $qty = '//*[@class="product"]/*[@title="%s"]/following-sibling::*//*[@class="value qty"]';
24+
protected $qty = '//*[@class="product"]/*[@title="%s"]/following-sibling::*//*[contains(@class,"item-qty")]';
2525

2626
/**
2727
* Mini cart link selector
@@ -37,12 +37,19 @@ class Sidebar extends Block
3737
*/
3838
protected $cartContent = 'div.minicart';
3939

40+
/**
41+
* Product list in mini shopping cart.
42+
*
43+
* @var string
44+
*/
45+
protected $cartProductList = './/*[contains(@role, "dialog") and not(contains(@style,"display: none;"))]';
46+
4047
/**
4148
* Selector for cart item block
4249
*
4350
* @var string
4451
*/
45-
protected $cartProductName = './/*[@id="mini-cart"]//li[.//a[normalize-space(text())="%s"]]';
52+
protected $cartProductName = '//*[@id="mini-cart"]//li[.//a[normalize-space(text())="%s"]]';
4653

4754
/**
4855
* Counter qty locator
@@ -91,7 +98,7 @@ public function getProductQty($productName)
9198
{
9299
$this->openMiniCart();
93100
$productQty = sprintf($this->qty, $productName);
94-
return $this->_rootElement->find($productQty, Locator::SELECTOR_XPATH)->getText();
101+
return $this->_rootElement->find($productQty, Locator::SELECTOR_XPATH)->getValue();
95102
}
96103

97104
/**
@@ -110,7 +117,7 @@ public function getCartItem(FixtureInterface $product)
110117
$cartItem = $this->callRender($typeId, 'getCartItem', ['product' => $product]);
111118
} else {
112119
$cartItemBlock = $this->_rootElement->find(
113-
sprintf($this->cartProductName, $product->getName()),
120+
sprintf($this->cartProductList . $this->cartProductName, $product->getName()),
114121
Locator::SELECTOR_XPATH
115122
);
116123
$cartItem = $this->blockFactory->create(

dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function test(CatalogProductSimple $product)
108108
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
109109
$productView = $this->catalogProductView->getViewBlock();
110110
$productView->fillOptions($product);
111-
$productView->setQty(1);
111+
$productView->setQty($product->getCheckoutData()['qty']);
112112
$productView->clickAddToCart();
113113
$this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
114114

dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" />
2020
</variation>
2121
<variation name="UpdateShoppingCartTestVariation2">
22-
<data name="issue" xsi:type="string">Bug: MAGETWO-35274</data>
2322
<data name="product/dataSet" xsi:type="string">with_two_custom_option</data>
2423
<data name="product/data/price/value" xsi:type="string">50</data>
2524
<data name="product/data/checkout_data/qty" xsi:type="string">11</data>

dev/tests/functional/tests/app/Magento/Downloadable/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinkRow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class LinkRow extends Form
1919
*
2020
* @var string
2121
*/
22-
protected $deleteButton = '.delete-link-item';
22+
protected $deleteButton = '.action-remove';
2323

2424
/**
2525
* Fill item link

dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class MoveProductFromShoppingCartToWishlistTest extends AbstractWishlistTest
2929
/* tags */
3030
const MVP = 'no';
3131
const DOMAIN = 'CS';
32+
const STABLE = 'no';
3233
/* end tags */
3334

3435
/**

0 commit comments

Comments
 (0)