Skip to content

Commit

Permalink
Merge pull request #374 from magento-qmt/PR
Browse files Browse the repository at this point in the history
[Mavericks] Update PHPUnit for Functional tests and extend tests
- MTA-3311 Upgrade PHPUnit to the Latest Version
- MTA-3225 Bundle: Extend existing functional automated tests
- MTA-3484 Resolve an issue with upgrade to the latest Selenium and FF
  • Loading branch information
slavvka authored Sep 13, 2016
2 parents 83f4f2e + 43ddfb2 commit e6363a8
Show file tree
Hide file tree
Showing 17 changed files with 551 additions and 54 deletions.
10 changes: 9 additions & 1 deletion dev/tests/functional/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@

require_once __DIR__ . '/../../../app/bootstrap.php';
restore_error_handler();
require_once __DIR__ . '/vendor/autoload.php';
$vendorAutoload = __DIR__ . '/vendor/autoload.php';

if (isset($composerAutoloader)) {
/** var $mtfComposerAutoload \Composer\Autoload\ClassLoader */
$mtfComposerAutoload = include $vendorAutoload;
$composerAutoloader->addClassMap($mtfComposerAutoload->getClassMap());
} else {
$composerAutoloader = include $vendorAutoload;
}

setCustomErrorHandler();

Expand Down
4 changes: 2 additions & 2 deletions dev/tests/functional/composer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"require": {
"magento/mtf": "1.0.0-rc47",
"magento/mtf": "1.0.0-rc48",
"php": "~5.6.0|7.0.2|~7.0.6",
"phpunit/phpunit": "4.1.0",
"phpunit/phpunit": "~4.8.0|~5.5.0",
"phpunit/phpunit-selenium": ">=1.2"
},
"suggest": {
Expand Down
32 changes: 32 additions & 0 deletions dev/tests/functional/credentials.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,36 @@
<field replace="carriers_dhl_id_eu" value="" />
<field replace="carriers_dhl_password_eu" value="" />
<field replace="carriers_dhl_account_eu" value="" />

<field path="payment/authorizenet_directpost/login" value="" />
<field path="payment/authorizenet_directpost/trans_key" value="" />
<field path="payment/authorizenet_directpost/trans_md5" value="" />

<field path="payment/braintree_section/braintree/braintree_advanced/merchant_account_id" value="" />
<field path="payment/braintree_section/braintree/braintree_required/merchant_id" value="" />
<field path="payment/braintree_section/braintree/braintree_required/public_key" value="" />
<field path="payment/braintree_section/braintree/braintree_required/private_key" value="" />

<field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/business_account" value="" />
<field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_username" value="" />
<field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_password" value="" />
<field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_signature" value="" />
<field path="payment/paypal_express/merchant_id" value="" />

<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/business_account" value="" />
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/partner" value="" />
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/user" value="" />
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/pwd" value="" />
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/vendor" value="" />

<field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/business_account" value="" />
<field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_username" value="" />
<field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_password" value="" />
<field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_signature" value="" />

<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/business_account" value="" />
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/partner" value="" />
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/user" value="" />
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/pwd" value="" />
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/vendor" value="" />
</replace>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Mtf\Client\Element;

use Magento\Mtf\Client\Locator;

/**
* Class provides ability to work with page element radio button.
*/
class RadiobuttonElement extends SimpleElement
{
/**
* Label for radio button selector.
*
* @var string
*/
protected $labelSelector = './..//label[contains(., "%s")]';

/**
* Selector for selected label.
*
* @var string
*/
protected $selectedLabelSelector = 'input[type=radio]:checked + label';

/**
* Get value of the required element.
*
* @return string
*/
public function getValue()
{
$this->eventManager->dispatchEvent(['get_value'], [$this->getAbsoluteSelector()]);

return $this->find($this->selectedLabelSelector)->getText();
}

/**
* Select radio button based on label value.
*
* @param string $value
* @return void
*/
public function setValue($value)
{
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);

$radioButtonLabel = $this->find(sprintf($this->labelSelector, $value), Locator::SELECTOR_XPATH);
if (!$this->isSelected()) {
$radioButtonLabel->click();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Bundle\Test\Constraint;

use Magento\Catalog\Test\Constraint\AssertProductInCart;
use Magento\Checkout\Test\Page\CheckoutCart;
use Magento\Mtf\Fixture\FixtureInterface;

/**
* Assertion that bundle product is correctly displayed in cart.
*/
class AssertBundleProductInCart extends AssertProductInCart
{
/**
* Count prices.
*
* @param FixtureInterface $product
* @param CheckoutCart $checkoutCart
* @return void
*/
protected function countPrices(FixtureInterface $product, CheckoutCart $checkoutCart)
{
parent::countPrices($product, $checkoutCart);
$this->countSubItemPrice($product);
}

/**
* Count subItem price.
*
* @param FixtureInterface $product
* @return void
*/
private function countSubItemPrice(FixtureInterface $product)
{
$checkoutData = $product->getCheckoutData();
if (isset($checkoutData['cartItem']['subItemPrice'])) {
$this->fixtureActualPrice += $checkoutData["cartItem"]["subItemPrice"];
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,39 @@ protected function verifyPrice()

return empty($errors) ? null : implode("\n", $errors);
}

/**
* Verify product special price is displayed on product page(front-end).
*
* @return string|null
*/
protected function verifySpecialPrice()
{
if (!$this->product->hasData('special_price')) {
return null;
}

$priceBlock = $this->productView->getPriceBlock();

if (!$priceBlock->isVisible()) {
return "Price block for '{$this->product->getName()}' product' is not visible.";
}

if (!$priceBlock->isOldPriceVisible()) {
return 'Bundle special price is not set.';
}

$regularPrice = $priceBlock->getOldPrice();
$priceData = $this->product->getDataFieldConfig('price')['source']->getPriceData();

if (!isset($priceData['regular_from'])) {
return 'Regular from price not set.';
}

if ($priceData['regular_from'] != $regularPrice) {
return 'Bundle regular price on product view page is not correct.';
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
<field name="products" xsi:type="array">
<item name="0" xsi:type="array">
<item name="0" xsi:type="string">catalogProductSimple::default</item>
<item name="1" xsi:type="string">catalogProductSimple::product_100_dollar</item>
<item name="1" xsi:type="string">catalogProductSimple::product_10_dollar</item>
</item>
</field>
</dataset>
Expand Down Expand Up @@ -604,5 +604,66 @@
</item>
</field>
</dataset>

<dataset name="dynamic_with_two_required_options_assigned_products_with_special_price">
<field name="bundle_options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="title" xsi:type="string">Drop-down Option</item>
<item name="type" xsi:type="string">Drop-down</item>
<item name="required" xsi:type="string">Yes</item>
<item name="assigned_products" xsi:type="array">
<item name="0" xsi:type="array">
<item name="search_data" xsi:type="array">
<item name="name" xsi:type="string">%product_name%</item>
</item>
<item name="data" xsi:type="array">
<item name="selection_qty" xsi:type="string">1</item>
</item>
</item>
<item name="1" xsi:type="array">
<item name="search_data" xsi:type="array">
<item name="name" xsi:type="string">%product_name%</item>
</item>
<item name="data" xsi:type="array">
<item name="selection_qty" xsi:type="string">1</item>
</item>
</item>
</item>
</item>
<item name="1" xsi:type="array">
<item name="title" xsi:type="string">Drop-down Option</item>
<item name="type" xsi:type="string">Drop-down</item>
<item name="required" xsi:type="string">Yes</item>
<item name="assigned_products" xsi:type="array">
<item name="0" xsi:type="array">
<item name="search_data" xsi:type="array">
<item name="name" xsi:type="string">%product_name%</item>
</item>
<item name="data" xsi:type="array">
<item name="selection_qty" xsi:type="string">1</item>
</item>
</item>
<item name="1" xsi:type="array">
<item name="search_data" xsi:type="array">
<item name="name" xsi:type="string">%product_name%</item>
</item>
<item name="data" xsi:type="array">
<item name="selection_qty" xsi:type="string">1</item>
</item>
</item>
</item>
</item>
</field>
<field name="products" xsi:type="array">
<item name="0" xsi:type="array">
<item name="0" xsi:type="string">catalogProductSimple::product_10_dollar</item>
<item name="1" xsi:type="string">catalogProductSimple::product_with_special_price</item>
</item>
<item name="1" xsi:type="array">
<item name="0" xsi:type="string">catalogProductSimple::product_10_dollar</item>
<item name="1" xsi:type="string">catalogProductSimple::product_with_special_price</item>
</item>
</field>
</dataset>
</repository>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,36 @@
</field>
</dataset>

<dataset name="bundle_with_custom_options_3">
<field name="options" xsi:type="array">
<item name="bundle_options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="title" xsi:type="string">Drop-down Option</item>
<item name="type" xsi:type="string">Drop-down</item>
<item name="value" xsi:type="array">
<item name="name" xsi:type="string">product_10_dollar</item>
</item>
</item>
</item>
<item name="custom_options" xsi:type="array">
<item name="0" xsi:type="array">
<item name="title" xsi:type="string">attribute_key_0</item>
<item name="value" xsi:type="string">option_key_0</item>
</item>
<item name="1" xsi:type="array">
<item name="title" xsi:type="string">attribute_key_1</item>
<item name="value" xsi:type="string">option_key_0</item>
</item>
</item>
</field>
<field name="cartItem" xsi:type="array">
<item name="price" xsi:type="string">100</item>
<item name="qty" xsi:type="string">1</item>
<item name="subtotal" xsi:type="string">100</item>
<item name="subItemPrice" xsi:type="string">10</item>
</field>
</dataset>

<dataset name="bundle_all_types_bundle_fixed_and_custom_options">
<field name="options" xsi:type="array">
<item name="bundle_options" xsi:type="array">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@
<field name="cart_price" xsi:type="string">756.00</field>
</dataset>

<dataset name="fixed-51">
<field name="price_from" xsi:type="string">51.00</field>
<field name="price_to" xsi:type="string">52.00</field>
<field name="regular_from" xsi:type="string">135.00</field>
</dataset>

<dataset name="fixed-756-custom-options">
<field name="price_from" xsi:type="string">785.00</field>
<field name="price_to" xsi:type="string">786.00</field>
<field name="cart_price" xsi:type="string">786.00</field>
</dataset>

<dataset name="bundle_fixed_with_category">
<field name="price_from" xsi:type="string">130.00</field>
<field name="price_to" xsi:type="string">144.00</field>
Expand All @@ -94,6 +106,12 @@
<field name="price_from" xsi:type="string">8.00</field>
<field name="price_to" xsi:type="string">20.00</field>
<field name="cart_price" xsi:type="string">80.00</field>
<field name="regular_from" xsi:type="string">40.00</field>
</dataset>

<dataset name="dynamic-18">
<field name="price_from" xsi:type="string">18.00</field>
<field name="price_to" xsi:type="string">20.00</field>
</dataset>

<dataset name="dynamic-32">
Expand Down
Loading

0 comments on commit e6363a8

Please sign in to comment.