Skip to content

Commit 4db81e0

Browse files
committed
Merge branch 'B2B-1703' into foxes-pr
2 parents 592c792 + f87009c commit 4db81e0

File tree

249 files changed

+1669
-440
lines changed

Some content is hidden

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

249 files changed

+1669
-440
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,21 @@ public function assertGlobbedFileContainsString($path, $pattern, $text, $fileInd
239239
$this->assertStringContainsString($text, $this->driver->fileGetContents($files[$fileIndex] ?? ''), $message);
240240
}
241241

242+
/**
243+
* Assert a file on the remote storage system does not contain a given string
244+
*
245+
* @param string $filePath
246+
* @param string $text
247+
* @param string $message
248+
* @return void
249+
*
250+
* @throws \Magento\Framework\Exception\FileSystemException
251+
*/
252+
public function assertFileDoesNotContainString($filePath, $text, $message = ""): void
253+
{
254+
$this->assertStringNotContainsString($text, $this->driver->fileGetContents($filePath), $message);
255+
}
256+
242257
/**
243258
* Assert a file on the remote storage system does not contain a given string
244259
*
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAwsS3ExportBundleProductTest" extends="AdminExportBundleProductTest">
12+
<annotations>
13+
<features value="AwsS3"/>
14+
<stories value="Export Products"/>
15+
<title value="S3 - Export Bundle Products"/>
16+
<description value="Verifies that a user can export Bundle and Simple child products for Bundled products
17+
with a dynamic price, a fixed price, and a custom attribute. Verifies that the exported file and the
18+
downloadable copy of the exported file contain the expected products. Note that MFTF cannot simply download
19+
a file and have access to it due to the test not having access to the server that is running the test
20+
browser. Therefore, this test verifies that the Download button can be successfully clicked, grabs the
21+
request URL from the Download button, executes the request on the magento machine via a curl request, and
22+
verifies the contents of the downloaded file. Uses S3 for the file system."/>
23+
<severity value="CRITICAL"/>
24+
<testCaseId value="MC-38558"/>
25+
<group value="importExport"/>
26+
<group value="remote_storage_aws_s3"/>
27+
</annotations>
28+
29+
<before>
30+
<!-- Enable AWS S3 Remote Storage -->
31+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="firstSimpleProductForDynamic"/>
32+
</before>
33+
34+
<after>
35+
<helper class="\Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="deleteDirectory" stepKey="deleteExportFileDirectory">
36+
<argument name="path">import_export/export</argument>
37+
</helper>
38+
39+
<!-- Disable AWS S3 Remote Storage -->
40+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logout"/>
41+
</after>
42+
43+
<!-- Validate Export File on File System: Dynamic Bundle Product -->
44+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileExists" stepKey="assertExportFileExists">
45+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
46+
</helper>
47+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFirstSimpleProductForDynamicBundledProduct">
48+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
49+
<argument name="text">$$firstSimpleProductForDynamic.name$$</argument>
50+
</helper>
51+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsSecondSimpleProductForDynamicBundledProduct">
52+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
53+
<argument name="text">$$secondSimpleProductForDynamic.name$$</argument>
54+
</helper>
55+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsDynamicBundleProduct">
56+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
57+
<argument name="text">$$createDynamicBundleProduct.name$$</argument>
58+
</helper>
59+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsDynamicBundleProductOption1">
60+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
61+
<argument name="text">name=$createFirstBundleOption.option[title]$,type=$createFirstBundleOption.option[type]$,required=$createFirstBundleOption.option[required]$,sku=$$firstSimpleProductForDynamic.sku$$</argument>
62+
</helper>
63+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsDynamicBundleProductOption2">
64+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
65+
<argument name="text">name=$createFirstBundleOption.option[title]$,type=$createFirstBundleOption.option[type]$,required=$createFirstBundleOption.option[required]$,sku=$$secondSimpleProductForDynamic.sku$$</argument>
66+
</helper>
67+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsDynamicPriceBundleProduct">
68+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
69+
<argument name="text">0.000000,,,,$$createDynamicBundleProduct.sku$$</argument>
70+
</helper>
71+
72+
<!-- Validate Export File on File System: Fixed Bundle Product -->
73+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFirstSimpleProductForFixedBundledProduct">
74+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
75+
<argument name="text">$$firstSimpleProductForFixed.name$$</argument>
76+
</helper>
77+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsSecondSimpleProductForFixedBundledProduct">
78+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
79+
<argument name="text">$$secondSimpleProductForFixed.name$$</argument>
80+
</helper>
81+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFixedBundleProduct">
82+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
83+
<argument name="text">$$createFixedBundleProduct.name$$</argument>
84+
</helper>
85+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFixedBundleProductOption1">
86+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
87+
<argument name="text">name=$createSecondBundleOption.option[title]$,type=$createSecondBundleOption.option[type]$,required=$createSecondBundleOption.option[required]$,sku=$$firstSimpleProductForFixed.sku$$</argument>
88+
</helper>
89+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFixedBundleProductOption2">
90+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
91+
<argument name="text">name=$createSecondBundleOption.option[title]$,type=$createSecondBundleOption.option[type]$,required=$createSecondBundleOption.option[required]$,sku=$$secondSimpleProductForFixed.sku$$</argument>
92+
</helper>
93+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFixedPriceBundleProduct">
94+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
95+
<argument name="text">$$createFixedBundleProduct.price$$0000,,,,$$createFixedBundleProduct.sku$$</argument>
96+
</helper>
97+
98+
<!-- Validate Export File on File System: Fixed Bundle Product with Attribute -->
99+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFirstSimpleProductForFixedBundledProductWithAttribute">
100+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
101+
<argument name="text">$$firstSimpleProductForFixedWithAttribute.name$$</argument>
102+
</helper>
103+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsSecondSimpleProductForFixedBundledProductWithAttribute">
104+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
105+
<argument name="text">$$secondSimpleProductForFixedWithAttribute.name$$</argument>
106+
</helper>
107+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFixedBundleProductWithAttribute">
108+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
109+
<argument name="text">$$createFixedBundleProductWithAttribute.name$$</argument>
110+
</helper>
111+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFixedBundleProductWithAttributeOption1">
112+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
113+
<argument name="text">name=$createBundleOptionWithAttribute.option[title]$,type=$createBundleOptionWithAttribute.option[type]$,required=$createBundleOptionWithAttribute.option[required]$,sku=$$firstSimpleProductForFixedWithAttribute.sku$$</argument>
114+
</helper>
115+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFixedBundleProductWithAttributeOption2">
116+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
117+
<argument name="text">name=$createBundleOptionWithAttribute.option[title]$,type=$createBundleOptionWithAttribute.option[type]$,required=$createBundleOptionWithAttribute.option[required]$,sku=$$secondSimpleProductForFixedWithAttribute.sku$$</argument>
118+
</helper>
119+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsFixedPriceBundleProductWithAttribute">
120+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
121+
<argument name="text">$$createFixedBundleProductWithAttribute.price$$0000,,,,$$createFixedBundleProductWithAttribute.sku$$</argument>
122+
</helper>
123+
124+
<!-- Delete Export File -->
125+
<helper class="\Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileDoesNotExist" stepKey="assertExportFileDeleted">
126+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
127+
</helper>
128+
</test>
129+
</tests>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminAwsS3ExportDownloadableProductWithFileLinksTest" extends="AdminExportDownloadableProductWithFileLinksTest">
12+
<annotations>
13+
<features value="AwsS3"/>
14+
<stories value="Export Products"/>
15+
<title value="S3 - Export Downloadable Products with File Links"/>
16+
<description value="Verifies that a user can export a Downloadable product with downloadable and sample file
17+
links. Verifies that the exported file and the downloadable copy of the exported file contain the expected
18+
product (a filter is applied when exporting such that ONLY the downloadable product row should be in the
19+
export), the correct downloadable link with files, and the correct downloadable sample links with files.
20+
Note that MFTF cannot simply download a file and have access to it due to the test not having access to the
21+
server that is running the test browser. Therefore, this test verifies that the Download button can be
22+
successfully clicked, grabs the request URL from the Download button, executes the request on the magento
23+
machine via a curl request, and verifies the contents of the downloaded file. Uses S3 for the file system."/>
24+
<severity value="CRITICAL"/>
25+
<testCaseId value="MC-38558"/>
26+
<group value="importExport"/>
27+
<group value="remote_storage_aws_s3"/>
28+
</annotations>
29+
30+
<before>
31+
<!-- Enable AWS S3 Remote Storage -->
32+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="createCategory"/>
33+
</before>
34+
35+
<after>
36+
<helper class="\Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="deleteDirectory" stepKey="deleteExportFileDirectory">
37+
<argument name="path">import_export/export</argument>
38+
</helper>
39+
40+
<!-- Disable AWS S3 Remote Storage -->
41+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logout"/>
42+
</after>
43+
44+
<!-- Validate Export File on S3 -->
45+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileExists" stepKey="assertExportFileExists">
46+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
47+
</helper>
48+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsDownloadableProduct">
49+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
50+
<argument name="text">$$createProduct.name$$</argument>
51+
</helper>
52+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsDownloadableLink">
53+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
54+
<argument name="text">title=$addDownloadableLink.link[title]$,sort_order=$addDownloadableLink.link[sort_order]$,sample_type=$addDownloadableLink.link[sample_type]$,sample_file=/a/d/$addDownloadableLink.link[sample_file_content][name]$,price=$addDownloadableLink.link[price]$0000,number_of_downloads=$addDownloadableLink.link[number_of_downloads]$,is_shareable=$addDownloadableLink.link[is_shareable]$,link_type=$addDownloadableLink.link[link_type]$,link_file=/m/a/$addDownloadableLink.link[link_file_content][name]$</argument>
55+
</helper>
56+
<helper class="Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileContainsString" stepKey="assertExportFileContainsDownloadableSampleLink">
57+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
58+
<argument name="text">title=$addDownloadableSamples.sample[title]$,sample_type=$addDownloadableSamples.sample[sample_type]$,sample_file=/t/e/$addDownloadableSamples.sample[sample_file_content][name]$</argument>
59+
</helper>
60+
61+
<!-- Delete Export File -->
62+
<helper class="\Magento\AwsS3\Test\Mftf\Helper\S3FileAssertions" method="assertFileDoesNotExist" stepKey="assertExportFileDeleted">
63+
<argument name="filePath">import_export/export/{$grabNameFile}</argument>
64+
</helper>
65+
</test>
66+
</tests>

0 commit comments

Comments
 (0)