Skip to content

Commit 9011bb2

Browse files
committed
B2B-1645: Add MFTF test for MC-38325 & MC-38947
- Unskipping MFTF test to import downloadable product with file links - Updating MFTF test to import downloadable product with url links
1 parent e186d98 commit 9011bb2

File tree

12 files changed

+225
-78
lines changed

12 files changed

+225
-78
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminAssertProductImageOnProductPageActionGroup">
12+
<annotations>
13+
<description>Validates that the provided product image is present and correct.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="image" defaultValue="{{MagentoLogo.filename}}" type="string"/>
17+
</arguments>
18+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
19+
<waitForPageLoad stepKey="waitForPageLoad"/>
20+
<seeElement selector="{{AdminProductImagesSection.imageFile(image)}}" stepKey="seeImage"/>
21+
</actionGroup>
22+
</actionGroups>

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,53 @@ public function deleteFileIfExists($filePath): void
6969
}
7070
}
7171

72+
/**
73+
* Recursive delete directory
74+
*
75+
* @param string $path
76+
* @return void
77+
*
78+
* @throws \Magento\Framework\Exception\FileSystemException
79+
*/
80+
public function deleteDirectory($path): void
81+
{
82+
$realPath = $this->expandPath($path);
83+
if ($this->driver->isExists($realPath)) {
84+
$this->driver->deleteDirectory($realPath);
85+
}
86+
}
87+
88+
/**
89+
* Copy source into destination
90+
*
91+
* @param string $source
92+
* @param string $destination
93+
* @return void
94+
*
95+
* @throws \Magento\Framework\Exception\FileSystemException
96+
*/
97+
public function copy($source, $destination): void
98+
{
99+
$sourceRealPath = $this->expandPath($source);
100+
$destinationRealPath = $this->expandPath($destination);
101+
$this->driver->copy($sourceRealPath, $destinationRealPath);
102+
}
103+
104+
/**
105+
* Create directory
106+
*
107+
* @param string $path
108+
* @param int $permissions
109+
* @return void
110+
*
111+
* @throws \Magento\Framework\Exception\FileSystemException
112+
*/
113+
public function createDirectory($path, $permissions = 0777): void
114+
{
115+
$sourceRealPath = $this->expandPath($path);
116+
$this->driver->createDirectory($sourceRealPath, $permissions);
117+
}
118+
72119
/**
73120
* Assert a file exists
74121
*

app/code/Magento/ConfigurableImportExport/Test/Mftf/Test/AdminImportSimpleAndConfigurableProductsWithAssignedImagesTest.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<argument name="productQuantity" value="{{ImportProductSimple1_Configurable.quantity}}"/>
113113
<argument name="productWeight" value="{{ImportProductSimple1_Configurable.weight}}"/>
114114
<argument name="productVisibility" value="{{ImportProductSimple1_Configurable.visibilityText}}"/>
115-
<argument name="categoryNames" value="{{ImportCategory_Configurable.name}}"/>
115+
<argument name="categoryName" value="{{ImportCategory_Configurable.name}}"/>
116116
</actionGroup>
117117
<actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProduct1ImageOnEditPage">
118118
<argument name="image" value="MagentoLogo"/>
@@ -130,7 +130,7 @@
130130
<argument name="productQuantity" value="{{ImportProductSimple2_Configurable.quantity}}"/>
131131
<argument name="productWeight" value="{{ImportProductSimple2_Configurable.weight}}"/>
132132
<argument name="productVisibility" value="{{ImportProductSimple1_Configurable.visibilityText}}"/>
133-
<argument name="categoryNames" value="{{ImportCategory_Configurable.name}}"/>
133+
<argument name="categoryName" value="{{ImportCategory_Configurable.name}}"/>
134134
</actionGroup>
135135
<actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProduct2ImageOnEditPage">
136136
<argument name="image" value="TestImage"/>
@@ -148,7 +148,7 @@
148148
<argument name="productQuantity" value="{{ImportProductSimple3_Configurable.quantity}}"/>
149149
<argument name="productWeight" value="{{ImportProductSimple3_Configurable.weight}}"/>
150150
<argument name="productVisibility" value="{{ImportProductSimple1_Configurable.visibilityText}}"/>
151-
<argument name="categoryNames" value="{{ImportCategory_Configurable.name}}"/>
151+
<argument name="categoryName" value="{{ImportCategory_Configurable.name}}"/>
152152
</actionGroup>
153153
<actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertProduct3ImageOnEditPage">
154154
<argument name="image" value="TestImageAdobe"/>
@@ -166,7 +166,7 @@
166166
<argument name="productQuantity" value="{{ImportProduct_Configurable.quantity}}"/>
167167
<argument name="productWeight" value="{{ImportProduct_Configurable.weight}}"/>
168168
<argument name="productVisibility" value="{{ImportProduct_Configurable.visibilityText}}"/>
169-
<argument name="categoryNames" value="{{ImportCategory_Configurable.name}}"/>
169+
<argument name="categoryName" value="{{ImportCategory_Configurable.name}}"/>
170170
</actionGroup>
171171
<actionGroup ref="AssertProductImageAdminProductPageActionGroup" stepKey="assertConfigurableProductBaseImageOnEditPage">
172172
<argument name="image" value="TestImageAdobe"/>

app/code/Magento/Downloadable/Test/Mftf/Section/StorefrontDownloadableLinkSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
<element name="downloadedImage" type="text" selector="//img[contains(@style, '-webkit-user-select')]"/>
1313
<element name="downloadedSvg" type="text" selector="//*[@id='{{id}}']" parameterized="true"/>
1414
<element name="downloadableLinkTitle" type="text" parameterized="true" selector="//*[name()='title'][contains(.,'{{title}}')]"/>
15+
<element name="downloadableLinkImage" type="text" selector="body>img"/>
16+
<element name="downloadableLinkSvg" type="text" selector="svg"/>
1517
</section>
1618
</sections>

app/code/Magento/DownloadableImportExport/Test/Mftf/Data/ImportData.xml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
<data key="visibilityText">Catalog, Search</data>
3939
<data key="status">1</data>
4040
<data key="urlKey">import-product-downloadable-url-links</data>
41+
<data key="baseImage">magento-logo.png</data>
42+
<data key="baseImageName">magento-logo</data>
43+
<data key="smallImage">m-logo.gif</data>
44+
<data key="smallImageName">m-logo</data>
45+
<data key="thumbnailImage">adobe-base.jpg</data>
46+
<data key="thumbnailImageName">adobe-base</data>
4147
<data key="linksTitle">Links</data>
4248
<data key="linkTitle">Link1</data>
4349
<data key="linkPrice">2.00</data>
@@ -69,19 +75,25 @@
6975
<data key="visibilityText">Catalog, Search</data>
7076
<data key="status">1</data>
7177
<data key="urlKey">import-product-downloadable-file-links</data>
78+
<data key="baseImage">magento-logo.png</data>
79+
<data key="baseImageName">magento-logo</data>
80+
<data key="smallImage">m-logo.gif</data>
81+
<data key="smallImageName">m-logo</data>
82+
<data key="thumbnailImage">adobe-base.jpg</data>
83+
<data key="thumbnailImageName">adobe-base</data>
7284
<data key="linksTitle">Links</data>
7385
<data key="linkTitle">Link1</data>
7486
<data key="linkPrice">3.00</data>
75-
<data key="totalPriceWithLink">101.00</data>
87+
<data key="totalPriceWithLink">103.00</data>
7688
<data key="linkFileType">Upload File</data>
77-
<data key="linkFileName">test_image</data>
89+
<data key="linkFileName">m-logo</data>
7890
<data key="linkSampleFileType">Upload File</data>
7991
<data key="linkSampleFileName">magento-logo</data>
8092
<data key="linkShareable">No</data>
8193
<data key="linkMaxDownloads">0</data>
8294
<data key="samplesTitle">Samples</data>
8395
<data key="sampleTitle">Sample1</data>
8496
<data key="sampleFileType">Upload File</data>
85-
<data key="sampleFileName">adobe-thumb</data>
97+
<data key="sampleFileName">adobe-base</data>
8698
</entity>
8799
</entities>

0 commit comments

Comments
 (0)