Skip to content

Commit b6e9491

Browse files
authored
Merge pull request magento#4931 from magento-arcticfoxes/MC-21994
[arcticfoxes] MC-21994: Magento\Catalog\Controller\Adminhtml\Product\Gallery\UploadTest::testUploadActionWithErrors
2 parents cc67aa0 + 69ee87c commit b6e9491

File tree

6 files changed

+17
-22
lines changed

6 files changed

+17
-22
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php

-15
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ public function execute()
8989
['fileId' => 'image']
9090
);
9191
$uploader->setAllowedExtensions($this->getAllowedExtensions());
92-
93-
if (!$uploader->checkMimeType($this->getAllowedMimeTypes())) {
94-
throw new LocalizedException(__('Disallowed File Type.'));
95-
}
96-
9792
$imageAdapter = $this->adapterFactory->create();
9893
$uploader->addValidateCallback('catalog_product_image', $imageAdapter, 'validateUploadFile');
9994
$uploader->setAllowRenameFiles(true);
@@ -133,14 +128,4 @@ private function getAllowedExtensions()
133128
{
134129
return array_keys($this->allowedMimeTypes);
135130
}
136-
137-
/**
138-
* Get the set of allowed mime types.
139-
*
140-
* @return array
141-
*/
142-
private function getAllowedMimeTypes()
143-
{
144-
return array_values($this->allowedMimeTypes);
145-
}
146131
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryLinkActionGroup.xml

+11
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,15 @@
1818
<click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/>
1919
<waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/>
2020
</actionGroup>
21+
22+
<!-- ActionGroup click on Advanced Inventory Button in product form;
23+
You must already be on the product form page -->
24+
<actionGroup name="AdminClickOnAdvancedInventoryButtonActionGroup">
25+
<annotations>
26+
<description>Clicks on the 'Advanced Inventory' link on the Admin Product creation/edit page.</description>
27+
</annotations>
28+
29+
<click selector="{{AdminProductFormSection.advancedInventoryButton}}" stepKey="clickOnAdvancedInventoryLink"/>
30+
<waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/>
31+
</actionGroup>
2132
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']" timeout="30"/>
3939
<element name="unselectCategories" type="button" selector="//span[@class='admin__action-multiselect-crumb']/span[contains(.,'{{category}}')]/../button[@data-action='remove-selected-item']" parameterized="true" timeout="30"/>
4040
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
41-
<element name="advancedInventoryLink" type="button" selector="//button[contains(@data-index, 'advanced_inventory_button')]" timeout="30"/>
41+
<element name="advancedInventoryLink" type="button" selector="button[data-index='advanced_inventory_button'].action-additional" timeout="30"/>
4242
<element name="productStockStatus" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]']" timeout="30"/>
4343
<element name="productStockStatusDisabled" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]'][disabled=true]"/>
4444
<element name="stockStatus" type="select" selector="[data-index='product-details'] select[name='product[quantity_and_stock_status][is_in_stock]']"/>

app/code/Magento/CatalogInventory/Test/Mftf/Section/AdminProductFormSection.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductFormSection">
12-
<element name="advancedInventoryLink" type="button" selector="button[data-index='advanced_inventory_button']" timeout="30"/>
12+
<element name="advancedInventoryLink" type="button" selector="button[data-index='advanced_inventory_button'].action-additional" timeout="30"/>
13+
<element name="advancedInventoryButton" type="button" selector="button[data-index='advanced_inventory_button'].action-basic" timeout="30"/>
1314
</section>
1415
</sections>

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerCreateNewOrderSection.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<element name="updateChangesBtn" type="button" selector=".order-sidebar .actions .action-default.scalable" timeout="30"/>
1313
<element name="productName" type="text" selector="#order-items_grid span[id*=order_item]"/>
1414
<element name="productPrice" type="text" selector=".even td[class=col-price] span[class=price]"/>
15-
<element name="productQty" type="input" selector="td[class=col-qty] input"/>
15+
<element name="productQty" type="input" selector="td[class=col-qty] .input-text.item-qty.admin__control-text"/>
1616
<element name="gridCell" type="text" selector="//div[contains(@id, 'order-items_grid')]//tbody[{{row}}]//td[count(//table[contains(@class, 'order-tables')]//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true" timeout="30"/>
1717
</section>
1818
</sections>

dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Gallery/UploadTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ public function uploadActionDataProvider(): array
154154
*/
155155
public function testUploadActionWithErrors(array $file, array $expectation): void
156156
{
157-
$this->markTestSkipped('MC-21994');
158-
159157
if (!empty($file['create_file'])) {
160158
$this->createFileInSysTmpDir($file['name']);
161159
} elseif (!empty($file['copy_file'])) {
@@ -165,8 +163,8 @@ public function testUploadActionWithErrors(array $file, array $expectation): voi
165163
$this->getRequest()->setMethod($this->httpMethod);
166164
$this->dispatch($this->uri);
167165
$jsonBody = $this->serializer->unserialize($this->getResponse()->getBody());
168-
$this->assertEquals($jsonBody['error'], $expectation['message']);
169-
$this->assertEquals($jsonBody['errorcode'], $expectation['errorcode']);
166+
$this->assertEquals($expectation['message'], $jsonBody['error']);
167+
$this->assertEquals($expectation['errorcode'], $jsonBody['errorcode']);
170168

171169
if (!empty($expectation['tmp_media_path'])) {
172170
$this->assertFileNotExists(

0 commit comments

Comments
 (0)