Skip to content

Commit

Permalink
Merge pull request #667 from magento-qmt/develop
Browse files Browse the repository at this point in the history
[Mavericks] Created Web Api handlers and extended functional tests
  • Loading branch information
Korshenko, Olexii(okorshenko) committed Oct 2, 2015
2 parents 0925d89 + c63b306 commit 12955b1
Show file tree
Hide file tree
Showing 85 changed files with 2,447 additions and 391 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-rc33",
"magento/mtf": "1.0.0-rc35",
"php": "~5.5.0|~5.6.0|~7.0.0",
"phpunit/phpunit": "4.1.0",
"phpunit/phpunit-selenium": ">=1.2"
Expand Down
5 changes: 5 additions & 0 deletions dev/tests/functional/etc/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="events.xsd">
<preset name="base">
<observer class="Magento\Mtf\System\Observer\WebapiResponse">
<tag name="webapi_failed"/>
</observer>
</preset>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Mtf\System\Observer;

use Magento\Mtf\System\Event\Event;

/**
* Observer for obtaining response of web api handler.
*/
class WebapiResponse extends AbstractObserver
{
/**
* File name of response source.
*/
const FILE_NAME = 'webapi_response.log';

/**
* Collect response source artifact to storage.
*
* @param Event $event
* @return void
*/
public function process(Event $event)
{
$directory = $this->createDestinationDirectory('webapi-response');
$this->logger->log(json_encode($event->getSubjects()[0]), $directory . '/' . $event->getIdentifier() . '.json');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest">
<variation name="OnePageCheckoutTestVariation17" summary="Check Out as a Guest with Authorize.Net and Offline Shipping method" ticketId="MAGETWO-12832">
<variation name="OnePageCheckoutAuthorizenetTestVariation1" summary="Check Out as a Guest with Authorize.Net and Offline Shipping method" ticketId="MAGETWO-12832">
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
<data name="customer/dataset" xsi:type="string">default</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Additional extends Block
*
* @var string
*/
protected $flushButton = './/div/button[normalize-space(.)= "%s"]';
protected $flushButton = './/button[normalize-space(.)= "%s"]';

/**
* Flush cache in 'Additional Cache Management'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<page name="AdminCache" area="Adminhtml" mca="admin/cache/" module="Magento_Backend">
<block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/>
<block name="actionsBlock" class="Magento\Backend\Test\Block\Cache" locator="div.page-actions" strategy="css selector"/>
<block name="additionalBlock" class="Magento\Backend\Test\Block\Cache\Additional" locator="div.fieldset.additional-cache-management" strategy="css selector"/>
<block name="additionalBlock" class="Magento\Backend\Test\Block\Cache\Additional" locator="div.additional-cache-management" strategy="css selector"/>
</page>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,23 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
<repository class="Magento\Bundle\Test\Repository\BundleProduct">
<dataset name="BundleDynamic_sku_1073507449">
<field name="sku" xsi:type="string">BundleDynamic_sku_10735074493</field>
<field name="name" xsi:type="string">BundleDynamic 1073507449</field>
<dataset name="default">
<field name="name" xsi:type="string">Bundle dynamic product %isolation%</field>
<field name="url_key" xsi:type="string">bundle-dynamic-product-%isolation%</field>
<field name="sku" xsi:type="string">sku_bundle_dynamic_product_%isolation%</field>
<field name="sku_type" xsi:type="string">Dynamic</field>
<field name="price_type" xsi:type="string">Dynamic</field>
<field name="price" xsi:type="array">
<item name="price_from" xsi:type="string">1</item>
<item name="price_to" xsi:type="string">2</item>
</field>
<field name="short_description" xsi:type="string" />
<field name="description" xsi:type="string"/>
<field name="tax_class_id" xsi:type="array">
<item name="dataset" xsi:type="string">taxable_goods</item>
<item name="dataset" xsi:type="string">bundle_dynamic_with_category</item>
</field>
<field name="sku_type" xsi:type="string">0</field>
<field name="price_type" xsi:type="string">0</field>
<field name="weight_type" xsi:type="string">0</field>
<field name="status" xsi:type="string">Product online</field>
<field name="shipment_type" xsi:type="string">1</field>
<field name="url_key" xsi:type="string">bundle-dynamic-product-%isolation%</field>
<field name="mtf_dataset_name" xsi:type="string">BundleDynamic_sku_1073507449</field>
<field name="website_ids" xsi:type="array">
<item name="0" xsi:type="string">Main Website</item>
</field>
</dataset>

<dataset name="BundleDynamic_sku_215249172">
<field name="sku" xsi:type="string">BundleDynamic_sku_215249172</field>
<field name="name" xsi:type="string">BundleDynamic 215249172</field>
<field name="price" xsi:type="array">
<item name="price_from" xsi:type="string">3</item>
<item name="price_to" xsi:type="string">4</item>
</field>
<field name="short_description" xsi:type="string" />
<field name="description" xsi:type="string" />
<field name="tax_class_id" xsi:type="array">
<item name="dataset" xsi:type="string">taxable_goods</item>
<field name="bundle_selections" xsi:type="array">
<item name="dataset" xsi:type="string">default_dynamic</item>
</field>
<field name="sku_type" xsi:type="string">0</field>
<field name="weight_type" xsi:type="string">0</field>
<field name="price_type" xsi:type="string">0</field>
<field name="shipment_type" xsi:type="string">1</field>
<field name="url_key" xsi:type="string">bundle-dynamic-product-%isolation%</field>
<field name="mtf_dataset_name" xsi:type="string">BundleDynamic_sku_215249172</field>
<field name="website_ids" xsi:type="array">
<item name="0" xsi:type="string">Main Website</item>
<field name="checkout_data" xsi:type="array">
<item name="dataset" xsi:type="string">bundle_default</item>
</field>
</dataset>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © 2015 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/etc/variations.xsd">
<testCase name="Magento\Catalog\Test\TestCase\Product\DeleteProductEntityTest">
<variation name="DeleteProductEntityTestVariation4">
<data name="products" xsi:type="string">bundleProduct::bundle_dynamic_product</data>
<data name="isRequired" xsi:type="string">Yes</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSuccessDeleteMessage" />
<constraint name="Magento\Catalog\Test\Constraint\AssertProductNotInGrid" />
<constraint name="Magento\Catalog\Test\Constraint\AssertProductIsNotDisplayingOnFrontend" />
</variation>
<variation name="DeleteProductEntityTestVariation5">
<data name="products" xsi:type="string">bundleProduct::bundle_fixed_product</data>
<data name="isRequired" xsi:type="string">No</data>
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSuccessDeleteMessage" />
<constraint name="Magento\Catalog\Test\Constraint\AssertProductNotInGrid" />
<constraint name="Magento\Catalog\Test\Constraint\AssertProductIsNotDisplayingOnFrontend" />
</variation>
</testCase>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright © 2015 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/etc/variations.xsd">
<testCase name="Magento\Checkout\Test\TestCase\DeleteProductFromMiniShoppingCartTest" summary="Delete Bundle Product from Mini Shopping Cart" ticketId="MAGETWO-29104">
<variation name="DeleteBundleProductFromMiniShoppingCartTestVariation">
<data name="products" xsi:type="string">bundleProduct::default</data>
<data name="deletedProductIndex" xsi:type="string">0</data>
<constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" />
</variation>
</testCase>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Price extends \Magento\Catalog\Test\Block\AbstractPriceBlock
'selector' => '.special-price .price',
],
'old_price' => [
'selector' => '.old-price .price-wrapper',
'selector' => '.old-price .price-wrapper ',
],
'price_from' => [
'selector' => '.price-from .price',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ class View extends AbstractConfigureBlock
*/
protected $successMessage = '[data-ui-id$=message-success]';

/**
* Locator for page with ajax loading state.
*
* @var string
*/
protected $ajaxLoading = 'body.ajax-loading';

/**
* Get block price.
*
Expand Down Expand Up @@ -393,4 +400,14 @@ public function selectTab($name)
{
$this->_rootElement->find(sprintf($this->tabSelector, $name), Locator::SELECTOR_XPATH)->click();
}

/**
* Wait loading block.
*
* @return void
*/
public function waitLoader()
{
$this->waitForElementNotVisible($this->ajaxLoading);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,57 @@

namespace Magento\Catalog\Test\Constraint;

use Magento\Mtf\Fixture\InjectableFixture;
use Magento\Mtf\Constraint\AbstractConstraint;
use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;

/**
* Class AssertAttributeOptionsOnProductForm
* Assert all product attribute options on product creation form.
*/
class AssertAttributeOptionsOnProductForm extends AbstractConstraint
{
/**
* Assert all product attribute options on product creation form.
*
* @param InjectableFixture $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductAttribute $attribute
* @param CatalogProductEdit $productEdit
* @return void
*/
public function processAssert()
{
//
public function processAssert(
InjectableFixture $product,
CatalogProductIndex $productGrid,
CatalogProductAttribute $attribute,
CatalogProductEdit $productEdit
) {
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);

$attributeOptions = $attribute->getOptions();
$options[] = $attribute->getFrontendLabel();
foreach ($attributeOptions as $option) {
$options[] = $option['admin'];
}
$productAttributeOptions = $productEdit->getProductForm()->getAttributeElement($attribute)->getText();
$productOptions = explode("\n", $productAttributeOptions);
$diff = array_diff($options, $productOptions);

\PHPUnit_Framework_Assert::assertTrue(
empty($diff),
"Products attribute options are absent on product form: " . implode(', ', $diff)
);
}

/**
* Returns a string representation of the object.
*
* @return string
*/
public function toString()
{
//
return 'All product attribute options are visible on product creation form.';
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<field name="is_comparable" is_required="" group="frontend-properties" />
<field name="is_visible_on_front" is_required="" group="frontend-properties" />
<field name="is_html_allowed_on_front" is_required="" group="frontend-properties" />
<field name="is_used_for_price_rules" is_required="" group="frontend-properties" />
<field name="is_used_for_promo_rules" is_required="" group="frontend-properties" />
<field name="is_filterable_in_search" is_required="" group="frontend-properties" />
<field name="used_in_product_listing" is_required="" group="frontend-properties" />
<field name="used_for_sort_by" is_required="" group="frontend-properties" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ class Curl extends AbstractCurl implements CatalogProductAttributeInterface
'No' => 0,
'Filterable (with results)' => 1,
'Filterable (no results)' => 2
]
],
'is_used_for_promo_rules' => [
'No' => 0,
'Yes' => 1,
],
];

/**
Expand All @@ -59,10 +63,10 @@ public function persist(FixtureInterface $fixture = null)

if (isset($data['options'])) {
foreach ($data['options'] as $key => $values) {
$index = 'option_' . $key;
if ($values['is_default'] == 'Yes') {
$data['default'][] = $values['view'];
$data['default'][] = $index;
}
$index = 'option_' . $key;
$data['option']['value'][$index] = [$values['admin'], $values['view']];
$data['option']['order'][$index] = $key;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ protected function filter(array $data)
*/
protected function createProduct(array $data, array $config)
{
$config['create_url_params']['set'] = isset($data['product']['attribute_set_id'])
? $data['product']['attribute_set_id']
: $config['create_url_params']['set'];
$url = $this->getUrl($config);
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->addOption(CURLOPT_HEADER, 1);
Expand Down
Loading

0 comments on commit 12955b1

Please sign in to comment.