Skip to content

Commit ae611f6

Browse files
authored
Merge pull request #4104 from magento-tsg/2.3-develop-pr44
[TSG] Upporting for 2.3 (pr44) (2.3-develop)
2 parents 0740f7c + a022ed1 commit ae611f6

File tree

8 files changed

+152
-118
lines changed

8 files changed

+152
-118
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@
5252
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
5353
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
5454

55-
<!-- Reset Product filter -->
56-
57-
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/>
58-
5955
<!-- Delete Store View EN -->
6056

6157
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView1">
@@ -67,6 +63,14 @@
6763
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView2">
6864
<argument name="customStore" value="customStoreFR"/>
6965
</actionGroup>
66+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearWebsitesGridFilters"/>
67+
68+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrdersGridFilter"/>
69+
70+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/>
71+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/>
72+
<actionGroup ref="logout" stepKey="logout"/>
73+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/>
7074
</after>
7175

7276
<!-- Open Product Grid, Filter product and open -->
@@ -78,8 +82,9 @@
7882
<argument name="product" value="_defaultProduct"/>
7983
</actionGroup>
8084

81-
<click selector="{{AdminProductGridSection.productGridXRowYColumnButton('1', '2')}}" stepKey="openProductForEdit"/>
82-
<waitForPageLoad time="30" stepKey="waitForPageLoad2"/>
85+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProductPage">
86+
<argument name="product" value="$$createProduct$$"/>
87+
</actionGroup>
8388

8489
<!-- Update Product with Option Value DropDown 1-->
8590
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses2"/>
@@ -101,15 +106,12 @@
101106
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveButton1"/>
102107

103108
<!-- Switcher to Store FR-->
104-
<scrollToTopOfPage stepKey="scrollToTopOfPage1"/>
105-
106-
<click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreSwitcher"/>
107-
<click selector="{{AdminProductFormActionSection.selectStoreView(customStoreFR.name)}}" stepKey="clickStoreView"/>
108-
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptMessage"/>
109+
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToStoreFR">
110+
<argument name="storeView" value="customStoreFR.name"/>
111+
</actionGroup>
109112

110113
<!-- Open tab Customizable Options -->
111114

112-
<waitForPageLoad time="10" stepKey="waitForPageLoad4"/>
113115
<conditionalClick selector="{{AdminProductCustomizableOptionsSection.customizableOptions}}" dependentSelector="{{AdminProductCustomizableOptionsSection.checkIfCustomizableOptionsTabOpen}}" visible="true" stepKey="clickIfContentTabCloses3"/>
114116

115117
<!-- Update Option Customizable Options and Option Value 1-->
@@ -129,11 +131,9 @@
129131

130132
<!-- Login Customer Storefront -->
131133

132-
<amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage"/>
133-
<waitForPageLoad time="30" stepKey="waitForPageLoad6"/>
134-
<fillField userInput="$$createCustomer.email$$" selector="{{StorefrontCustomerSignInFormSection.emailField}}" stepKey="fillEmail"/>
135-
<fillField userInput="$$createCustomer.password$$" selector="{{StorefrontCustomerSignInFormSection.passwordField}}" stepKey="fillPassword"/>
136-
<click selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}" stepKey="clickSignInAccountButton"/>
134+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
135+
<argument name="Customer" value="$$createCustomer$$" />
136+
</actionGroup>
137137

138138
<!-- Go to Product Page -->
139139

@@ -176,24 +176,29 @@
176176

177177
<conditionalClick selector="{{CheckoutPaymentSection.productOptionsByProductItemPrice('150')}}" dependentSelector="{{CheckoutPaymentSection.productOptionsActiveByProductItemPrice('150')}}" visible="false" stepKey="exposeProductOptions1"/>
178178
<see selector="{{CheckoutPaymentSection.productOptionsActiveByProductItemPrice('150')}}" userInput="option2" stepKey="seeProductOptionValueDropdown1Input2"/>
179-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
180-
<waitForPageLoad time="30" stepKey="waitForPageLoad8"/>
181179

182180
<!-- Place Order -->
183181

184-
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder1"/>
185-
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
182+
<!--Select shipping method-->
183+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
184+
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
185+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
186+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/>
187+
<!--Select payment method-->
188+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
189+
<!-- Place Order -->
190+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="customerPlaceOrder">
191+
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/>
192+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/>
193+
</actionGroup>
186194

187195
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
188196

189197
<!-- Open Order -->
190198

191-
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/>
192-
<waitForPageLoad stepKey="waitForPageLoadOrdersPage"/>
193-
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearFilters" />
194-
<fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="fillOrderNum"/>
195-
<click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearchOrderNum"/>
196-
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnSearch"/>
199+
<actionGroup ref="filterOrderGridById" stepKey="openOrdersGrid">
200+
<argument name="orderId" value="{$grabOrderNumber}"/>
201+
</actionGroup>
197202
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
198203
<waitForPageLoad time="30" stepKey="waitForPageLoad10"/>
199204

@@ -205,14 +210,12 @@
205210
<!-- Switch to FR Store View Storefront -->
206211

207212
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnProduct4Page"/>
208-
<waitForPageLoad time="30" stepKey="waitForPageLoad11"/>
209-
<click selector="{{StorefrontHeaderSection.storeViewSwitcher}}" stepKey="clickStoreViewSwitcher1"/>
210-
<waitForElementVisible selector="{{StorefrontHeaderSection.storeViewDropdown}}" stepKey="waitForStoreViewDropdown1"/>
211-
<click selector="{{StorefrontHeaderSection.storeViewOption(customStoreFR.code)}}" stepKey="selectStoreView1"/>
212-
<waitForPageLoad stepKey="waitForPageLoad12"/>
213213

214-
<amOnPage url="{{StorefrontHomePage.url}}$$createProduct.custom_attributes[url_key]$$.html" stepKey="amOnProduct2Page"/>
215-
<waitForPageLoad time="30" stepKey="waitForPageLoad13"/>
214+
<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchStore">
215+
<argument name="storeView" value="customStoreFR"/>
216+
</actionGroup>
217+
218+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnProduct2Page"/>
216219

217220
<seeElement selector="{{StorefrontProductInfoMainSection.productOptionDropDownTitle('FR Custom Options 1')}}" stepKey="seeProductFrOptionDropDownTitle"/>
218221
<seeElement selector="{{StorefrontProductInfoMainSection.productOptionDropDownOptionTitle('FR Custom Options 1', 'FR option1')}}" stepKey="productFrOptionDropDownOptionTitle1"/>
@@ -250,13 +253,22 @@
250253

251254
<conditionalClick selector="{{CheckoutPaymentSection.productOptionsByProductItemPrice('150')}}" dependentSelector="{{CheckoutPaymentSection.productOptionsActiveByProductItemPrice('150')}}" visible="false" stepKey="exposeProductOptions3"/>
252255
<see selector="{{CheckoutPaymentSection.productOptionsActiveByProductItemPrice('150')}}" userInput="FR option2" stepKey="seeProductFrOptionValueDropdown1Input3"/>
253-
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext1"/>
254-
<waitForPageLoad time="30" stepKey="waitForPageLoad14"/>
255256

256257
<!-- Place Order -->
257258

258-
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder2"/>
259-
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder1"/>
259+
<!--Select shipping method-->
260+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod2"/>
261+
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton2"/>
262+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext2"/>
263+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext2"/>
264+
265+
<!--Select payment method-->
266+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod2"/>
267+
<!-- Place Order -->
268+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="customerPlaceOrder2">
269+
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/>
270+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/>
271+
</actionGroup>
260272

261273
<!-- Open Product Grid, Filter product and open -->
262274

@@ -296,8 +308,7 @@
296308

297309
<!--Go to Product Page-->
298310

299-
<amOnPage url="{{StorefrontHomePage.url}}$$createProduct.custom_attributes[url_key]$$.html" stepKey="amOnProduct2Page2"/>
300-
<waitForPageLoad time="30" stepKey="waitForPageLoad20"/>
311+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnProduct2Page2"/>
301312

302313
<seeElement selector="{{StorefrontProductInfoMainSection.productOptionDropDownTitle('Custom Options 1')}}" stepKey="seeProductOptionDropDownTitle1"/>
303314
<seeElement selector="{{StorefrontProductInfoMainSection.productOptionDropDownOptionTitle('Custom Options 1', 'option1')}}" stepKey="seeProductOptionDropDownOptionTitle3"/>

app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
<argument name="orderNumberMessage"/>
295295
<argument name="emailYouMessage"/>
296296
</arguments>
297-
<waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/>
297+
<waitForElementVisible selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/>
298298
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
299299
<see selector="{{CheckoutSuccessMainSection.success}}" userInput="{{orderNumberMessage}}" stepKey="seeOrderNumber"/>
300300
<see selector="{{CheckoutSuccessMainSection.success}}" userInput="{{emailYouMessage}}" stepKey="seeEmailYou"/>

app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -136,67 +136,76 @@
136136
</section>
137137

138138
<script>
139-
require(['jquery', 'prototype'], function(jQuery){
139+
require(['jquery'], function(jQuery){
140140

141141
//<![CDATA[
142-
var submitButtons = $$('.submit-button');
143-
var updateButtons = $$('.update-button');
144-
var fields = $$('.qty-input');
142+
var submitButtons = jQuery('.submit-button');
143+
var updateButtons = jQuery('.update-button');
144+
var fields = jQuery('.qty-input');
145145

146-
updateButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
146+
function enableButtons(buttons) {
147+
buttons.removeClass('disabled').prop('disabled', false);
148+
}
147149

148-
for(var i=0;i<fields.length;i++){
149-
fields[i].observe('change', checkButtonsRelation)
150-
fields[i].baseValue = fields[i].value;
150+
function disableButtons(buttons) {
151+
buttons.addClass('disabled').prop('disabled', true);
151152
}
152153

154+
disableButtons(updateButtons);
155+
156+
fields.on('change', checkButtonsRelation);
157+
fields.each(function (i, elem) {
158+
elem.baseValue = elem.value;
159+
});
160+
153161
function checkButtonsRelation() {
154162
var hasChanges = false;
155-
fields.each(function (elem) {
163+
fields.each(function (i, elem) {
156164
if (elem.baseValue != elem.value) {
157165
hasChanges = true;
158166
}
159167
}.bind(this));
160168
if (hasChanges) {
161-
submitButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
162-
updateButtons.each(function (elem) {elem.disabled=false;elem.removeClassName('disabled');});
169+
disableButtons(submitButtons);
170+
enableButtons(updateButtons);
163171
}
164172
else {
165-
submitButtons.each(function (elem) {elem.disabled=false;elem.removeClassName('disabled');});
166-
updateButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
173+
enableButtons(submitButtons);
174+
disableButtons(updateButtons);
167175
}
168176
}
169177

170178
submitCreditMemo = function() {
171-
if ($('creditmemo_do_offline')) $('creditmemo_do_offline').value=0;
179+
var creditMemoOffline = jQuery('#creditmemo_do_offline');
180+
if (creditMemoOffline.length) {
181+
creditMemoOffline.prop('value', 0);
182+
}
172183
// Temporary solution will be replaced after refactoring order functionality
173184
jQuery('#edit_form').triggerHandler('save');
174-
}
185+
};
175186

176187
submitCreditMemoOffline = function() {
177-
if ($('creditmemo_do_offline')) $('creditmemo_do_offline').value=1;
188+
var creditMemoOffline = jQuery('#creditmemo_do_offline');
189+
if (creditMemoOffline.length) {
190+
creditMemoOffline.prop('value', 1);
191+
}
178192
// Temporary solution will be replaced after refactoring order functionality
179193
jQuery('#edit_form').triggerHandler('save');
180-
}
181-
182-
var sendEmailCheckbox = $('send_email');
194+
};
183195

184-
if (sendEmailCheckbox) {
185-
var notifyCustomerCheckbox = $('notify_customer');
186-
var creditmemoCommentText = $('creditmemo_comment_text');
187-
Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
196+
var sendEmailCheckbox = jQuery('#send_email');
197+
if (sendEmailCheckbox.length) {
198+
var notifyCustomerCheckbox = jQuery('#notify_customer');
199+
sendEmailCheckbox.on('change', bindSendEmail);
188200
bindSendEmail();
189201
}
190202

191-
function bindSendEmail()
192-
{
193-
if (sendEmailCheckbox.checked == true) {
194-
notifyCustomerCheckbox.disabled = false;
195-
//creditmemoCommentText.disabled = false;
203+
function bindSendEmail() {
204+
if (sendEmailCheckbox.prop('checked') == true) {
205+
notifyCustomerCheckbox.prop('disabled', false);
196206
}
197207
else {
198-
notifyCustomerCheckbox.disabled = true;
199-
//creditmemoCommentText.disabled = true;
208+
notifyCustomerCheckbox.prop('disabled', true);
200209
}
201210
}
202211

app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -134,56 +134,61 @@
134134
</section>
135135

136136
<script>
137-
require(['jquery', 'prototype'], function(jQuery){
137+
require(['jquery'], function(jQuery){
138138

139139
//<![CDATA[
140-
var submitButtons = $$('.submit-button');
141-
var updateButtons = $$('.update-button');
140+
var submitButtons = jQuery('.submit-button');
141+
var updateButtons = jQuery('.update-button');
142142
var enableSubmitButtons = <?= (int) !$block->getDisableSubmitButton() ?>;
143-
var fields = $$('.qty-input');
143+
var fields = jQuery('.qty-input');
144144

145-
updateButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
145+
function enableButtons(buttons) {
146+
buttons.removeClass('disabled').prop('disabled', false);
147+
}
146148

147-
for(var i=0;i<fields.length;i++){
148-
jQuery(fields[i]).on('keyup', checkButtonsRelation);
149-
fields[i].baseValue = fields[i].value;
149+
function disableButtons(buttons) {
150+
buttons.addClass('disabled').prop('disabled', true);
150151
}
151152

153+
disableButtons(updateButtons);
154+
155+
fields.on('keyup', checkButtonsRelation);
156+
fields.each(function (i, elem) {
157+
elem.baseValue = elem.value;
158+
});
159+
152160
function checkButtonsRelation() {
153161
var hasChanges = false;
154-
fields.each(function (elem) {
162+
fields.each(function (i, elem) {
155163
if (elem.baseValue != elem.value) {
156164
hasChanges = true;
157165
}
158166
}.bind(this));
159167
if (hasChanges) {
160-
submitButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
161-
updateButtons.each(function (elem) {elem.disabled=false;elem.removeClassName('disabled');});
168+
disableButtons(submitButtons);
169+
enableButtons(updateButtons);
162170
}
163171
else {
164172
if (enableSubmitButtons) {
165-
submitButtons.each(function (elem) {elem.disabled=false;elem.removeClassName('disabled');});
173+
enableButtons(submitButtons);
166174
}
167-
updateButtons.each(function (elem) {elem.disabled=true;elem.addClassName('disabled');});
175+
disableButtons(updateButtons);
168176
}
169177
}
170178

171-
var sendEmailCheckbox = $('send_email');
172-
if (sendEmailCheckbox) {
173-
var notifyCustomerCheckbox = $('notify_customer');
174-
var invoiceCommentText = $('invoice_comment_text');
175-
Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
179+
var sendEmailCheckbox = jQuery('#send_email');
180+
if (sendEmailCheckbox.length) {
181+
var notifyCustomerCheckbox = jQuery('#notify_customer');
182+
sendEmailCheckbox.on('change', bindSendEmail);
176183
bindSendEmail();
177184
}
178185
function bindSendEmail()
179186
{
180-
if (sendEmailCheckbox.checked == true) {
181-
notifyCustomerCheckbox.disabled = false;
182-
//invoiceCommentText.disabled = false;
187+
if (sendEmailCheckbox.prop('checked') == true) {
188+
notifyCustomerCheckbox.prop('disabled', false);
183189
}
184190
else {
185-
notifyCustomerCheckbox.disabled = true;
186-
//invoiceCommentText.disabled = true;
191+
notifyCustomerCheckbox.prop('disabled', true);
187192
}
188193
}
189194

0 commit comments

Comments
 (0)