Skip to content

Commit d624e86

Browse files
author
Stas Puga
committed
MAGETWO-90115: Automate purchasing a product with Custom Options
1 parent 431d0d3 commit d624e86

14 files changed

+441
-8
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/StorefrontProductPageActionGroup.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,13 @@
2121
<waitForPageLoad stepKey="waitForPageLoad"/>
2222
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
2323
</actionGroup>
24+
25+
<actionGroup name="addToCartFromStorefrontCustomOptionsProductPage">
26+
<arguments>
27+
<argument name="productName"/>
28+
</arguments>
29+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/>
30+
<waitForPageLoad stepKey="waitForPageLoad"/>
31+
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
32+
</actionGroup>
2433
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,18 @@
161161
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
162162
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
163163
</entity>
164+
<entity name="productWithOptions" type="product">
165+
<var key="sku" entityType="product" entityKey="sku" />
166+
<data key="file">magento.jpg</data>
167+
<requiredEntity type="product_option">ProductOptionField</requiredEntity>
168+
<requiredEntity type="product_option">ProductOptionArea</requiredEntity>
169+
<requiredEntity type="product_option">ProductOptionFile</requiredEntity>
170+
<requiredEntity type="product_option">ProductOptionDropdown</requiredEntity>
171+
<requiredEntity type="product_option">ProductOptionRadioButtons</requiredEntity>
172+
<requiredEntity type="product_option">ProductOptionCheckbox</requiredEntity>
173+
<requiredEntity type="product_option">ProductOptionMultiSelect</requiredEntity>
174+
<requiredEntity type="product_option">ProductOptionDate</requiredEntity>
175+
<requiredEntity type="product_option">ProductOptionDateAndTime</requiredEntity>
176+
<requiredEntity type="product_option">ProductOptionTime</requiredEntity>
177+
</entity>
164178
</entities>
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="ProductOptionField" type="product_option">
12+
<var key="product_sku" entityType="product" entityKey="sku" />
13+
<data key="title">OptionField</data>
14+
<data key="type">field</data>
15+
<data key="is_require">true</data>
16+
<data key="sort_order">1</data>
17+
<data key="price">10</data>
18+
<data key="price_type">fixed</data>
19+
<data key="max_characters">0</data>
20+
</entity>
21+
<entity name="ProductOptionArea" type="product_option">
22+
<var key="product_sku" entityType="product" entityKey="sku" />
23+
<data key="title">OptionArea</data>
24+
<data key="type">area</data>
25+
<data key="is_require">true</data>
26+
<data key="sort_order">2</data>
27+
<data key="price">10</data>
28+
<data key="price_type">percent</data>
29+
<data key="max_characters">0</data>
30+
</entity>
31+
<entity name="ProductOptionFile" type="product_option">
32+
<var key="product_sku" entityType="product" entityKey="sku" />
33+
<data key="title">OptionFile</data>
34+
<data key="type">file</data>
35+
<data key="is_require">true</data>
36+
<data key="sort_order">3</data>
37+
<data key="price">9.99</data>
38+
<data key="price_type">fixed</data>
39+
<data key="file_extension">png, jpg, gif</data>
40+
<data key="image_size_x">0</data>
41+
<data key="image_size_y">0</data>
42+
</entity>
43+
<entity name="ProductOptionDropdown" type="product_option">
44+
<var key="product_sku" entityType="product" entityKey="sku" />
45+
<data key="title">OptionDorpDown</data>
46+
<data key="type">drop_down</data>
47+
<data key="sort_order">4</data>
48+
<data key="is_require">true</data>
49+
<requiredEntity type="product_option_value">ProductOptionValueDropdown1</requiredEntity>
50+
<requiredEntity type="product_option_value">ProductOptionValueDropdown2</requiredEntity>
51+
</entity>
52+
<entity name="ProductOptionRadioButtons" type="product_option">
53+
<var key="product_sku" entityType="product" entityKey="sku" />
54+
<data key="title">OptionRadioButtons</data>
55+
<data key="type">radio</data>
56+
<data key="sort_order">5</data>
57+
<data key="is_require">true</data>
58+
<requiredEntity type="product_option_value">ProductOptionValueRadioButtons1</requiredEntity>
59+
<requiredEntity type="product_option_value">ProductOptionValueRadioButtons2</requiredEntity>
60+
</entity>
61+
<entity name="ProductOptionCheckbox" type="product_option">
62+
<var key="product_sku" entityType="product" entityKey="sku" />
63+
<data key="title">OptionCheckbox</data>
64+
<data key="type">checkbox</data>
65+
<data key="sort_order">6</data>
66+
<data key="is_require">true</data>
67+
<requiredEntity type="product_option_value">ProductOptionValueCheckbox</requiredEntity>
68+
</entity>
69+
<entity name="ProductOptionMultiSelect" type="product_option">
70+
<var key="product_sku" entityType="product" entityKey="sku" />
71+
<data key="title">OptionMultiSelect</data>
72+
<data key="type">multiple</data>
73+
<data key="sort_order">7</data>
74+
<data key="is_require">true</data>
75+
<requiredEntity type="product_option_value">ProductOptionValueMultiSelect1</requiredEntity>
76+
<requiredEntity type="product_option_value">ProductOptionValueMultiSelect2</requiredEntity>
77+
</entity>
78+
<entity name="ProductOptionDate" type="product_option">
79+
<var key="product_sku" entityType="product" entityKey="sku" />
80+
<data key="title">OptionDate</data>
81+
<data key="type">date</data>
82+
<data key="sort_order">8</data>
83+
<data key="is_require">true</data>
84+
<data key="price">1234</data>
85+
<data key="price_type">fixed</data>
86+
</entity>
87+
<entity name="ProductOptionDateAndTime" type="product_option">
88+
<var key="product_sku" entityType="product" entityKey="sku" />
89+
<data key="title">OptionDateAndTime</data>
90+
<data key="type">date_time</data>
91+
<data key="sort_order">9</data>
92+
<data key="is_require">true</data>
93+
<data key="price">0.00</data>
94+
<data key="price_type">fixed</data>
95+
</entity>
96+
<entity name="ProductOptionTime" type="product_option">
97+
<var key="product_sku" entityType="product" entityKey="sku" />
98+
<data key="title">OptionTime</data>
99+
<data key="type">time</data>
100+
<data key="sort_order">10</data>
101+
<data key="is_require">true</data>
102+
<data key="price">0.00</data>
103+
<data key="price_type">percent</data>
104+
</entity>
105+
</entities>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="ProductOptionValueDropdown1" type="product_option_value">
12+
<data key="title">OptionValueDropDown1</data>
13+
<data key="sort_order">1</data>
14+
<data key="price">0.01</data>
15+
<data key="price_type">fixed</data>
16+
</entity>
17+
<entity name="ProductOptionValueDropdown2" type="product_option_value">
18+
<data key="title">OptionValueDropDown2</data>
19+
<data key="sort_order">2</data>
20+
<data key="price">0.01</data>
21+
<data key="price_type">percent</data>
22+
</entity>
23+
<entity name="ProductOptionValueRadioButtons1" type="product_option_value">
24+
<data key="title">OptionValueRadioButtons1</data>
25+
<data key="sort_order">1</data>
26+
<data key="price">99.99</data>
27+
<data key="price_type">fixed</data>
28+
</entity>
29+
<entity name="ProductOptionValueRadioButtons2" type="product_option_value">
30+
<data key="title">OptionValueRadioButtons2</data>
31+
<data key="sort_order">2</data>
32+
<data key="price">99.99</data>
33+
<data key="price_type">percent</data>
34+
</entity>
35+
<entity name="ProductOptionValueCheckbox" type="product_option_value">
36+
<data key="title">OptionValueCheckbox</data>
37+
<data key="sort_order">1</data>
38+
<data key="price">123</data>
39+
<data key="price_type">percent</data>
40+
</entity>
41+
<entity name="ProductOptionValueMultiSelect1" type="product_option_value">
42+
<data key="title">OptionValueMultiSelect1</data>
43+
<data key="sort_order">1</data>
44+
<data key="price">1</data>
45+
<data key="price_type">fixed</data>
46+
</entity>
47+
<entity name="ProductOptionValueMultiSelect2" type="product_option_value">
48+
<data key="title">OptionValueMultiSelect2</data>
49+
<data key="sort_order">2</data>
50+
<data key="price">2</data>
51+
<data key="price_type">fixed</data>
52+
</entity>
53+
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product-meta.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<field key="sku">string</field>
1515
<field key="name">string</field>
1616
<field key="attribute_set_id">integer</field>
17-
<field key="price">integer</field>
17+
<field key="price">number</field>
1818
<field key="status">integer</field>
1919
<field key="visibility">integer</field>
2020
<field key="type_id">string</field>
@@ -40,7 +40,7 @@
4040
<field key="sku">string</field>
4141
<field key="name">string</field>
4242
<field key="attribute_set_id">integer</field>
43-
<field key="price">integer</field>
43+
<field key="price">number</field>
4444
<field key="status">integer</field>
4545
<field key="visibility">integer</field>
4646
<field key="type_id">string</field>
@@ -69,7 +69,7 @@
6969
<field key="sku">string</field>
7070
<field key="name">string</field>
7171
<field key="attribute_set_id">integer</field>
72-
<field key="price">integer</field>
72+
<field key="price">number</field>
7373
<field key="status">integer</field>
7474
<field key="visibility">integer</field>
7575
<field key="type_id">string</field>
@@ -95,7 +95,7 @@
9595
<field key="sku">string</field>
9696
<field key="name">string</field>
9797
<field key="attribute_set_id">integer</field>
98-
<field key="price">integer</field>
98+
<field key="price">number</field>
9999
<field key="status">integer</field>
100100
<field key="visibility">integer</field>
101101
<field key="type_id">string</field>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option-meta.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<field key="type">string</field>
1616
<field key="sort_order">integer</field>
1717
<field key="is_require">boolean</field>
18-
<field key="price">integer</field>
18+
<field key="price">number</field>
1919
<field key="price_type">string</field>
2020
<field key="sku">string</field>
2121
<field key="file_extension">string</field>
@@ -33,7 +33,7 @@
3333
<field key="type">string</field>
3434
<field key="sort_order">integer</field>
3535
<field key="is_require">boolean</field>
36-
<field key="price">integer</field>
36+
<field key="price">number</field>
3737
<field key="price_type">string</field>
3838
<field key="sku">string</field>
3939
<field key="file_extension">string</field>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Metadata/product_option_value-meta.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
<operation name="CreateProductOptionValue" dataType="product_option_value" type="create">
1212
<field key="title">string</field>
1313
<field key="sort_order">integer</field>
14-
<field key="price">integer</field>
14+
<field key="price">number</field>
1515
<field key="price_type">string</field>
1616
<field key="sku">string</field>
1717
<field key="option_type_id">integer</field>
1818
</operation>
1919
<operation name="UpdateProductOptionValue" dataType="product_option_value" type="update">
2020
<field key="title">string</field>
2121
<field key="sort_order">integer</field>
22-
<field key="price">integer</field>
22+
<field key="price">number</field>
2323
<field key="price_type">string</field>
2424
<field key="sku">string</field>
2525
<field key="option_type_id">integer</field>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontProductInfoMainSection.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,36 @@
1616
<element name="productStockStatus" type="text" selector=".stock[title=Availability]>span"/>
1717
<element name="productImage" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[@class='fotorama__img']"/>
1818
<element name="productDescription" type="text" selector="#description .value"/>
19+
<element name="productOptionFieldInput" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//input[@type='text']" parameterized="true"/>
20+
<element name="productOptionAreaInput" type="textarea" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//textarea" parameterized="true"/>
21+
<element name="productOptionFile" type="file" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'OptionFile')]/../div[@class='control']//input[@type='file']" parameterized="true"/>
22+
<element name="productOptionSelect" type="select" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//select" parameterized="true"/>
23+
<element name="productOptionRadioButtonsCheckbox" type="checkbox" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//input[@price='{{var2}}']" parameterized="true"/>
24+
<element name="productOptionDataMonth" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='month']" parameterized="true"/>
25+
<element name="productOptionDataDay" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='day']" parameterized="true"/>
26+
<element name="productOptionDataYear" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='year']" parameterized="true"/>
27+
<element name="ProductOptionDateAndTimeMonth" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='month']" parameterized="true"/>
28+
<element name="ProductOptionDateAndTimeDay" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='day']" parameterized="true"/>
29+
<element name="ProductOptionDateAndTimeYear" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='year']" parameterized="true"/>
30+
<element name="ProductOptionDateAndTimeHour" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='hour']" parameterized="true"/>
31+
<element name="ProductOptionDateAndTimeMinute" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='minute']" parameterized="true"/>
32+
<element name="ProductOptionTimeHour" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='hour']" parameterized="true"/>
33+
<element name="ProductOptionTimeMinute" type="date" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//legend[contains(.,'{{var1}}')]/../div[@class='control']//select[@data-calendar-role='minute']" parameterized="true"/>
34+
35+
<!-- Only one of Upload/Url Inputs are available for File and Sample depending on the value of the corresponding TypeSelector -->
36+
<element name="addLinkFileUploadFile" type="file" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//input[@type='file']" parameterized="true" />
37+
1938
<element name="productShortDescription" type="text" selector="//div[@class='product attribute overview']//div[@class='value']"/>
2039
<element name="productAttributeTitle1" type="text" selector="#product-options-wrapper div[tabindex='0'] label"/>
2140
<element name="productAttributeOptions1" type="select" selector="#product-options-wrapper div[tabindex='0'] option"/>
41+
<element name="productAttributeOptionsField" type="text" selector="//label[contains(.,'{{var1}}')]//span[@data-price-amount='{{var2}}']" parameterized="true"/>
42+
<element name="productAttributeOptionsArea" type="text" selector="//label[contains(.,'{{var1}}')]//span[@data-price-amount='1.7']" parameterized="true"/>
43+
<element name="productAttributeOptionsFile" type="text" selector="//label[contains(.,'{{var1}}')]//span[@data-price-amount='{{var2}}']" parameterized="true"/>
44+
<element name="productAttributeOptionsDropDown" type="text" selector="//label[contains(.,'{{var1}}')]/../div[@class='control']//select//option[@price='{{var2}}']" parameterized="true"/>
45+
<element name="productAttributeOptionsRadioButtons" type="text" selector="//label[contains(.,'{{var1}}')]/../div[@class='control']//span[@data-price-amount='{{var2}}']" parameterized="true"/>
46+
<element name="productAttributeOptionsCheckbox" type="text" selector="//label[contains(.,'{{var1}}')]/../div[@class='control']//span[@data-price-amount='20.91']" parameterized="true"/>
47+
<element name="productAttributeOptionsMultiselect" type="text" selector="//label[contains(.,'{{var1}}')]/../div[@class='control']//select//option[@price='{{var2}}']" parameterized="true"/>
48+
<element name="productAttributeOptionsData" type="text" selector="//span[contains(.,'{{var1}}')]/../span[@class='price-notice']//span[@data-price-amount='{{var2}}']" parameterized="true"/>
2249
<element name="mediaDescription" type="text" selector=".product.attribute.description>div>p>img"/>
2350
<element name="mediaShortDescription" type="text" selector=".product.attribute.overview>div>p>img"/>
2451
<element name="productAddToCompare" type="button" selector="a.action.tocompare"/>

0 commit comments

Comments
 (0)