Skip to content

Commit 5c3b5f3

Browse files
committed
B2B-1648: Implement Solution for Unblocking S3 MFTF Import Tests
- Adding helper functions for enabling import tests for S3 in MFTF - Unskipping & fixing S3 scheduled import MFTF test
1 parent 26cc7d3 commit 5c3b5f3

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

app/code/Magento/AwsS3/Test/Mftf/Helper/S3FileAssertions.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,35 @@ public function deleteFileIfExists($filePath): void
9292
}
9393
}
9494

95+
/**
96+
* Create directory in the S3 bucket
97+
*
98+
* @param string $path
99+
* @param int $permissions
100+
* @return void
101+
*
102+
* @throws \Magento\Framework\Exception\FileSystemException
103+
*/
104+
public function createDirectory($path, $permissions = 0777): void
105+
{
106+
$this->driver->createDirectory($path, $permissions);
107+
}
108+
109+
/**
110+
* Recursive delete directory in the S3 bucket
111+
*
112+
* @param string $path
113+
* @return void
114+
*
115+
* @throws \Magento\Framework\Exception\FileSystemException
116+
*/
117+
public function deleteDirectory($path): void
118+
{
119+
if ($this->driver->isExists($path)) {
120+
$this->driver->deleteDirectory($path);
121+
}
122+
}
123+
95124
/**
96125
* Assert a file exists on the remote storage system
97126
*
@@ -177,4 +206,18 @@ public function assertFileDoesNotContain($filePath, $text, $message = ""): void
177206
{
178207
$this->assertStringNotContainsString($text, $this->driver->fileGetContents($filePath), $message);
179208
}
209+
210+
/**
211+
* Asserts that a directory on the remote storage system is empty
212+
*
213+
* @param string $path
214+
* @param string $message
215+
* @return void
216+
*
217+
* @throws \Magento\Framework\Exception\FileSystemException
218+
*/
219+
public function assertDirectoryEmpty($path, $message = ""): void
220+
{
221+
$this->assertEmpty($this->driver->readDirectory($path), $message);
222+
}
180223
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
</arguments>
1818
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
1919
<waitForPageLoad stepKey="waitForPageLoad"/>
20-
<seeElement selector="{{AdminProductImagesSection.imageFile(image)}}" stepKey="seeImage"/>
20+
<waitForElementVisible selector="{{AdminProductImagesSection.imageFile(image)}}" stepKey="seeImage"/>
2121
</actionGroup>
2222
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Helper/LocalFileAssertions.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,21 @@ public function assertFileDoesNotContain($filePath, $text, $message = ""): void
208208
$this->assertStringNotContainsString($text, $this->driver->fileGetContents($realPath), $message);
209209
}
210210

211+
/**
212+
* Asserts that a directory is empty
213+
*
214+
* @param string $path
215+
* @param string $message
216+
* @return void
217+
*
218+
* @throws \Magento\Framework\Exception\FileSystemException
219+
*/
220+
public function assertDirectoryEmpty($path, $message = ""): void
221+
{
222+
$realPath = $this->expandPath($path);
223+
$this->assertEmpty($this->driver->readDirectory($realPath), $message);
224+
}
225+
211226
/**
212227
* Helper function to construct the real path to the file
213228
*

0 commit comments

Comments
 (0)