Skip to content

Commit 4431c24

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into pr-2.3.4
2 parents 027fc97 + b3bd86b commit 4431c24

File tree

61 files changed

+1225
-205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1225
-205
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@
7676
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton"/>
7777
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/>
7878

79+
<!-- Perform reindex and flush cache -->
80+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
81+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
82+
7983
<!--Go to category page-->
8084
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/>
8185
<waitForPageLoad stepKey="waitForHomePageToload"/>

app/code/Magento/CatalogImportExport/Model/Import/Uploader.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ class Uploader extends \Magento\MediaStorage\Model\File\Uploader
3636
*/
3737
protected $_tmpDir = '';
3838

39-
/**
40-
* Download directory for url-based resources.
41-
*
42-
* @var string
43-
*/
44-
private $downloadDir;
45-
4639
/**
4740
* Destination directory.
4841
*
@@ -151,7 +144,6 @@ public function __construct(
151144
$this->_setUploadFile($filePath);
152145
}
153146
$this->random = $random ?: ObjectManager::getInstance()->get(\Magento\Framework\Math\Random::class);
154-
$this->downloadDir = DirectoryList::getDefaultConfig()[DirectoryList::TMP][DirectoryList::PATH];
155147
}
156148

157149
/**
@@ -187,8 +179,7 @@ public function move($fileName, $renameFileOff = false)
187179
$driver = ($matches[0] === $this->httpScheme) ? DriverPool::HTTP : DriverPool::HTTPS;
188180
$tmpFilePath = $this->downloadFileFromUrl($url, $driver);
189181
} else {
190-
$tmpDir = $this->getTmpDir() ? ($this->getTmpDir() . '/') : '';
191-
$tmpFilePath = $this->_directory->getRelativePath($tmpDir . $fileName);
182+
$tmpFilePath = $this->_directory->getRelativePath($this->getTempFilePath($fileName));
192183
}
193184

194185
$this->_setUploadFile($tmpFilePath);
@@ -225,8 +216,13 @@ private function downloadFileFromUrl($url, $driver)
225216
$tmpFileName = str_replace(".$fileExtension", '', $fileName);
226217
$tmpFileName .= '_' . $this->random->getRandomString(16);
227218
$tmpFileName .= $fileExtension ? ".$fileExtension" : '';
228-
$tmpFilePath = $this->_directory->getRelativePath($this->downloadDir . '/' . $tmpFileName);
219+
$tmpFilePath = $this->_directory->getRelativePath($this->getTempFilePath($tmpFileName));
229220

221+
if (!$this->_directory->isWritable($this->getTmpDir())) {
222+
throw new \Magento\Framework\Exception\LocalizedException(
223+
__('Import images directory must be writable in order to process remote images.')
224+
);
225+
}
230226
$this->_directory->writeFile(
231227
$tmpFilePath,
232228
$this->_readFactory->create($url, $driver)->readAll()
@@ -402,6 +398,19 @@ protected function _moveFile($tmpPath, $destPath)
402398
}
403399
}
404400

401+
/**
402+
* Append temp path to filename
403+
*
404+
* @param string $filename
405+
* @return string
406+
*/
407+
private function getTempFilePath(string $filename): string
408+
{
409+
return $this->getTmpDir()
410+
? rtrim($this->getTmpDir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $filename
411+
: $filename;
412+
}
413+
405414
/**
406415
* @inheritdoc
407416
*/

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/UploaderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public function testMoveFileUrl($fileUrl, $expectedHost, $expectedFileName, $che
128128
{
129129
$tmpDir = 'var/tmp';
130130
$destDir = 'var/dest/dir';
131+
$this->uploader->method('getTmpDir')->willReturn($tmpDir);
131132

132133
// Expected invocation to validate file extension
133134
$this->uploader->expects($this->exactly($checkAllowedExtension))->method('checkAllowedExtension')
@@ -159,9 +160,11 @@ public function testMoveFileUrl($fileUrl, $expectedHost, $expectedFileName, $che
159160
$this->directoryMock->expects($this->any())->method('writeFile')
160161
->will($this->returnValue($expectedFileName));
161162

162-
// Expected invocations to move the temp file to the destination directory
163-
$this->directoryMock->expects($this->once())->method('isWritable')
164-
->with($destDir)
163+
// Expected invocations save the downloaded file to temp file
164+
// and move the temp file to the destination directory
165+
$this->directoryMock->expects($this->exactly(2))
166+
->method('isWritable')
167+
->withConsecutive([$destDir], [$tmpDir])
165168
->willReturn(true);
166169
$this->directoryMock->expects($this->once())->method('getAbsolutePath')
167170
->with($destDir)
@@ -172,9 +175,6 @@ public function testMoveFileUrl($fileUrl, $expectedHost, $expectedFileName, $che
172175
->with($destDir . '/' . $expectedFileName)
173176
->willReturn(['name' => $expectedFileName, 'path' => 'absPath']);
174177

175-
// Do not use configured temp directory
176-
$this->uploader->expects($this->never())->method('getTmpDir');
177-
178178
$this->uploader->setDestDir($destDir);
179179
$result = $this->uploader->move($fileUrl);
180180

app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<argument name="productName" type="string"/>
6767
</arguments>
6868

69-
<moveMouseOver stepKey="hoverOverProduct" selector="{{StorefrontQuickSearchResultsSection.productByIndex('1')}}"/>
69+
<moveMouseOver stepKey="hoverOverProduct" selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}}"/>
7070
<click selector="{{StorefrontQuickSearchResultsSection.productByName(productName)}} {{StorefrontQuickSearchResultsSection.addToCartBtn}}" stepKey="addToCart"/>
7171
<waitForElementVisible selector="{{StorefrontQuickSearchResultsSection.messageSection}}" time="30" stepKey="waitForProductAdded"/>
7272
<see selector="{{StorefrontQuickSearchResultsSection.messageSection}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddedToCartMessage"/>

app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@
439439
<magentoCLI command="cache:flush" stepKey="flushCache"/>
440440
</before>
441441
<after>
442-
<deleteData stepKey="deleteProduct" createDataKey="createProduct"/>
442+
<deleteData stepKey="deleteGroupedProduct" createDataKey="createProduct"/>
443+
<deleteData stepKey="deleteSimpleProduct" createDataKey="simple1"/>
443444
</after>
444445
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPage"/>
445446
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront">
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertPagerTextIsNotVisibleActionGroup">
11+
<arguments>
12+
<argument name="text" type="string"/>
13+
</arguments>
14+
<waitForPageLoad stepKey="waitForCheckoutPageLoad"/>
15+
<dontSee userInput="{{text}}" selector="{{StorefrontCartToolbarSection.toolbarNumber}}" stepKey="VerifyMissingPagerText"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertToolbarTextIsVisibleInCartActionGroup">
11+
<arguments>
12+
<argument name="text" type="string"/>
13+
</arguments>
14+
<waitForPageLoad stepKey="waitForPageLoad"/>
15+
<see userInput="{{text}}" selector="{{StorefrontCartToolbarSection.toolbarNumber}}" stepKey="VerifyPageText"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontOpenCartPageActionGroup">
11+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="openCartPage" />
12+
<waitForPageLoad stepKey="waitForPageLoaded" />
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontRemoveCartItemActionGroup">
11+
<click selector="{{CheckoutCartProductSection.RemoveItem}}" stepKey="deleteProductFromCart"/>
12+
</actionGroup>
13+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Page/CheckoutCartPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
1111
<page name="CheckoutCartPage" url="/checkout/cart" module="Magento_Checkout" area="storefront">
12+
<section name="StorefrontCartToolbarSection"/>
1213
<section name="CheckoutCartProductSection"/>
1314
<section name="CheckoutCartSummarySection"/>
1415
<section name="CheckoutCartCrossSellSection"/>

0 commit comments

Comments
 (0)