Skip to content

Commit eb6e88c

Browse files
author
Gabriel da Gama
authored
Merge branch '2.4-develop' into optimize-authentication-popup
2 parents c005370 + a73f570 commit eb6e88c

File tree

16 files changed

+727
-1889
lines changed

16 files changed

+727
-1889
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminProductFormAdvancedPricingAddTierPriceActionGroup" extends="AdminProductFormAdvancedPricingAddTierPriceActionGroup">
12+
<annotations>
13+
<description>Check tier price on Advanced Pricing dialog on the Admin Product creation/edit page.</description>
14+
</annotations>
15+
<remove keyForRemoval="selectWebsite"/>
16+
<remove keyForRemoval="selectCustomerGroup"/>
17+
<remove keyForRemoval="fillQuantity"/>
18+
<remove keyForRemoval="selectPriceType"/>
19+
<remove keyForRemoval="fillPriceAmount"/>
20+
<remove keyForRemoval="waitCustomerGroupFilterAppears"/>
21+
<remove keyForRemoval="selectCustomerGroupValue"/>
22+
<executeJS function="return window.getComputedStyle(document.querySelector(&quot;{$priceAmountSelector}&quot;)).getPropertyValue('min-width')" after="waitPriceAmountFieldAppers" stepKey="priceMinWidth"/>
23+
<assertEquals after="priceMinWidth" stepKey="assertWebsiteAmounts">
24+
<actualResult type="string">$priceMinWidth</actualResult>
25+
<expectedResult type="string">60px</expectedResult>
26+
</assertEquals>
27+
<click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceDeleteButton}}" after="assertWebsiteAmounts" stepKey="clickCustomerGroupPriceDeleteButton"/>
28+
</actionGroup>
29+
</actionGroups>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontRemoveFirstProductFromCompareActionGroup">
12+
<annotations>
13+
<description>Open Compare Products list and remove a product</description>
14+
</annotations>
15+
16+
<amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/>
17+
<waitForElementVisible selector="{{StorefrontProductCompareMainSection.removeFirstItem}}" stepKey="waitForButton"/>
18+
<click selector="{{StorefrontProductCompareMainSection.removeFirstItem}}" stepKey="clickOnButton"/>
19+
<waitForElementVisible selector="{{ModalConfirmationSection.OkButton}}" stepKey="waitForModal"/>
20+
<scrollTo selector="{{ModalConfirmationSection.OkButton}}" stepKey="scrollToModal"/>
21+
<click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOkButton"/>
22+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
23+
</actionGroup>
24+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="ProductPriceByName" type="text" selector="//*[@id='product-comparison']//td[.//strong[@class='product-item-name']/a[contains(text(), '{{var1}}')]]//span[@class='price']" parameterized="true"/>
1515
<element name="ProductImageByName" type="text" selector="//*[@id='product-comparison']//td[.//strong[@class='product-item-name']/a[contains(text(), '{{var1}}')]]//img[@class='product-image-photo']" parameterized="true"/>
1616
<element name="ProductAttributeByCodeAndProductName" type="text" selector="//*[@id='product-comparison']//tr[.//th[./span[contains(text(), '{{var1}}')]]]//td[count(//*[@id='product-comparison']//tr//td[.//strong[@class='product-item-name']/a[contains(text(), '{{var2}}')]]/preceding-sibling::td)+1]/div" parameterized="true"/>
17+
<element name="removeFirstItem" type="button" selector="table.table-comparison a.delete"/>
1718
</section>
1819
</sections>

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@
7878
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPage">
7979
<argument name="categoryName" value="$$category.name$$"/>
8080
</actionGroup>
81-
82-
<actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage"/>
81+
<comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="navigateToComparePage"/>
8382
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductComparePageLoad"/>
8483

8584
<actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductInCompareList">
@@ -92,11 +91,13 @@
9291
<argument name="categoryName" value="$$category.name$$"/>
9392
</actionGroup>
9493

95-
<actionGroup ref="StorefrontClearCompareActionGroup" stepKey="clickClearAll"/>
94+
<actionGroup ref="StorefrontRemoveFirstProductFromCompareActionGroup" stepKey="clickClearAll"/>
9695
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmPageLoad"/>
9796
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="confirmProdDelate"/>
9897
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmLoad"/>
99-
<comment userInput="Add product to compare list fom Category page | Comment is kept to preserve the step key for backward compatibility" stepKey="addToCmpFromCategPage"/>
98+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="addToCmpFromCategPage">
99+
<argument name="categoryName" value="$$category.name$$"/>
100+
</actionGroup>
100101

101102
<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverOverProduct"/>
102103

@@ -108,11 +109,11 @@
108109
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="grabTextFromSuccessMessage2"/>
109110
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertSuccessMessage2"/>
110111

111-
<comment userInput="Check that product displays on add to compare widget | Comment is kept to preserve the step key for backward compatibility" stepKey="checkProdNameOnWidget"/>
112-
<seeElement selector="{{StorefrontComparisonSidebarSection.ProductTitleByName($$product.name$$)}}" stepKey="seeProdNameOnCmpWidget"/>
112+
<comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="checkProdNameOnWidget"/>
113+
<comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="seeProdNameOnCmpWidget"/>
113114

114115
<comment userInput="See product in the compare page" stepKey="seeProductInComparePage"/>
115-
<actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage2"/>
116+
<comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="navigateToComparePage2"/>
116117
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductComparePageLoad2"/>
117118

118119
<actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductInCompareList2">

app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest/AdminApplyTierPriceToProductWithPercentageDiscountTest.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/>
3333
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
3434
</after>
35-
35+
3636
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="loginAsAdmin"/>
3737
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct">
3838
<argument name="product" value="$$createSimpleProduct$$"/>
@@ -41,6 +41,10 @@
4141
<argument name="product" value="$$createSimpleProduct$$"/>
4242
</actionGroup>
4343

44+
<actionGroup ref="AdminProductFormOpenAdvancedPricingDialogActionGroup" stepKey="clickOnAdvancedPricingButtonForAssert"/>
45+
<actionGroup ref="AssertAdminProductFormAdvancedPricingAddTierPriceActionGroup" stepKey="assertProductTierPriceInput"/>
46+
<actionGroup ref="AdminProductFormDoneAdvancedPricingDialogActionGroup" stepKey="doneButtonAfterAssert"/>
47+
4448
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="scrollToTopOfPage"/>
4549
<actionGroup ref="AdminProductFormOpenAdvancedPricingDialogActionGroup" stepKey="clickOnAdvancedPricingButton"/>
4650
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCustomerGroupPriceAddButton"/>

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<element name="viewDropdown" type="button" selector=".admin__data-grid-action-bookmarks button.admin__action-dropdown"/>
2020
<element name="viewBookmark" type="button" selector="//div[contains(@class, 'admin__data-grid-action-bookmarks')]/ul/li/div/a[text() = '{{label}}']" parameterized="true" timeout="30"/>
2121
<element name="countryOptions" type="button" selector=".admin__data-grid-filters select[name=billing_country_id] option"/>
22+
<element name="websiteOptions" type="button" selector=".admin__data-grid-filters select[name=website_id] option"/>
2223
</section>
2324
</sections>

app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
</column>
190190
<column name="website_id" class="Magento\Customer\Ui\Component\Listing\Column\Websites" component="Magento_Ui/js/grid/columns/select" sortOrder="110">
191191
<settings>
192+
<options class="Magento\Store\Model\ResourceModel\Website\Collection"/>
192193
<filter>select</filter>
193194
<editor>
194195
<editorType>select</editorType>

app/code/Magento/GraphQl/Controller/HttpRequestValidator/HttpVerbValidator.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,25 @@ public function validate(HttpRequestInterface $request) : void
3131
/** @var Http $request */
3232
if (false === $request->isPost()) {
3333
$query = $request->getParam('query', '');
34-
$operationType = null;
35-
$queryAst = \GraphQL\Language\Parser::parse(new \GraphQL\Language\Source($query ?: '', 'GraphQL'));
36-
\GraphQL\Language\Visitor::visit(
37-
$queryAst,
38-
[
39-
'leave' => [
40-
NodeKind::OPERATION_DEFINITION => function (Node $node) use (&$operationType) {
41-
$operationType = $node->operation;
42-
}
34+
if (!empty($query)) {
35+
$operationType = null;
36+
$queryAst = \GraphQL\Language\Parser::parse(new \GraphQL\Language\Source($query ?: '', 'GraphQL'));
37+
\GraphQL\Language\Visitor::visit(
38+
$queryAst,
39+
[
40+
'leave' => [
41+
NodeKind::OPERATION_DEFINITION => function (Node $node) use (&$operationType) {
42+
$operationType = $node->operation;
43+
}
44+
]
4345
]
44-
]
45-
);
46-
47-
if (strtolower($operationType) === 'mutation') {
48-
throw new GraphQlInputException(
49-
new \Magento\Framework\Phrase('Mutation requests allowed only for POST requests')
5046
);
47+
48+
if (strtolower($operationType) === 'mutation') {
49+
throw new GraphQlInputException(
50+
new \Magento\Framework\Phrase('Mutation requests allowed only for POST requests')
51+
);
52+
}
5153
}
5254
}
5355
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\GraphQl\Test\Unit\Controller\HttpRequestValidator;
9+
10+
use Magento\Framework\App\HttpRequestInterface;
11+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
12+
use Magento\GraphQl\Controller\HttpRequestValidator\HttpVerbValidator;
13+
use PHPUnit\Framework\MockObject\MockObject;
14+
use PHPUnit\Framework\TestCase;
15+
16+
/**
17+
* Test HttpVerbValidator
18+
*/
19+
class HttpVerbValidatorTest extends TestCase
20+
{
21+
/**
22+
* @var HttpVerbValidator|MockObject
23+
*/
24+
private $httpVerbValidator;
25+
26+
/**
27+
* @var HttpRequestInterface|MockObject
28+
*/
29+
private $requestMock;
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
protected function setup(): void
35+
{
36+
$objectManager = new ObjectManager($this);
37+
$this->requestMock = $this->getMockBuilder(HttpRequestInterface::class)
38+
->disableOriginalConstructor()
39+
->onlyMethods(
40+
[
41+
'isPost',
42+
]
43+
)->addMethods(
44+
[
45+
'getParam',
46+
]
47+
)
48+
->getMockForAbstractClass();
49+
50+
$this->httpVerbValidator = $objectManager->getObject(
51+
HttpVerbValidator::class
52+
);
53+
}
54+
55+
/**
56+
* Test for validate method
57+
*
58+
* @param string $query
59+
* @param bool $needException
60+
* @dataProvider validateDataProvider
61+
*/
62+
public function testValidate(string $query, bool $needException): void
63+
{
64+
$this->requestMock
65+
->expects($this->once())
66+
->method('isPost')
67+
->willReturn(false);
68+
69+
$this->requestMock
70+
->method('getParam')
71+
->with('query', '')
72+
->willReturn($query);
73+
74+
if ($needException) {
75+
$this->expectExceptionMessage('Syntax Error: Unexpected <EOF>');
76+
}
77+
78+
$this->httpVerbValidator->validate($this->requestMock);
79+
}
80+
81+
/**
82+
* @return array
83+
*/
84+
public function validateDataProvider(): array
85+
{
86+
return [
87+
[
88+
'query' => '',
89+
'needException' => false,
90+
],
91+
[
92+
'query' => ' ',
93+
'needException' => true
94+
],
95+
];
96+
}
97+
}

app/code/Magento/ProductVideo/Test/Mftf/ActionGroup/AssertProductVideoNavigationArrowsActionGroup.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</arguments>
1919

2020
<dontSeeElement selector="{{StorefrontProductMediaSection.imagePrevButton}}" stepKey="dontSeePrevButton"/>
21-
<moveMouseOver selector="{{StorefrontProductMediaSection.mainImageForJsActions}}" stepKey="hoverOverImage"/>
21+
<moveMouseOver selector="{{StorefrontProductInfoMainSection.clickPlayVideo}}" stepKey="hoverOverImage"/>
2222
<waitForElementVisible selector="{{StorefrontProductMediaSection.imageNextButton}}" stepKey="seeNextButton"/>
2323
<click selector="{{StorefrontProductMediaSection.imageNextButton}}" stepKey="clickNextButton"/>
2424
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productVideo(videoType)}}" stepKey="seeProductVideoDataType"/>
@@ -38,7 +38,7 @@
3838
<moveMouseOver selector="{{StorefrontCMSPageSection.mainTitle}}" stepKey="unFocusVideo"/>
3939
<waitForElement selector="{{StorefrontProductMediaSection.galleryNoControlsElement}}" stepKey="waitForVideoUnFocus"/>
4040

41-
<moveMouseOver selector="{{StorefrontProductMediaSection.mainImageForJsActions}}" stepKey="hoverOverImageSecond"/>
41+
<moveMouseOver selector="{{StorefrontProductInfoMainSection.clickPlayVideo}}" stepKey="hoverOverImageSecond"/>
4242
<waitForElementVisible selector="{{StorefrontProductMediaSection.imagePrevButton}}" stepKey="seePrevButton"/>
4343
<click selector="{{StorefrontProductMediaSection.imagePrevButton}}" stepKey="clickPrevButton"/>
4444
</actionGroup>

0 commit comments

Comments
 (0)