-
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.
MAGETWO-57995: [GITHUB] Simple product videos display the thumbnail i…
…mage rather than the embedded video player. #6360
- Loading branch information
olysenko
committed
May 23, 2017
1 parent
8a22ae9
commit d8ad9f7
Showing
9 changed files
with
353 additions
and
29 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
58 changes: 29 additions & 29 deletions
58
...ts/functional/tests/app/Magento/ProductVideo/Test/Block/Adminhtml/Product/ProductForm.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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<sections> | ||
<images-and-videos> | ||
<class>\Magento\ProductVideo\Test\Block\Adminhtml\Product\Edit\Tab\ImagesAndVideos</class> | ||
<selector>[data-index="block_gallery"]</selector> | ||
<strategy>css selector</strategy> | ||
<fields> | ||
<position /> | ||
<media_type /> | ||
<video_provider /> | ||
<file /> | ||
<value_id /> | ||
<label /> | ||
<disabled /> | ||
<removed /> | ||
<video_url /> | ||
<video_title /> | ||
<video_description /> | ||
<video_metadata /> | ||
<role /> | ||
</fields> | ||
</images-and-videos> | ||
</sections> | ||
<?xml version="1.0" ?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<sections> | ||
<images-and-videos> | ||
<class>\Magento\ProductVideo\Test\Block\Adminhtml\Product\Edit\Tab\ImagesAndVideos</class> | ||
<selector>[data-index="gallery"]</selector> | ||
<strategy>css selector</strategy> | ||
<fields> | ||
<position /> | ||
<media_type /> | ||
<video_provider /> | ||
<file /> | ||
<value_id /> | ||
<label /> | ||
<disabled /> | ||
<removed /> | ||
<video_url /> | ||
<video_title /> | ||
<video_description /> | ||
<video_metadata /> | ||
<role /> | ||
</fields> | ||
</images-and-videos> | ||
</sections> |
69 changes: 69 additions & 0 deletions
69
...nal/tests/app/Magento/ProductVideo/Test/Constraint/AssertVideoConfigurableProductView.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,69 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\ProductVideo\Test\Constraint; | ||
|
||
use Magento\Mtf\Client\BrowserInterface; | ||
use Magento\Mtf\Fixture\InjectableFixture; | ||
use Magento\Mtf\Constraint\AbstractConstraint; | ||
use Magento\Catalog\Test\Page\Product\CatalogProductView; | ||
|
||
/** | ||
* Assert that video is displayed on product page. | ||
*/ | ||
class AssertVideoConfigurableProductView extends AbstractConstraint | ||
{ | ||
/** | ||
* Assert that video is displayed on product page on Store front. | ||
* | ||
* @param BrowserInterface $browser | ||
* @param CatalogProductView $catalogProductView | ||
* @param InjectableFixture $product | ||
* @param string $youtubeDataCode | ||
* @param string $vimeoDataCode | ||
* @param string $variation | ||
*/ | ||
public function processAssert( | ||
BrowserInterface $browser, | ||
CatalogProductView $catalogProductView, | ||
InjectableFixture $product, | ||
$youtubeDataCode, | ||
$vimeoDataCode, | ||
$variation | ||
) { | ||
//open product page | ||
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); | ||
// assert video and video data of configurable product is presented on page | ||
\PHPUnit_Framework_Assert::assertTrue( | ||
$catalogProductView->getViewBlock()->isVideoVisible(), | ||
'Product video is not displayed on product view when it should.' | ||
); | ||
\PHPUnit_Framework_Assert::assertTrue( | ||
$catalogProductView->getViewBlock()->checkVideoDataPresence($youtubeDataCode), | ||
'Configurable product video data is not displayed on product view when it should.' | ||
); | ||
// select configurable product variation | ||
$catalogProductView->getConfigurableAttributesBlock()->selectConfigurableOption($product, $variation); | ||
// assert video and video data of simple product option is presented on page | ||
\PHPUnit_Framework_Assert::assertTrue( | ||
$catalogProductView->getViewBlock()->isVideoVisible(), | ||
'Configurable product variation video is not displayed on product view when it should.' | ||
); | ||
\PHPUnit_Framework_Assert::assertTrue( | ||
$catalogProductView->getViewBlock()->checkVideoDataPresence($vimeoDataCode), | ||
'Configurable product variation video data is not displayed on product view when it should.' | ||
); | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. | ||
* | ||
* @return string | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Configurable product video and it variation video are displayed on product view.'; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
dev/tests/functional/tests/app/Magento/ProductVideo/Test/Fixture/ConfigurableProduct.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,12 @@ | ||
<?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/fixture.xsd"> | ||
<fixture name="configurableProduct"> | ||
<field name="media_gallery" is_required="0" group="images-and-videos" source="Magento\ProductVideo\Test\Fixture\Product\MediaGallery"/> | ||
</fixture> | ||
</config> |
125 changes: 125 additions & 0 deletions
125
.../functional/tests/app/Magento/ProductVideo/Test/TestCase/ConfigurableProductVideoTest.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,125 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\ProductVideo\Test\TestCase; | ||
|
||
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; | ||
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew; | ||
use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; | ||
use Magento\Config\Test\TestStep\SetupConfigurationStep; | ||
use Magento\ConfigurableProduct\Test\Fixture\ConfigurableProduct; | ||
use Magento\Catalog\Test\Fixture\CatalogProductSimple; | ||
use Magento\Mtf\TestCase\Injectable; | ||
use Magento\Mtf\TestStep\TestStepFactory; | ||
use Magento\Catalog\Test\Constraint\AssertProductSaveMessage; | ||
|
||
/** | ||
* Steps: | ||
* 1. Go to backend. | ||
* 2. Create configurable product with several simple product variations. | ||
* 3. Add a video to a configurable product | ||
* 4. Add video to simple products of that configurable product. | ||
* 5. View that configurable product page on the frontend. | ||
* 6. Select the product configuration to display the simple product for which the video was added. | ||
* 7. Perform asserts. | ||
* | ||
* @group ProductVideo | ||
* @ZephyrId MAGETWO-69381 | ||
*/ | ||
class ConfigurableProductVideoTest extends Injectable | ||
{ | ||
/* tags */ | ||
const TEST_TYPE = 'acceptance_test, extended_acceptance_test'; | ||
const MVP = 'yes'; | ||
/* end tags */ | ||
|
||
/** | ||
* Product page with a grid. | ||
* | ||
* @var CatalogProductIndex | ||
*/ | ||
private $productIndex; | ||
|
||
/** | ||
* Page to create a product. | ||
* | ||
* @var CatalogProductNew | ||
*/ | ||
private $productNew; | ||
|
||
/** | ||
* Product edit page. | ||
* | ||
* @var CatalogProductEdit | ||
*/ | ||
private $productEdit; | ||
|
||
/** | ||
* Factory for creation SetupConfigurationStep. | ||
* | ||
* @var TestStepFactory | ||
*/ | ||
private $testStepFactory; | ||
|
||
/** | ||
* Configuration data holder. | ||
* | ||
* @var string | ||
*/ | ||
private $configData = null; | ||
|
||
/** | ||
* @param CatalogProductIndex $productIndex | ||
* @param CatalogProductNew $productNew | ||
* @param CatalogProductEdit $productEdit | ||
* @param TestStepFactory $testStepFactory | ||
*/ | ||
public function __inject( | ||
CatalogProductIndex $productIndex, | ||
CatalogProductNew $productNew, | ||
CatalogProductEdit $productEdit, | ||
TestStepFactory $testStepFactory | ||
) { | ||
$this->productIndex = $productIndex; | ||
$this->productNew = $productNew; | ||
$this->productEdit = $productEdit; | ||
$this->testStepFactory = $testStepFactory; | ||
} | ||
|
||
/** | ||
* @param CatalogProductSimple $simpleProductVideo | ||
* @param ConfigurableProduct $product | ||
* @param AssertProductSaveMessage $assertCreateProducts | ||
* @param string $variation | ||
* @param null $configData | ||
*/ | ||
public function test( | ||
CatalogProductSimple $simpleProductVideo, | ||
ConfigurableProduct $product, | ||
AssertProductSaveMessage $assertCreateProducts, | ||
$variation, | ||
$configData = null | ||
) { | ||
//Preconditions | ||
$this->configData = $configData; | ||
$this->testStepFactory->create( | ||
SetupConfigurationStep::class, | ||
['configData' => $this->configData, 'flushCache' => true] | ||
)->run(); | ||
|
||
// Steps | ||
$this->productIndex->open(); | ||
$this->productIndex->getGridPageActionBlock()->addProduct('configurable'); | ||
$this->productNew->getProductForm()->fill($product); | ||
$this->productNew->getFormPageActions()->save($product); | ||
$assertCreateProducts->processAssert($this->productEdit); | ||
|
||
$sku = $product->getConfigurableAttributesData()['matrix'][$variation]['sku']; | ||
$this->productIndex->open(); | ||
$this->productIndex->getProductGrid()->searchAndOpen(['sku' => $sku]); | ||
$this->productEdit->getProductForm()->fill($simpleProductVideo); | ||
$this->productEdit->getFormPageActions()->save(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
.../functional/tests/app/Magento/ProductVideo/Test/TestCase/ConfigurableProductVideoTest.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,20 @@ | ||
<?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\ProductVideo\Test\TestCase\ConfigurableProductVideoTest" summary="Video displaying for simple variation of configurable on product page" ticketId="MAGETWO-69381"> | ||
<variation name="ConfigurableProductVideoTestVariation1"> | ||
<data name="product/dataset" xsi:type="string">configurable_with_video</data> | ||
<data name="simpleProductVideo/data/media_gallery/images/0/video_url" xsi:type="string">https://vimeo.com/16342611</data> | ||
<data name="variation" xsi:type="string">attribute_key_0:option_key_0 attribute_key_1:option_key_0</data> | ||
<data name="configData" xsi:type="string">youtube_api_key,play_if_base</data> | ||
<data name="vimeoDataCode" xsi:type="string">16342611</data> | ||
<data name="youtubeDataCode" xsi:type="string">bpOSxM0rNPM</data> | ||
<constraint name="Magento\ProductVideo\Test\Constraint\AssertVideoConfigurableProductView" /> | ||
</variation> | ||
</testCase> | ||
</config> |
Oops, something went wrong.