Skip to content

Commit 5a01404

Browse files
committed
MC-5233: DateTime product attributes support
1 parent b6d071f commit 5a01404

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,15 @@
370370

371371
<checkOption selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault(row)}}" stepKey="setAsDefault" after="fillStoreView"/>
372372
</actionGroup>
373+
374+
<!-- Go to advanced attribute properties -->
375+
<actionGroup name="AdminNavigateToProductAttributeAdvancedSection">
376+
<annotations>
377+
<description>Navigate and open Advanced Attribute Properties section on product attribute page</description>
378+
</annotations>
379+
380+
<scrollTo selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="scrollToSection"/>
381+
<click selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}" stepKey="openSection"/>
382+
<waitForElementVisible selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" stepKey="waitForSlideOutSection"/>
383+
</actionGroup>
373384
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@
309309
<data key="frontend_input">date</data>
310310
<data key="is_required_admin">No</data>
311311
</entity>
312+
<entity name="datetimeProductAttribute" extends="productAttributeWysiwyg" type="ProductAttribute">
313+
<data key="frontend_input">datetime</data>
314+
<data key="is_required_admin">No</data>
315+
</entity>
312316
<entity name="priceProductAttribute" extends="productAttributeWysiwyg" type="ProductAttribute">
313317
<data key="frontend_input">date</data>
314318
<data key="is_required_admin">No</data>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
<element name="DefaultValueText" type="textarea" selector="#default_value_text"/>
9494
<element name="DefaultValueTextArea" type="textarea" selector="#default_value_textarea"/>
9595
<element name="DefaultValueDate" type="textarea" selector="#default_value_date"/>
96+
<element name="DefaultValueDatetime" type="textarea" selector="#default_value_datetime"/>
9697
<element name="DefaultValueYesNo" type="textarea" selector="#default_value_yesno"/>
9798
<element name="Scope" type="select" selector="#is_global"/>
9899
<element name="UniqueValue" type="select" selector="#is_unique"/>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
9+
<test name="AdminCreateDatetimeProductAttributeTest">
10+
<annotations>
11+
<features value="Catalog"/>
12+
<stories value="Datetime product attributes support"/>
13+
<title value="Datetime product attribute type is supported"/>
14+
<description value="Admin should be able to create datetime product attribute"/>
15+
<severity value="CRITICAL"/>
16+
<testCaseId value="MC-21451"/>
17+
<group value="Catalog"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
21+
</before>
22+
<after>
23+
<actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute">
24+
<argument name="ProductAttribute" value="datetimeProductAttribute"/>
25+
</actionGroup>
26+
<actionGroup ref="logout" stepKey="logout"/>
27+
</after>
28+
29+
<amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/>
30+
<waitForPageLoad stepKey="waitForPageLoad"/>
31+
<!-- Set attribute properties -->
32+
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}"
33+
userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillDefaultLabel"/>
34+
<selectOption selector="{{AttributePropertiesSection.InputType}}"
35+
userInput="{{datetimeProductAttribute.frontend_input}}" stepKey="fillInputType"/>
36+
<actionGroup ref="AdminNavigateToProductAttributeAdvancedSection" stepKey="goToAdvancedSectionNew"/>
37+
<fillField selector="{{AdvancedAttributePropertiesSection.AttributeCode}}"
38+
userInput="{{datetimeProductAttribute.attribute_code}}"
39+
stepKey="fillAttributeCode"/>
40+
<!-- Generate and set a default value -->
41+
<generateDate date="now" format="m/j/y g:i A" stepKey="generateDefaultValue"/>
42+
<fillField selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}"
43+
userInput="{$generateDefaultValue}"
44+
stepKey="fillDefaultValue"/>
45+
<!-- Save the new product attribute -->
46+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="clickSaveAttribute"/>
47+
<waitForPageLoad stepKey="waitForGridPageLoadAfterSaveAttribute"/>
48+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}"
49+
stepKey="waitForSuccessMessage"/>
50+
<!-- Navigate to created product attribute -->
51+
<actionGroup ref="navigateToCreatedProductAttribute" stepKey="navigateToAttribute">
52+
<argument name="ProductAttribute" value="datetimeProductAttribute"/>
53+
</actionGroup>
54+
<!-- Check the saved date and time default value -->
55+
<actionGroup ref="AdminNavigateToProductAttributeAdvancedSection" stepKey="goToAdvancedSection"/>
56+
<scrollTo selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}" stepKey="scrollToDefaultValue"/>
57+
<seeInField userInput="{$generateDefaultValue}"
58+
selector="{{AdvancedAttributePropertiesSection.DefaultValueDatetime}}"
59+
stepKey="checkDefaultValue"/>
60+
</test>
61+
</tests>

0 commit comments

Comments
 (0)