Skip to content

Commit e62a6f5

Browse files
ENGCOM-4775: Can't scroll in modal popup on i os #21150
- Merge Pull Request #21150 from priti2jcommerce/magento2:Can't-scroll-in-modal-popup-on-iOS - Merged commits: 1. d661d61 2. 85026a4
2 parents 2b58566 + 85026a4 commit e62a6f5

File tree

62 files changed

+1034
-691
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1034
-691
lines changed

app/code/Magento/AuthorizenetAcceptjs/Gateway/Validator/TransactionResponseValidator.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ public function validate(array $validationSubject): ResultInterface
5454
if (isset($transactionResponse['messages']['message']['code'])) {
5555
$errorCodes[] = $transactionResponse['messages']['message']['code'];
5656
$errorMessages[] = $transactionResponse['messages']['message']['text'];
57-
} elseif ($transactionResponse['messages']['message']) {
57+
} elseif (isset($transactionResponse['messages']['message'])) {
5858
foreach ($transactionResponse['messages']['message'] as $message) {
5959
$errorCodes[] = $message['code'];
6060
$errorMessages[] = $message['description'];
6161
}
6262
} elseif (isset($transactionResponse['errors'])) {
6363
foreach ($transactionResponse['errors'] as $message) {
6464
$errorCodes[] = $message['errorCode'];
65-
$errorMessages[] = $message['errorCode'];
65+
$errorMessages[] = $message['errorText'];
6666
}
6767
}
6868

@@ -85,8 +85,10 @@ private function isResponseCodeAnError(array $transactionResponse): bool
8585
?? $transactionResponse['errors'][0]['errorCode']
8686
?? null;
8787

88-
return in_array($transactionResponse['responseCode'], [self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_HELD])
89-
&& $code
88+
return !in_array($transactionResponse['responseCode'], [
89+
self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_HELD
90+
])
91+
|| $code
9092
&& !in_array(
9193
$code,
9294
[

app/code/Magento/AuthorizenetAcceptjs/Test/Unit/Gateway/Validator/TransactionResponseValidatorTest.php

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@
1515
use PHPUnit\Framework\MockObject\MockObject;
1616
use PHPUnit\Framework\TestCase;
1717

18+
/**
19+
* Tests for the transaction response validator
20+
*/
1821
class TransactionResponseValidatorTest extends TestCase
1922
{
2023
private const RESPONSE_CODE_APPROVED = 1;
2124
private const RESPONSE_CODE_HELD = 4;
25+
private const RESPONSE_CODE_DENIED = 2;
2226
private const RESPONSE_REASON_CODE_APPROVED = 1;
2327
private const RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED = 252;
2428
private const RESPONSE_REASON_CODE_PENDING_REVIEW = 253;
29+
private const ERROR_CODE_AVS_MISMATCH = 27;
2530

2631
/**
2732
* @var ResultInterfaceFactory|MockObject
@@ -86,16 +91,6 @@ public function testValidateScenarios($transactionResponse, $isValid, $errorCode
8691
public function scenarioProvider()
8792
{
8893
return [
89-
// This validator only cares about successful edge cases so test for default behavior
90-
[
91-
[
92-
'responseCode' => 'foo',
93-
],
94-
true,
95-
[],
96-
[]
97-
],
98-
9994
// Test for acceptable reason codes
10095
[
10196
[
@@ -208,6 +203,29 @@ public function scenarioProvider()
208203
['foo'],
209204
['bar']
210205
],
206+
[
207+
[
208+
'responseCode' => self::RESPONSE_CODE_DENIED,
209+
'errors' => [
210+
[
211+
'errorCode' => self::ERROR_CODE_AVS_MISMATCH,
212+
'errorText' => 'bar'
213+
]
214+
]
215+
],
216+
false,
217+
[self::ERROR_CODE_AVS_MISMATCH],
218+
['bar']
219+
],
220+
// This validator only cares about successful edge cases so test for default behavior
221+
[
222+
[
223+
'responseCode' => 'foo',
224+
],
225+
false,
226+
[],
227+
[]
228+
],
211229
];
212230
}
213231
}

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public function __construct(
114114
\Magento\Backend\Helper\Dashboard\Data $dashboardData,
115115
array $data = []
116116
) {
117-
$this->_dashboardData = $dashboardData;
118117
parent::__construct($context, $collectionFactory, $data);
118+
$this->_dashboardData = $dashboardData;
119119
}
120120

121121
/**
@@ -131,7 +131,7 @@ protected function _getTabTemplate()
131131
/**
132132
* Set data rows
133133
*
134-
* @param array $rows
134+
* @param string $rows
135135
* @return void
136136
*/
137137
public function setDataRows($rows)
@@ -155,15 +155,14 @@ public function addSeries($seriesId, array $options)
155155
* Get series
156156
*
157157
* @param string $seriesId
158-
* @return array|false
158+
* @return array|bool
159159
*/
160160
public function getSeries($seriesId)
161161
{
162162
if (isset($this->_allSeries[$seriesId])) {
163163
return $this->_allSeries[$seriesId];
164-
} else {
165-
return false;
166164
}
165+
return false;
167166
}
168167

169168
/**
@@ -308,7 +307,7 @@ public function getChartUrl($directUrl = true)
308307

309308
if ($minvalue >= 0 && $maxvalue >= 0) {
310309
if ($maxvalue > 10) {
311-
$p = pow(10, $this->_getPow($maxvalue));
310+
$p = pow(10, $this->_getPow((int) $maxvalue));
312311
$maxy = ceil($maxvalue / $p) * $p;
313312
$yLabels = range($miny, $maxy, $p);
314313
} else {
@@ -349,7 +348,7 @@ public function getChartUrl($directUrl = true)
349348
$indexid = 0;
350349
foreach ($this->_axisLabels as $idx => $labels) {
351350
if ($idx == 'x') {
352-
$this->formatAxisLabelDate($idx, $timezoneLocal);
351+
$this->formatAxisLabelDate((string) $idx, (string) $timezoneLocal);
353352
$tmpstring = implode('|', $this->_axisLabels[$idx]);
354353
$valueBuffer[] = $indexid . ":|" . $tmpstring;
355354
} elseif ($idx == 'y') {
@@ -369,13 +368,12 @@ public function getChartUrl($directUrl = true)
369368
foreach ($params as $name => $value) {
370369
$p[] = $name . '=' . urlencode($value);
371370
}
372-
return self::API_URL . '?' . implode('&', $p);
373-
} else {
374-
$gaData = urlencode(base64_encode(json_encode($params)));
375-
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
376-
$params = ['ga' => $gaData, 'h' => $gaHash];
377-
return $this->getUrl('adminhtml/*/tunnel', ['_query' => $params]);
371+
return (string) self::API_URL . '?' . implode('&', $p);
378372
}
373+
$gaData = urlencode(base64_encode(json_encode($params)));
374+
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
375+
$params = ['ga' => $gaData, 'h' => $gaHash];
376+
return $this->getUrl('adminhtml/*/tunnel', ['_query' => $params]);
379377
}
380378

381379
/**
@@ -394,7 +392,7 @@ private function formatAxisLabelDate($idx, $timezoneLocal)
394392
switch ($this->getDataHelper()->getParam('period')) {
395393
case '24h':
396394
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
397-
$period->setTime($period->format('H'), 0, 0),
395+
$period->setTime((int) $period->format('H'), 0, 0),
398396
\IntlDateFormatter::NONE,
399397
\IntlDateFormatter::SHORT
400398
);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminDashboardSection">
12+
<element name="dashboardDiagramContent" type="button" selector="#diagram_tab_content"/>
13+
<element name="dashboardDiagramOrderContentTab" type="block" selector="#diagram_tab_orders_content"/>
14+
<element name="dashboardDiagramAmounts" type="button" selector="#diagram_tab_amounts"/>
15+
<element name="dashboardDiagramAmountsContentTab" type="block" selector="#diagram_tab_amounts_content"/>
16+
<element name="dashboardDiagramTotals" type="text" selector="#diagram_tab_amounts_content"/>
17+
<element name="dashboardTotals" type="text" selector="//*[@class='dashboard-totals-label' and contains(text(), '{{columnName}}')]/../*[@class='dashboard-totals-value']" parameterized="true"/>
18+
</section>
19+
</sections>
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminDashboardWithChartsTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<title value="Google chart on Magento dashboard"/>
15+
<description value="Google chart on Magento dashboard page is not broken"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-98934"/>
18+
<useCaseId value="MAGETWO-98584"/>
19+
<group value="backend"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set admin/dashboard/enable_charts 1" stepKey="setEnableCharts" />
23+
<createData entity="SimpleProduct2" stepKey="createProduct">
24+
<field key="price">150</field>
25+
</createData>
26+
<createData entity="Simple_US_Customer" stepKey="createCustomer">
27+
<field key="firstname">John1</field>
28+
<field key="lastname">Doe1</field>
29+
</createData>
30+
</before>
31+
<after>
32+
<!-- Reset admin order filter -->
33+
<comment userInput="Reset admin order filter" stepKey="resetAdminOrderFilter"/>
34+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/>
35+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingOrderGrid"/>
36+
<magentoCLI command="config:set admin/dashboard/enable_charts 0" stepKey="setDisableChartsAsDefault" />
37+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
38+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
39+
<actionGroup ref="logout" stepKey="logout"/>
40+
</after>
41+
<!-- Login as admin -->
42+
<comment userInput="Login as admin" stepKey="adminLogin"/>
43+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
44+
<!-- Grab quantity value -->
45+
<comment userInput="Grab quantity value from dashboard" stepKey="grabQuantityFromDashboard"/>
46+
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabStartQuantity"/>
47+
<!-- Login as customer -->
48+
<comment userInput="Login as customer" stepKey="loginAsCustomer"/>
49+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
50+
<argument name="Customer" value="$$createCustomer$$" />
51+
</actionGroup>
52+
<!-- Add Product to Shopping Cart-->
53+
<comment userInput="Add product to the shopping cart" stepKey="addProductToCart"/>
54+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/>
55+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
56+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
57+
<argument name="productName" value="$$createProduct.name$$"/>
58+
</actionGroup>
59+
<!--Go to Checkout-->
60+
<comment userInput="Go to checkout" stepKey="goToCheckout"/>
61+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
62+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingCheckoutPageWithShippingMethod"/>
63+
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
64+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/>
65+
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
66+
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
67+
<!-- Checkout select Check/Money Order payment -->
68+
<comment userInput="Select Check/Money payment" stepKey="checkoutSelectCheckMoneyPayment"/>
69+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
70+
<!-- Place Order -->
71+
<comment userInput="Place order" stepKey="placeOrder"/>
72+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
73+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
74+
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order number is: " stepKey="seeOrderNumber"/>
75+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
76+
<!-- Search for Order in the order grid -->
77+
<comment userInput="Search for Order in the order grid" stepKey="searchOrderInGrid"/>
78+
<actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById">
79+
<argument name="orderId" value="$grabOrderNumber"/>
80+
</actionGroup>
81+
<waitForLoadingMaskToDisappear stepKey="waitForSearchingOrder"/>
82+
<!-- Create invoice -->
83+
<comment userInput="Create invoice" stepKey="createInvoice"/>
84+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
85+
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/>
86+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/>
87+
<see selector="{{AdminInvoiceTotalSection.total('Subtotal')}}" userInput="$150.00" stepKey="seeCorrectGrandTotal"/>
88+
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
89+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessInvoiceMessage"/>
90+
<!--Create Shipment for the order-->
91+
<comment userInput="Create Shipment for the order" stepKey="createShipmentForOrder"/>
92+
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage2"/>
93+
<waitForPageLoad time="30" stepKey="waitForOrderListPageLoading"/>
94+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="openOrderPageForShip"/>
95+
<waitForPageLoad stepKey="waitForOrderDetailsPage"/>
96+
<click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/>
97+
<waitForPageLoad stepKey="waitForShipmentPagePage"/>
98+
<seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/>
99+
<!--Submit Shipment-->
100+
<comment userInput="Submit Shipment" stepKey="submitShipment"/>
101+
<click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/>
102+
<waitForPageLoad stepKey="waitForShipmentSubmit"/>
103+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created." stepKey="seeShipmentCreateSuccess"/>
104+
<!-- Go to dashboard page -->
105+
<comment userInput="Go to dashboard page" stepKey="goToDashboardPage"/>
106+
<amOnPage url="{{AdminDashboardPage.url}}" stepKey="amOnDashboardPage"/>
107+
<waitForPageLoad stepKey="waitForDashboardPageLoad4"/>
108+
<!-- Grab quantity value -->
109+
<comment userInput="Grab quantity value from dashboard at the end" stepKey="grabQuantityFromDashboardAtTheEnd"/>
110+
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabEndQuantity"/>
111+
<!-- Assert that page is not broken -->
112+
<comment userInput="Assert that dashboard page is not broken" stepKey="assertDashboardPageIsNotBroken"/>
113+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramOrderContentTab}}" stepKey="seeOrderContentTab"/>
114+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramContent}}" stepKey="seeDiagramContent"/>
115+
<click selector="{{AdminDashboardSection.dashboardDiagramAmounts}}" stepKey="clickDashboardAmount"/>
116+
<waitForLoadingMaskToDisappear stepKey="waitForDashboardAmountLoading"/>
117+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramAmountsContentTab}}" stepKey="seeDiagramAmountContent"/>
118+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramTotals}}" stepKey="seeAmountTotals"/>
119+
<dontSeeJsError stepKey="dontSeeJsError"/>
120+
<assertGreaterThan expected="$grabStartQuantity" actual="$grabEndQuantity" stepKey="checkQuantityWasChanged"/>
121+
</test>
122+
</tests>

app/code/Magento/Backup/etc/adminhtml/system.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@
2626
<label>Scheduled Backup Type</label>
2727
<depends>
2828
<field id="enabled">1</field>
29+
<field id="functionality_enabled">1</field>
2930
</depends>
3031
<source_model>Magento\Backup\Model\Config\Source\Type</source_model>
3132
</field>
3233
<field id="time" translate="label" type="time" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
3334
<label>Start Time</label>
3435
<depends>
3536
<field id="enabled">1</field>
37+
<field id="functionality_enabled">1</field>
3638
</depends>
3739
</field>
3840
<field id="frequency" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
3941
<label>Frequency</label>
4042
<depends>
4143
<field id="enabled">1</field>
44+
<field id="functionality_enabled">1</field>
4245
</depends>
4346
<source_model>Magento\Cron\Model\Config\Source\Frequency</source_model>
4447
<backend_model>Magento\Backup\Model\Config\Backend\Cron</backend_model>
@@ -48,6 +51,7 @@
4851
<comment>Please put your store into maintenance mode during backup.</comment>
4952
<depends>
5053
<field id="enabled">1</field>
54+
<field id="functionality_enabled">1</field>
5155
</depends>
5256
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
5357
</field>

0 commit comments

Comments
 (0)