-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #988 from magento-epam/PR-6
[Epam] Extend functional test sprint 6 - MTO-128: [Test] Export Products - MTO-105: [Test] Import Products - MTO-148: [Constraint] Messages in Sales Reports Pages display correct date/time
- Loading branch information
Showing
49 changed files
with
2,177 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...nal/tests/app/Magento/BundleImportExport/Test/Constraint/AssertImportedBundleProducts.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\BundleImportExport\Test\Constraint; | ||
|
||
use Magento\CatalogImportExport\Test\Constraint\AssertImportedProducts; | ||
use Magento\Mtf\Fixture\FixtureInterface; | ||
|
||
/** | ||
* Assert that products data from CSV import file and data from product edit page are correct and match. | ||
*/ | ||
class AssertImportedBundleProducts extends AssertImportedProducts | ||
{ | ||
/** | ||
* Product type. | ||
* | ||
* @var string | ||
*/ | ||
protected $productType = 'bundle'; | ||
|
||
/** | ||
* Needed bundle product data. | ||
* | ||
* @var array | ||
*/ | ||
protected $neededKeys = [ | ||
'sku', | ||
'name', | ||
'associated_skus', | ||
'bundle_values', | ||
'url_key', | ||
]; | ||
|
||
/** | ||
* Prepare bundle product data. | ||
* | ||
* @param FixtureInterface $product | ||
* @return array | ||
*/ | ||
protected function getDisplayedProductData(FixtureInterface $product) | ||
{ | ||
$productData = $this->getDisplayedOnProductPageData($product); | ||
$bundleSelection = $productData['bundle_selections'][0]; | ||
$assignedProduct = $bundleSelection['assigned_products'][0]; | ||
|
||
$form = $this->catalogProductEdit->getProductForm(); | ||
$form->openSection('bundle'); | ||
$attributeSku = $form->getSection('bundle')->getAttributeSku(); | ||
|
||
$productData['associated_skus'] = $attributeSku; | ||
$productType = ($productData['price_type'] === 'Yes') | ||
? 'dynamic' | ||
: 'fixed'; | ||
$productData['bundle_values'] = 'name=' . $bundleSelection['title'] . ',type=select,required=1,sku=' | ||
. $attributeSku . ',price=0.0000,default=0,default_qty=' | ||
. $assignedProduct['selection_qty'] .'.0000,price_type=' . $productType; | ||
|
||
return $this->getResultProductsData($productData); | ||
} | ||
|
||
/** | ||
* Return string representation of object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Products data from CSV import file and data from product edit page are correct and match.'; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
dev/tests/functional/tests/app/Magento/BundleImportExport/Test/Fixture/Import/File.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\BundleImportExport\Test\Fixture\Import; | ||
|
||
use Magento\Mtf\Fixture\FixtureInterface; | ||
use Magento\Mtf\Fixture\FixtureFactory; | ||
|
||
/** | ||
* Bundle product class file. | ||
*/ | ||
class File | ||
{ | ||
/** | ||
* Prepare bundle product data. | ||
* | ||
* @param FixtureInterface $product | ||
* @param FixtureFactory $fixtureFactory | ||
* @return array | ||
*/ | ||
public function getData(FixtureInterface $product, FixtureFactory $fixtureFactory) | ||
{ | ||
$newProduct = $fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'default']); | ||
$newProduct->persist(); | ||
$newProductData = $newProduct->getData(); | ||
$productData = $product->getData(); | ||
|
||
$productData['bundle_attribute_sku'] = $newProductData['sku']; | ||
$productData['bundle_attribute_name'] = $newProductData['name']; | ||
$productData['bundle_attribute_url_key'] = $newProductData['url_key']; | ||
|
||
return $productData; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ests/functional/tests/app/Magento/BundleImportExport/Test/TestCase/ExportProductsTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. 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\CatalogImportExport\Test\TestCase\ExportProductsTest" summary="Export products"> | ||
<variation name="ExportProductsTestVariation4" summary="Export bundle products" ticketId="MAGETWO-30602"> | ||
<data name="exportData" xsi:type="string">default</data> | ||
<data name="products/0" xsi:type="array"> | ||
<item name="fixture" xsi:type="string">bundleProduct</item> | ||
<item name="dataset" xsi:type="string">bundle_dynamic_product</item> | ||
</data> | ||
<data name="products/1" xsi:type="array"> | ||
<item name="fixture" xsi:type="string">bundleProduct</item> | ||
<item name="dataset" xsi:type="string">bundle_fixed_product</item> | ||
</data> | ||
<data name="products/2" xsi:type="array"> | ||
<item name="fixture" xsi:type="string">bundleProduct</item> | ||
<item name="dataset" xsi:type="string">fixed_with_required_options_and_qty_and_textarea_attribute</item> | ||
</data> | ||
<data name="exportedFields" xsi:type="array"> | ||
<item name="0" xsi:type="string">sku</item> | ||
<item name="1" xsi:type="string">name</item> | ||
<item name="2" xsi:type="string">weight</item> | ||
<item name="3" xsi:type="string">visibility</item> | ||
<item name="4" xsi:type="string">price</item> | ||
<item name="5" xsi:type="string">url_key</item> | ||
</data> | ||
</variation> | ||
</testCase> | ||
</config> |
15 changes: 15 additions & 0 deletions
15
...ests/functional/tests/app/Magento/BundleImportExport/Test/TestCase/ImportProductsTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. 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\CatalogImportExport\Test\TestCase\ImportProductsTest" summary="Import Bundle Product with Replace Behavior"> | ||
<variation name="ImportProductVariation3" ticketId="MAGETWO-47720" summary="Import Bundle Product with Replace Behavior"> | ||
<data name="import/data/import_file/entities/3" xsi:type="string">bundleProduct::default_with_one_simple_product</data> | ||
<constraint name="Magento\BundleImportExport\Test\Constraint\AssertImportedBundleProducts" /> | ||
</variation> | ||
</testCase> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.