File tree Expand file tree Collapse file tree 8 files changed +132
-2
lines changed
dev/tests/functional/tests/app/Magento/Catalog/Test Expand file tree Collapse file tree 8 files changed +132
-2
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2016 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Catalog \Test \Block \Adminhtml \Product \Edit \Section ;
8
+
9
+ use Magento \Mtf \Client \Element \SimpleElement ;
10
+ use Magento \Mtf \Client \Locator ;
11
+ use Magento \Ui \Test \Block \Adminhtml \Section ;
12
+
13
+ class BlockGallery extends Section
14
+ {
15
+ /**
16
+ * Upload product images
17
+ *
18
+ * @param array $data
19
+ * @param SimpleElement|null $element
20
+ * @return $this
21
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
22
+ */
23
+ public function setFieldsData (array $ data , SimpleElement $ element = null )
24
+ {
25
+ if (isset ($ data ['image ' ])) {
26
+ foreach ($ data ['image ' ]['value ' ] as $ key => $ imageData ) {
27
+ $ uploadElement = $ this ->_rootElement ->find ('[name="image"] ' , Locator::SELECTOR_CSS , 'upload ' );
28
+ $ uploadElement ->setValue ($ imageData ['file ' ]);
29
+ $ this ->waitForElementNotVisible ('.image.image-placeholder .file-row ' );
30
+ }
31
+ }
32
+ return $ this ;
33
+ }
34
+ }
Original file line number Diff line number Diff line change 223
223
<selector >[data-index="related"]</selector >
224
224
<strategy >css selector</strategy >
225
225
</related >
226
+ <block_gallery >
227
+ <class >\Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\BlockGallery</class >
228
+ <selector >[data-index="block_gallery"]</selector >
229
+ <strategy >css selector</strategy >
230
+ </block_gallery >
226
231
</sections >
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2016 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Catalog \Test \Constraint ;
8
+
9
+ /**
10
+ * Class AssertProductCanUpdate
11
+ */
12
+ class AssertProductCanUpdate extends \Magento \Mtf \Constraint \AbstractConstraint
13
+ {
14
+ /**
15
+ * Assert that product with image can update without errors.
16
+ *
17
+ * @param \Magento\Mtf\Fixture\FixtureInterface $product
18
+ * @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit $catalogProductEdit
19
+ * @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex $catalogProductIndex
20
+ */
21
+ public function processAssert (
22
+ \Magento \Mtf \Fixture \FixtureInterface $ product ,
23
+ \Magento \Catalog \Test \Page \Adminhtml \CatalogProductEdit $ catalogProductEdit ,
24
+ \Magento \Catalog \Test \Page \Adminhtml \CatalogProductIndex $ catalogProductIndex
25
+ ) {
26
+ $ filter = ['sku ' => $ product ->getSku ()];
27
+ $ catalogProductIndex ->open ()->getProductGrid ()->searchAndOpen ($ filter );
28
+ $ catalogProductEdit ->getFormPageActions ()->save ();
29
+
30
+ \PHPUnit_Framework_Assert::assertNotEmpty (
31
+ $ catalogProductEdit ->getMessagesBlock ()->getSuccessMessage ()
32
+ );
33
+ }
34
+
35
+ /**
36
+ * Returns a string representation of the object
37
+ *
38
+ * @return string
39
+ */
40
+ public function toString ()
41
+ {
42
+ return 'Product with image was updated without errors. ' ;
43
+ }
44
+ }
Original file line number Diff line number Diff line change 36
36
<field name =" gallery" is_required =" 0" />
37
37
<field name =" gift_message_available" is_required =" 0" />
38
38
<field name =" has_options" is_required =" 0" />
39
- <field name =" image" is_required =" 0" />
40
- <field name =" image_label" is_required =" 0" />
39
+ <field name =" image" is_required =" 0" group = " block_gallery " source = " Magento\Catalog\Test\Fixture\Product\Image " />
40
+ <field name =" image_label" group = " block_gallery " is_required =" 0" />
41
41
<field name =" manufacturer" is_required =" 0" />
42
42
<field name =" media_gallery" is_required =" 0" />
43
43
<field name =" meta_description" is_required =" 0" group =" search-engine-optimization" />
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2016 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Catalog \Test \Fixture \Product ;
8
+
9
+ use Magento \Mtf \Fixture \DataSource ;
10
+ use Magento \Mtf \Fixture \FixtureFactory ;
11
+
12
+ /**
13
+ * Image entity data source.
14
+ */
15
+ class Image extends DataSource
16
+ {
17
+ /**
18
+ * Image constructor.
19
+ * @param FixtureFactory $fixtureFactory
20
+ * @param array $params
21
+ * @param array $data
22
+ */
23
+ public function __construct (FixtureFactory $ fixtureFactory , array $ params , $ data = [])
24
+ {
25
+ foreach ($ data as $ key => &$ imageData ) {
26
+ if (isset ($ imageData ['file ' ]) && file_exists (MTF_TESTS_PATH . $ imageData ['file ' ])) {
27
+ $ imageData ['file ' ] = MTF_TESTS_PATH . $ imageData ['file ' ];
28
+ } else {
29
+ unset($ data [$ key ]);
30
+ }
31
+ }
32
+ $ this ->data = $ data ;
33
+ }
34
+ }
Original file line number Diff line number Diff line change 500
500
<constraint name =" Magento\Catalog\Test\Constraint\AssertProductPage" />
501
501
<constraint name =" Magento\Catalog\Test\Constraint\AssertProductInCart" />
502
502
</variation >
503
+ <variation name =" CreateSimpleProductEntityWithImageTestVariation1" >
504
+ <data name =" description" xsi : type =" string" >Create product with image</data >
505
+ <data name =" product/data/image/0/file" xsi : type =" string" >Magento/Catalog/Test/_files/test1.png</data >
506
+ <data name =" product/data/image/1/file" xsi : type =" string" >Magento/Catalog/Test/_files/test2.png</data >
507
+ <data name =" product/data/url_key" xsi : type =" string" >simple-product-%isolation%</data >
508
+ <data name =" product/data/name" xsi : type =" string" >Simple Product %isolation%</data >
509
+ <data name =" product/data/sku" xsi : type =" string" >simple_sku_%isolation%</data >
510
+ <data name =" product/data/price/value" xsi : type =" string" >10</data >
511
+ <data name =" product/data/weight" xsi : type =" string" >50</data >
512
+ <data name =" product/data/quantity_and_stock_status/qty" xsi : type =" string" >100</data >
513
+ <constraint name =" Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
514
+ <constraint name =" Magento\Catalog\Test\Constraint\AssertProductCanUpdate" />
515
+ </variation >
503
516
</testCase >
504
517
</config >
You can’t perform that action at this time.
0 commit comments