Skip to content

Commit d6ea8e0

Browse files
committed
B2B-1655: Add MFTF test for MC-38949
- Adding MFTF test for scheduled product import
1 parent ad0ba79 commit d6ea8e0

File tree

6 files changed

+92
-0
lines changed

6 files changed

+92
-0
lines changed

app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminFilterLegacyGridActionGroup.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
<actionGroup name="AdminFilterLegacyGridActionGroup">
1212
<arguments>
1313
<argument name="value" type="string"/>
14+
<argument name="field" type="string" defaultValue="{{AdminLegacyDataGridFilterSection.inputFieldByNameAttr('name')}}"/>
1415
<argument name="button" type="string" defaultValue="{{AdminLegacyDataGridFilterSection.apply}}"/>
1516
</arguments>
17+
<waitForElementVisible selector="{{AdminLegacyDataGridFilterSection.clear}}" stepKey="waitForResetFilters" />
1618
<click selector="{{AdminLegacyDataGridFilterSection.clear}}" stepKey="resetFilters" />
1719
<waitForPageLoad stepKey="waitForFilterReset" />
1820
<fillField selector="{{field}}" userInput="{{value}}" stepKey="fillFieldInFilter"/>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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="AdminAssertProductInfoOnEditPageActionGroup">
12+
<annotations>
13+
<description>Verifies the general data on the Edit product details page in admin for a product.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productStatus" defaultValue="{{_defaultProduct.status}}" type="string"/>
17+
<argument name="productAttributeSet" defaultValue="Default" type="string"/>
18+
<argument name="productName" defaultValue="{{_defaultProduct.name}}" type="string"/>
19+
<argument name="productSku" defaultValue="{{_defaultProduct.sku}}" type="string"/>
20+
<argument name="productPrice" defaultValue="{{_defaultProduct.price}}" type="string"/>
21+
<argument name="productQuantity" defaultValue="{{_defaultProduct.quantity}}" type="string"/>
22+
<argument name="productStockStatus" defaultValue="In Stock" type="string"/>
23+
<argument name="productWeight" defaultValue="{{_defaultProduct.weight}}" type="string"/>
24+
<argument name="productVisibility" defaultValue="Catalog, Search" type="string"/>
25+
<argument name="categoryNames" defaultValue="{{_defaultCategory.name}}" type="string"/>
26+
</arguments>
27+
<waitForElementVisible selector="{{AdminProductFormSection.productStatus}}" stepKey="waitForProductStatus"/>
28+
<seeElement selector="{{AdminProductFormSection.productStatusValue(productStatus)}}" stepKey="seeProductStatus"/>
29+
<seeOptionIsSelected selector="{{AdminProductFormSection.attributeSet}}" userInput="{{productAttributeSet}}" stepKey="seeProductAttributeSet"/>
30+
<seeInField selector="{{AdminProductFormSection.productName}}" userInput="{{productName}}" stepKey="seeProductName"/>
31+
<seeInField selector="{{AdminProductFormSection.productSku}}" userInput="{{productSku}}" stepKey="seeProductSku"/>
32+
<seeInField selector="{{AdminProductFormSection.productPrice}}" userInput="{{productPrice}}" stepKey="seeProductPrice"/>
33+
<seeInField selector="{{AdminProductFormSection.productQuantity}}" userInput="{{productQuantity}}" stepKey="seeProductQuantity"/>
34+
<seeInField selector="{{AdminProductFormSection.productStockStatus}}" userInput="{{productStockStatus}}" stepKey="seeProductStockStatus"/>
35+
<seeInField selector="{{AdminProductFormSection.productWeight}}" userInput="{{productWeight}}" stepKey="seeProductWeight"/>
36+
<seeOptionIsSelected selector="{{AdminProductFormSection.visibility}}" userInput="{{productVisibility}}" stepKey="seeProductVisibility"/>
37+
<seeElement selector="{{AdminProductFormSection.categories(categoryNames)}}" stepKey="seeProductCategories"/>
38+
</actionGroup>
39+
</actionGroups>

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

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

72+
/**
73+
* Copy a file
74+
*
75+
* @param string $source
76+
* @param string $destination
77+
* @return void
78+
*
79+
* @throws \Magento\Framework\Exception\FileSystemException
80+
*/
81+
public function copyFile($source, $destination): void
82+
{
83+
$sourceRealPath = $this->expandPath($source);
84+
$destinationRealPath = $this->expandPath($destination);
85+
$this->driver->copy($sourceRealPath, $destinationRealPath);
86+
}
87+
7288
/**
7389
* Assert a file exists
7490
*

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<element name="imageFileUpload" type="input" selector="#fileupload"/>
1414
<element name="imageUploadButton" type="button" selector="div.image div.fileinput-button"/>
1515
<element name="imageFile" type="text" selector="//*[@id='media_gallery_content']//img[contains(@src, '{{url}}')]" parameterized="true"/>
16+
<element name="imageFileRoleByImage" type="text" selector="//*[@id='media_gallery_content']//img[contains(@src, '{{url}}')]/ancestor::div[@data-role='image']//*[@data-role-code='{{roleCode}}']" parameterized="true"/>
1617
<element name="imageElement" type="text" selector="#media_gallery_content img"/>
1718
<element name="removeImageButton" type="button" selector=".action-remove"/>
1819
<element name="removeImageButtonForExactImage" type="button" selector="[id='media_gallery_content'] img[src*='{{imageName}}'] + div[class='actions'] button[class='action-remove']" parameterized="true"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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="StorefrontVerifyCustomerOrderProductRowDataActionGroup">
12+
<annotations>
13+
<description>Verify a customer's order details for a product row on the view order page on the storefront</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="name" type="string"/>
17+
<argument name="sku" type="string"/>
18+
<argument name="price" type="string"/>
19+
<argument name="quantity" type="string"/>
20+
<argument name="subtotal" type="string"/>
21+
<argument name="index" defaultValue="1" type="string"/>
22+
</arguments>
23+
<waitForText userInput="{{name}}" selector="{{StorefrontCustomerOrderViewSection.productNameByRow(index)}}" stepKey="seeProductName"/>
24+
<waitForText userInput="{{sku}}" selector="{{StorefrontCustomerOrderViewSection.productSkuByRow(index)}}" stepKey="seeProductSku"/>
25+
<waitForText userInput="{{price}}" selector="{{StorefrontCustomerOrderViewSection.productPriceByRow(index)}}" stepKey="seeProductPrice"/>
26+
<waitForText userInput="{{quantity}}" selector="{{StorefrontCustomerOrderViewSection.productQuantityByRow(index)}}" stepKey="seeProductQuantity"/>
27+
<waitForText userInput="{{subtotal}}" selector="{{StorefrontCustomerOrderViewSection.productSubtotalByRow(index)}}" stepKey="seeProductSubtotal"/>
28+
</actionGroup>
29+
</actionGroups>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
<element name="createdDate" type="text" selector=".block-order-details-comments .comment-date"/>
2222
<element name="orderPlacedBy" type="text" selector=".block-order-details-comments .comment-content"/>
2323
<element name="productName" type="text" selector="//td[@data-th='Product Name']"/>
24+
<element name="productNameByRow" type="text" parameterized="true" selector="#my-orders-table tbody:nth-of-type({{index}}) td.name"/>
25+
<element name="productSkuByRow" type="text" parameterized="true" selector="#my-orders-table tbody:nth-of-type({{index}}) td.sku"/>
26+
<element name="productPriceByRow" type="text" parameterized="true" selector="#my-orders-table tbody:nth-of-type({{index}}) td.price"/>
27+
<element name="productQuantityByRow" type="text" parameterized="true" selector="#my-orders-table tbody:nth-of-type({{index}}) td.qty"/>
28+
<element name="productSubtotalByRow" type="text" parameterized="true" selector="#my-orders-table tbody:nth-of-type({{index}}) td.subtotal"/>
2429
<element name="grandTotal" type="text" selector="//tr[@class='grand_total']//td[@data-th='Grand Total']"/>
2530
</section>
2631
</sections>

0 commit comments

Comments
 (0)