Skip to content

Commit

Permalink
Merge pull request #233 from magento-qmt/PR
Browse files Browse the repository at this point in the history
Fixed issue:
 - MAGETWO-55970 [FT] Constraint AssertProductQtyInMiniShoppingCart is absent

Functional tests:
 - MTA-3383 Catalog Widget: Extend existing functional automated tests. Cache
 - MTA-3242 Reports: Extend existing functional automated tests
 - MTA-3241 Catalog Widget: Extend existing functional automated tests
 - MTA-3237 Downloadable: Extend existing functional automated tests
 - MTA-3483 Create pull request and deliver extended functional tests to mainline
 - MTA-3437 \Magento\Config\Test\Handler\ConfigData\Curl handler doesn't allow to save values for different website scopes.
  • Loading branch information
lanken authored Aug 11, 2016
2 parents d95d459 + 3b0eb04 commit ab36d41
Show file tree
Hide file tree
Showing 62 changed files with 1,247 additions and 277 deletions.
2 changes: 1 addition & 1 deletion dev/tests/functional/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"magento/mtf": "1.0.0-rc44",
"magento/mtf": "1.0.0-rc46",
"php": "~5.6.0|7.0.2|~7.0.6",
"phpunit/phpunit": "4.1.0",
"phpunit/phpunit-selenium": ">=1.2"
Expand Down
147 changes: 147 additions & 0 deletions dev/tests/functional/etc/repository_replacer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">

<repository class="Magento\Catalog\Test\Repository\CatalogAttributeSet">
<dataset name="default">
<field name="attribute_set_id" xsi:type="number">4</field>
</dataset>
</repository>

<repository class="Magento\Catalog\Test\Repository\CatalogProductAttribute">
<dataset name="quantity_and_stock_status">
<field name="attribute_id" xsi:type="number">113</field>
</dataset>

<dataset name="tax_class_id">
<field name="attribute_id" xsi:type="number">172</field>
</dataset>
</repository>

<repository class="Magento\Catalog\Test\Repository\Category">
<dataset name="default_category">
<field name="parent_id" xsi:type="number">1</field>
<field name="id" xsi:type="number">2</field>
</dataset>

<dataset name="root_category">
<field name="parent_id" xsi:type="number">1</field>
</dataset>
</repository>

<repository class="Magento\Customer\Test\Repository\CustomerGroup">
<dataset name="General">
<field name="customer_group_id" xsi:type="number">1</field>
</dataset>

<dataset name="Retailer">
<field name="customer_group_id" xsi:type="number">3</field>
</dataset>

<dataset name="Wholesale">
<field name="customer_group_id" xsi:type="number">2</field>
</dataset>

<dataset name="all_customer_groups">
<field name="customer_group_id" xsi:type="number">0</field>
</dataset>

<dataset name="NOT_LOGGED_IN">
<field name="customer_group_id" xsi:type="number">0</field>
</dataset>

<dataset name="ALL_GROUPS">
<field name="customer_group_id" xsi:type="number">32000</field>
</dataset>
</repository>

<repository class="Magento\Store\Test\Repository\Store">
<dataset name="default">
<field name="store_id" xsi:type="number">1</field>
</dataset>

<dataset name="default_store_view">
<field name="store_id" xsi:type="number">1</field>
</dataset>

<dataset name="all_store_views">
<field name="store_id" xsi:type="number">0</field>
</dataset>
</repository>

<repository class="Magento\Store\Test\Repository\StoreGroup">
<dataset name="default">
<field name="group_id" xsi:type="number">1</field>
</dataset>
</repository>

<repository class="Magento\Store\Test\Repository\Website">
<dataset name="default">
<field name="website_id" xsi:type="number">1</field>
</dataset>

<dataset name="all_websites">
<field name="website_id" xsi:type="number">0</field>
</dataset>

<dataset name="main_website">
<field name="website_id" xsi:type="number">1</field>
</dataset>
</repository>

<repository class="Magento\Tax\Test\Repository\TaxClass">
<dataset name="taxable_goods">
<field name="id" xsi:type="number">2</field>
<field name="class_id" xsi:type="number">2</field>
</dataset>

<dataset name="retail_customer">
<field name="class_id" xsi:type="number">3</field>
<field name="id" xsi:type="number">3</field>
</dataset>

<dataset name="None">
<field name="id" xsi:type="number">0</field>
</dataset>
</repository>

<repository class="Magento\Tax\Test\Repository\TaxRate">
<dataset name="US-CA-Rate_1">
<field name="tax_calculation_rate_id" xsi:type="number">1</field>
<field name="tax_region_id" xsi:type="number">12</field>
</dataset>

<dataset name="US-IL-Rate_1">
<field name="tax_region_id" xsi:type="number">23</field>
</dataset>

<dataset name="US-NY-Rate_1">
<field name="tax_calculation_rate_id" xsi:type="number">2</field>
<field name="tax_region_id" xsi:type="number">43</field>
</dataset>
</repository>

<repository class="Magento\User\Test\Repository\Role">
<dataset name="Administrators">
<field name="role_id" xsi:type="number">1</field>
</dataset>
</repository>

<repository class="Magento\User\Test\Repository\User">
<dataset name="default">
<field name="user_id" xsi:type="number">1</field>
</dataset>
</repository>

<repository class="Magento\Catalog\Test\Repository\CatalogProductSimple">
<dataset name="sample_data_simple_product">
<field name="id" xsi:type="number">1</field>
</dataset>
</repository>
</config>
3 changes: 2 additions & 1 deletion dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected function execute($command, $options = [])
{
$curl = $this->transport;
$curl->write($this->prepareUrl($command, $options), [], CurlInterface::GET);
$curl->read();
$curl->close();
}

Expand All @@ -60,6 +61,6 @@ protected function execute($command, $options = [])
private function prepareUrl($command, array $options)
{
$command .= ' ' . implode(' ', $options);
return $_ENV['app_frontend_url'] . Cli::URL . '?command=' . urldecode($command);
return $_ENV['app_frontend_url'] . Cli::URL . '?command=' . urlencode($command);
}
}
62 changes: 62 additions & 0 deletions dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Mtf\Util\Command\Cli;

use Magento\Mtf\Util\Command\Cli;

/**
* Handle cache for tests executions.
*/
class Cache extends Cli
{
/**
* Parameter for flush cache command.
*/
const PARAM_CACHE_FLUSH = 'cache:flush';

/**
* Parameter for cache disable command.
*/
const PARAM_CACHE_DISABLE = 'cache:disable';

/**
* Parameter for cache enable command.
*/
const PARAM_CACHE_ENABLE = 'cache:enable';

/**
* Flush cache.
*
* @return void
*/
public function flush()
{
parent::execute(Cache::PARAM_CACHE_FLUSH);
}

/**
* Disable all cache or one cache type.
*
* @param string $cacheType [optional]
* @return void
*/
public function disableCache($cacheType = null)
{
parent::execute(Cache::PARAM_CACHE_DISABLE . ($cacheType ? " $cacheType" : ''));
}

/**
* Enable all cache or one cache type.
*
* @param string $cacheType [optional]
* @return void
*/
public function enableCache($cacheType = null)
{
parent::execute(Cache::PARAM_CACHE_ENABLE . ($cacheType ? " $cacheType" : ''));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public function create($websiteCode)
*/
private function prepareUrl($websiteCode)
{
return $_ENV['app_frontend_url'] . Website::URL . '?website_code=' . urldecode($websiteCode);
return $_ENV['app_frontend_url'] . Website::URL . '?website_code=' . urlencode($websiteCode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Magento\AdminNotification\Test\Block\System;

use Magento\Mtf\Block\Block;
use Magento\Mtf\Client\Locator;

/**
* Global messages block.
Expand All @@ -20,6 +21,13 @@ class Messages extends Block
*/
protected $closePopup = '[data-role="closeBtn"]';

/**
* Locator for popup text.
*
* @var string
*/
protected $popupText = ".//*[@id='system_messages_list']/ul/li";

/**
* Close popup block.
*
Expand All @@ -31,4 +39,14 @@ public function closePopup()
$this->_rootElement->find($this->closePopup)->click();
}
}

/**
* Get pop up text.
*
* @return string
*/
public function getPopupText()
{
return $this->_rootElement->find($this->popupText, Locator::SELECTOR_XPATH)->getText();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

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

use Magento\Mtf\Block\Block;

/**
* System message block.
*/
class System extends Block
{
/**
* Get block text content.
*
* @return string
*/
public function getContent()
{
return $this->_rootElement->getText();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ class View extends Block
*
* @var string
*/
protected $recentlyViewedProducts = './/*[contains(@class,"widget")]//strong[@class="product-item-name"]';
protected $recentlyViewedProducts = '.block-viewed-products-grid strong.product-item-name';

/**
* New Products selectors.
*
* @var string
*/
protected $newProducts = '.block-new-products strong.product-item-name';

/**
* Description CSS selector.
Expand Down Expand Up @@ -65,8 +72,24 @@ public function getContent()
public function getProductsFromRecentlyViewedBlock()
{
$products = [];
$this->waitForElementVisible($this->recentlyViewedProducts, Locator::SELECTOR_XPATH);
$productNames = $this->_rootElement->getElements($this->recentlyViewedProducts, Locator::SELECTOR_XPATH);
$this->waitForElementVisible($this->recentlyViewedProducts, Locator::SELECTOR_CSS);
$productNames = $this->_rootElement->getElements($this->recentlyViewedProducts, Locator::SELECTOR_CSS);
foreach ($productNames as $productName) {
$products[] = $productName->getText();
}
return $products;
}

/**
* Get products from Catalog New Products List block.
*
* @return array
*/
public function getProductsFromCatalogNewProductsListBlock()
{
$products = [];
$this->waitForElementVisible($this->newProducts, Locator::SELECTOR_CSS);
$productNames = $this->_rootElement->getElements($this->newProducts, Locator::SELECTOR_CSS);
foreach ($productNames as $productName) {
$products[] = $productName->getText();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TierPrice extends DataSource
private $fixtureFactory;

/**
* Rought fixture field data.
* Rough fixture field data.
*
* @var array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
<repository class="Magento\Catalog\Test\Repository\CatalogAttributeSet">
<dataset name="default">
<field name="attribute_set_id" xsi:type="string">%id%</field>
<field name="attribute_set_name" xsi:type="string">Default</field>
<field name="attribute_set_id" xsi:type="string">4</field>
</dataset>

<dataset name="custom_attribute_set">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</dataset>

<dataset name="quantity_and_stock_status">
<field name="attribute_id" xsi:type="number">113</field>
<field name="attribute_id" xsi:type="string">%id%</field>
<field name="frontend_label" xsi:type="string">Quantity</field>
<field name="attribute_code" xsi:type="string">quantity_and_stock_status</field>
<field name="frontend_input" xsi:type="string">Dropdown</field>
Expand All @@ -34,7 +34,7 @@
</dataset>

<dataset name="tax_class_id">
<field name="attribute_id" xsi:type="number">172</field>
<field name="attribute_id" xsi:type="string">%id%</field>
<field name="frontend_label" xsi:type="string">Tax Class%isolation%</field>
<field name="attribute_code" xsi:type="string">tax_class_id%isolation%</field>
<field name="frontend_input" xsi:type="string">Dropdown</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@
</dataset>

<dataset name="sample_data_simple_product">
<field name="id" xsi:type="string">1</field>
<field name="id" xsi:type="string">%id%</field>
<field name="name" xsi:type="string">Overnight Duffle</field>
<field name="sku" xsi:type="string">24-WB07</field>
<field name="url_key" xsi:type="string">overnight-duffle</field>
Expand Down
Loading

0 comments on commit ab36d41

Please sign in to comment.