Skip to content

Commit e1af801

Browse files
committed
MC-5723: Flaky MFTF Map Tests - Google Maps Rate Limit Reached
- Fix API key validator in system config
1 parent 017520f commit e1af801

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

app/code/Magento/PageBuilder/Controller/Adminhtml/GoogleMaps/ValidateApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(
3939
*/
4040
public function execute()
4141
{
42-
$apiKey = $this->getRequest()->getParam('key');
42+
$apiKey = $this->getRequest()->getParam('googleMapsApiKey');
4343
$validationResult = $this->apiKeyValidator->validate($apiKey);
4444
return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($validationResult);
4545
}

app/code/Magento/PageBuilder/view/adminhtml/web/js/system/config/google-maps-api-key-validator.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
define(['jquery'], function($) {
6+
define(['jquery'], function ($) {
77
'use strict';
88

99
/**
@@ -12,7 +12,7 @@ define(['jquery'], function($) {
1212
* @param {Object} config
1313
* @param {HTMLElement} el
1414
*/
15-
var GoogleMapsApiKeyValidator = function(config, el) {
15+
var GoogleMapsApiKeyValidator = function (config, el) {
1616
var sourceElement = $('#' + config.sourceField),
1717
initialValue = sourceElement.val(),
1818
resultElement = $('#' + config.elementId + ' > .result');
@@ -21,16 +21,18 @@ define(['jquery'], function($) {
2121
$(el).attr('disabled', false);
2222
}
2323

24-
$(el).click(function() {
24+
$(el).click(function () {
2525
var resultText = config.invalidLabel,
2626
resultIcon = 'icon-admin-pagebuilder-error',
2727
resultHtml;
2828

2929
$.ajax({
3030
url: config.validateUrl,
3131
showLoader: true,
32-
data: { key: sourceElement.val() }
33-
}).done(function(data) {
32+
data: {
33+
googleMapsApiKey: sourceElement.val()
34+
}
35+
}).done(function (data) {
3436
if (data.success) {
3537
resultText = config.validLabel;
3638
resultIcon = 'icon-admin-pagebuilder-success';
@@ -47,7 +49,7 @@ define(['jquery'], function($) {
4749

4850
$(el).attr('disabled', !elementValue);
4951
resultElement.html(buttonText);
50-
})
52+
});
5153
};
5254

5355
return GoogleMapsApiKeyValidator;

0 commit comments

Comments
 (0)