From 87b3b7e819dc044052b1bfe51ca7799bd0718a9e Mon Sep 17 00:00:00 2001 From: Viktor Sevch Date: Tue, 23 Feb 2021 13:43:31 +0200 Subject: [PATCH 1/8] MC-39338: Improve image upload --- .../Adminhtml/Product/Gallery/Upload.php | 4 +++- .../Adminhtml/Product/Gallery/UploadTest.php | 17 +++++++++++++++-- .../Magento/Catalog/_files/magento_wrong.png | Bin 0 -> 462 bytes 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/magento_wrong.png diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php index d43b313c43b3e..5dabd48782b73 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php @@ -108,8 +108,10 @@ public function execute() $result['url'] = $this->productMediaConfig->getTmpMediaUrl($result['file']); $result['file'] = $result['file'] . '.tmp'; - } catch (\Exception $e) { + } catch (LocalizedException $e) { $result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()]; + } catch (\Throwable $e) { + $result = ['error' => 'Something went wrong while saving the file(s).', 'errorcode' => 0]; } /** @var \Magento\Framework\Controller\Result\Raw $response */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Gallery/UploadTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Gallery/UploadTest.php index 283a3834eab59..b2494ba2ecb8a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Gallery/UploadTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Gallery/UploadTest.php @@ -198,7 +198,7 @@ public function uploadActionWithErrorsDataProvider(): array 'current_path' => '/../../../../_files', ], 'expectation' => [ - 'message' => 'Wrong file size.', + 'message' => 'Something went wrong while saving the file(s).', 'errorcode' => 0, 'tmp_media_path' => '/m/a/magento_empty.jpg', ], @@ -206,10 +206,23 @@ public function uploadActionWithErrorsDataProvider(): array 'upload_without_image' => [ 'file' => [], 'expectation' => [ - 'message' => '$_FILES array is empty', + 'message' => 'Something went wrong while saving the file(s).', 'errorcode' => 0, ], ], + 'upload_wrong_png' => [ + 'file' => [ + 'copy_file' => true, + 'name' => 'magento_wrong.png', + 'type' => 'image/png', + 'current_path' => '/../../../../_files', + ], + 'expectation' => [ + 'message' => 'Something went wrong while saving the file(s).', + 'errorcode' => 0, + 'tmp_media_path' => '/m/w/magento_wrong.png', + ], + ] ]; } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/magento_wrong.png b/dev/tests/integration/testsuite/Magento/Catalog/_files/magento_wrong.png new file mode 100644 index 0000000000000000000000000000000000000000..7bca3ec1f1deaf2697ed78c7cecea5d959ea0143 GIT binary patch literal 462 zcmeAS@N?(olHy`uVBq!ia0vp^tRT$93?x4=o+|@VEa{HEjtmSN`?>!lf+Q7^J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f-}G;#PvTAFfag#S=uVi zKtaZmAirP+hi5m^K%69RcNc~ZR#^`qhrPtp*OmP-lN7%`2jA}tr9dG;PZ!4!j_b(+ zsRFqq729ZBKMANq1Ej+_zo4=xGd%;OM+v4&p|~j7Hlw7Zpx8=ZzaZH_ucEkEFQdc` zZbI;4=X{_Esvr|m5=&C8l8aJ-6oZk0p{1^Yk*<+hh@q*KsezS&fwqA;kn~=y;*6pp zH$NpatrAUx2~ep8M1z*Mm?BVv3dn|#%#xf`Og|YR`^k7cTMtk@gQu&X%Q~loCIB1j Bfp7o- literal 0 HcmV?d00001 From 781e4b166f63da8d1bd4d63ecd4deaa5dcc99a5c Mon Sep 17 00:00:00 2001 From: Viktor Sevch Date: Wed, 24 Feb 2021 10:49:11 +0200 Subject: [PATCH 2/8] MC-39885: Improve customer api --- .../Magento/Customer/Model/Validator/Name.php | 58 +++++ ...pdateCustomerInformationAddAddressTest.xml | 5 +- app/code/Magento/Customer/etc/validation.xml | 6 + .../Customer/Api/CustomerRepositoryTest.php | 200 ++++++++++++++++++ 4 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Customer/Model/Validator/Name.php diff --git a/app/code/Magento/Customer/Model/Validator/Name.php b/app/code/Magento/Customer/Model/Validator/Name.php new file mode 100644 index 0000000000000..5e0a94604893d --- /dev/null +++ b/app/code/Magento/Customer/Model/Validator/Name.php @@ -0,0 +1,58 @@ +isValidName($customer->getFirstname())) { + parent::_addMessages([['firstname' => 'First Name is not valid!']]); + } + + if (!$this->isValidName($customer->getLastname())) { + parent::_addMessages([['lastname' => 'Last Name is not valid!']]); + } + + if (!$this->isValidName($customer->getMiddlename())) { + parent::_addMessages([['middlename' => 'Middle Name is not valid!']]); + } + + return count($this->_messages) == 0; + } + + /** + * Check if name field is valid. + * + * @param string|null $nameValue + * @return bool + */ + private function isValidName($nameValue) + { + if ($nameValue != null) { + $pattern = '/(?:[\p{L}\p{M}\,\-\_\.\'\"\s\d]){1,255}+/u'; + if (preg_match($pattern, $nameValue, $matches)) { + return $matches[0] == $nameValue; + } + } + + return true; + } +} diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml index 11aed4a3461e1..712ad61a9663e 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml @@ -11,12 +11,15 @@ - + <title value="DEPRECATED [Security] Verify No XSS Injection on Update Customer Information Add Address"/> <description value="Test log in to Storefront and Verify No XSS Injection on Update Customer Information Add Address"/> <testCaseId value="MC-10910"/> <severity value="CRITICAL"/> <group value="customer"/> <group value="mtf_migrated"/> + <skip> + <issueId value="DEPRECATED">Test outdated</issueId> + </skip> </annotations> <before> diff --git a/app/code/Magento/Customer/etc/validation.xml b/app/code/Magento/Customer/etc/validation.xml index 85d657dff266a..bac6e54afa7b5 100644 --- a/app/code/Magento/Customer/etc/validation.xml +++ b/app/code/Magento/Customer/etc/validation.xml @@ -18,11 +18,17 @@ <constraint alias="metadata_data_validator" class="Magento\Customer\Model\Metadata\Validator" /> </entity_constraints> </rule> + <rule name="check_name"> + <entity_constraints> + <constraint alias="name_validator" class="Magento\Customer\Model\Validator\Name" /> + </entity_constraints> + </rule> </rules> <groups> <group name="save"> <uses> <use rule="check_eav"/> + <use rule="check_name"/> </uses> </group> <group name="form"> diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php index f7732b5fd68dd..95f7da88b0619 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php @@ -1058,4 +1058,204 @@ protected function _createCustomer(?array $additionalData = []) $this->currentCustomerId[] = $customerData['id']; return $customerData; } + + /** + * Test customer create with invalid name's. + * + * @param string $fieldName + * @param string $fieldValue + * @param string $expectedMessage + * @return void + * + * @dataProvider customerDataProvider + */ + public function testCreateCustomerWithInvalidCustomerFirstName(string $fieldName, string $fieldValue, string $expectedMessage): void + { + $customerData = $this->dataObjectProcessor->buildOutputDataArray( + $this->customerHelper->createSampleCustomerDataObject(), + Customer::class + ); + $customerData[$fieldName] = $fieldValue; + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Save', + ], + ]; + + $requestData = ['customer' => $customerData]; + + try { + $this->_webApiCall($serviceInfo, $requestData); + $this->fail('Expected exception was not raised'); + } catch (\SoapFault $e) { + $this->assertStringContainsString($expectedMessage, $e->getMessage()); + } catch (\Exception $e) { + $errorObj = $this->processRestExceptionResult($e); + $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode()); + $this->assertEquals($expectedMessage, $errorObj['message']); + } + } + + /** + * Invalid customer data provider + * + * @return array + */ + public function customerDataProvider(): array + { + return [ + ['firstname', 'Jane ☺ ', 'First Name is not valid!'], + ['lastname', '☏ - Doe', 'Last Name is not valid!'], + ['middlename', '⚐ $(date)', 'Middle Name is not valid!'], + [ + 'firstname', + str_repeat('खाना अच्छा है', 20), + 'First Name is not valid!', + ], + [ + 'lastname', + str_repeat('المغلوطة حول استنكار النشوة وتمجيد الألمالمغلوطة حول', 5), + 'Last Name is not valid!', + ], + ]; + } + + /** + * Test customer create with ultibyte chanracters in name's. + * + * @param string $fieldName + * @param string $fieldValue + * @return void + * + * @dataProvider customerWithMultiByteDataProvider + */ + public function testCreateCustomerWithMultibyteCharacters(string $fieldName, string $fieldValue): void + { + $customerData = $this->dataObjectProcessor->buildOutputDataArray( + $this->customerHelper->createSampleCustomerDataObject(), + Customer::class + ); + $customerData[$fieldName] = $fieldValue; + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Save', + ], + ]; + + $requestData = ['customer' => $customerData]; + + $response = $this->_webApiCall($serviceInfo, $requestData); + + $this->assertNotNull($response); + $this->assertEquals($fieldValue, $response[$fieldName]); + } + + /** + * Customer with multibyte characters data provider. + * + * @return array + */ + public function customerWithMultiByteDataProvider(): array + { + return [ + [ + 'firstname', + str_repeat('हैखान', 51), + ], + [ + 'lastname', + str_repeat('مغلوطة حول استنكار النشوة وتمجيد الألمالمغلوطة حول', 5), + ], + ]; + } + + /** + * Test customer create with valid name's. + * + * @param string $fieldName + * @param string $fieldValue + * @return void + * + * @dataProvider customerValidNameDataProvider + */ + public function testCreateCustomerWithValidName(string $fieldName, string $fieldValue): void + { + $customerData = $this->dataObjectProcessor->buildOutputDataArray( + $this->customerHelper->createSampleCustomerDataObject(), + Customer::class + ); + $customerData[$fieldName] = $fieldValue; + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Save', + ], + ]; + + $requestData = ['customer' => $customerData]; + + $response = $this->_webApiCall($serviceInfo, $requestData); + + $this->assertNotNull($response); + $this->assertEquals($fieldValue, $response[$fieldName]); + } + + /** + * Customer valid name data provider. + * + * @return array + */ + public function customerValidNameDataProvider(): array + { + return [ + [ + 'firstname', + 'Anne-Marie', + ], + [ + 'lastname', + 'D\'Artagnan', + ], + [ + 'lastname', + 'Guðmundsdóttir', + ], + [ + 'lastname', + 'María José Carreño Quiñones', + ], + [ + 'lastname', + 'Q. Public', + ], + [ + 'firstname', + 'Elizabeth II', + ], + [ + 'firstname', + 'X Æ A-12 Musk', + ], + ]; + } } From 3bade65291d052b5a2a2454d7297a7ffe97d6d87 Mon Sep 17 00:00:00 2001 From: Viktor Sevch <viktor.sevch@transoftgroup.com> Date: Fri, 26 Feb 2021 08:54:12 +0200 Subject: [PATCH 3/8] MC-39885: Improve customer api --- app/code/Magento/Customer/Model/Validator/Name.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Model/Validator/Name.php b/app/code/Magento/Customer/Model/Validator/Name.php index 5e0a94604893d..a9a8a76421875 100644 --- a/app/code/Magento/Customer/Model/Validator/Name.php +++ b/app/code/Magento/Customer/Model/Validator/Name.php @@ -15,6 +15,8 @@ */ class Name extends AbstractValidator { + const PATTERN_NAME = '/(?:[\p{L}\p{M}\,\-\_\.\'\s\d]){1,255}+/u'; + /** * Validate name fields. * @@ -47,8 +49,7 @@ public function isValid($customer) private function isValidName($nameValue) { if ($nameValue != null) { - $pattern = '/(?:[\p{L}\p{M}\,\-\_\.\'\"\s\d]){1,255}+/u'; - if (preg_match($pattern, $nameValue, $matches)) { + if (preg_match(self::PATTERN_NAME, $nameValue, $matches)) { return $matches[0] == $nameValue; } } From 7c4a671d514ea515bf0fdf245bae56fbe6e3869f Mon Sep 17 00:00:00 2001 From: Viktor Sevch <viktor.sevch@transoftgroup.com> Date: Fri, 26 Feb 2021 11:34:12 +0200 Subject: [PATCH 4/8] MC-39885: Improve customer api --- .../Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml index 14d569ed9101d..ef9c90847adec 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml @@ -21,7 +21,7 @@ <before> <createData entity="Simple_US_Customer" stepKey="createFirstCustomer"/> <createData entity="Simple_US_Customer" stepKey="createSecondCustomer"> - <field key="firstname">"Jane Doe"</field> + <field key="firstname">Jane Doe</field> </createData> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> From 73c572f8f418d87e9ba9f070fd0ab564b86f7035 Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Fri, 26 Feb 2021 13:01:13 +0200 Subject: [PATCH 5/8] MC-41072: Fix flaky AddOutOfStockProductToCompareListTest --- .../Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml index d2de38c31dbb5..6fffff423f590 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml @@ -108,8 +108,8 @@ <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="grabTextFromSuccessMessage2"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="assertSuccessMessage2"/> - <comment userInput="Check that product displays on add to compare widget | Comment is kept to preserve the step key for backward compatibility" stepKey="checkProdNameOnWidget"/> - <seeElement selector="{{StorefrontComparisonSidebarSection.ProductTitleByName($$product.name$$)}}" stepKey="seeProdNameOnCmpWidget"/> + <comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="checkProdNameOnWidget"/> + <comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="seeProdNameOnCmpWidget"/> <comment userInput="See product in the compare page" stepKey="seeProductInComparePage"/> <actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage2"/> From c8179ddde66848c719e2ac689f6e3a5e73cc7a9a Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Fri, 26 Feb 2021 17:20:33 +0200 Subject: [PATCH 6/8] MC-41072: Fix flaky AddOutOfStockProductToCompareListTest --- ...emoveProductFromCompareListActionGroup.xml | 24 +++++++++++++++++++ .../StorefrontProductCompareMainSection.xml | 1 + .../AddOutOfStockProductToCompareListTest.xml | 11 +++++---- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveProductFromCompareListActionGroup.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveProductFromCompareListActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveProductFromCompareListActionGroup.xml new file mode 100644 index 0000000000000..a80cc6022eece --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveProductFromCompareListActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontClearFirstProductFromCompareActionGroup"> + <annotations> + <description>Open Compare Products list and remove a product</description> + </annotations> + + <amOnPage url="{{StorefrontProductComparePage.url}}" stepKey="navigateToComparePage"/> + <waitForElementVisible selector="{{StorefrontProductCompareMainSection.removeFirstItem}}" stepKey="waitForButton"/> + <click selector="{{StorefrontProductCompareMainSection.removeFirstItem}}" stepKey="clickOnButton"/> + <waitForElementVisible selector="{{ModalConfirmationSection.OkButton}}" stepKey="waitForModal"/> + <scrollTo selector="{{ModalConfirmationSection.OkButton}}" stepKey="scrollToModal"/> + <click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOkButton"/> + <waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml index ad31be6b277ee..d120042fbe9a2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml @@ -14,5 +14,6 @@ <element name="ProductPriceByName" type="text" selector="//*[@id='product-comparison']//td[.//strong[@class='product-item-name']/a[contains(text(), '{{var1}}')]]//span[@class='price']" parameterized="true"/> <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"/> <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"/> + <element name="removeFirstItem" type="button" selector="table.table-comparison a.delete"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml index 6fffff423f590..64a7a19eb1daa 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml @@ -78,8 +78,7 @@ <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPage"> <argument name="categoryName" value="$$category.name$$"/> </actionGroup> - - <actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage"/> + <comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="navigateToComparePage"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductComparePageLoad"/> <actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductInCompareList"> @@ -92,11 +91,13 @@ <argument name="categoryName" value="$$category.name$$"/> </actionGroup> - <actionGroup ref="StorefrontClearCompareActionGroup" stepKey="clickClearAll"/> + <actionGroup ref="StorefrontClearFirstProductFromCompareActionGroup" stepKey="clickClearAll"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmPageLoad"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="confirmProdDelate"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmLoad"/> - <comment userInput="Add product to compare list fom Category page | Comment is kept to preserve the step key for backward compatibility" stepKey="addToCmpFromCategPage"/> + <actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="addToCmpFromCategPage"> + <argument name="categoryName" value="$$category.name$$"/> + </actionGroup> <actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverOverProduct"/> @@ -112,7 +113,7 @@ <comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="seeProdNameOnCmpWidget"/> <comment userInput="See product in the compare page" stepKey="seeProductInComparePage"/> - <actionGroup ref="StorefrontOpenAndCheckComparisionActionGroup" stepKey="navigateToComparePage2"/> + <comment userInput="Comment is kept to preserve the step key for backward compatibility" stepKey="navigateToComparePage2"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontProductComparePageLoad2"/> <actionGroup ref="SeeProductInComparisonListActionGroup" stepKey="seeProductInCompareList2"> From 324433a66c3134429bba6eaf76c09dfdfe59bef5 Mon Sep 17 00:00:00 2001 From: Serhii Voloshkov <serhii.voloshkov@transoftgroup.com> Date: Fri, 26 Feb 2021 17:26:13 +0200 Subject: [PATCH 7/8] MC-41072: Fix flaky AddOutOfStockProductToCompareListTest --- ...l => StorefrontRemoveFirstProductFromCompareActionGroup.xml} | 2 +- .../Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename app/code/Magento/Catalog/Test/Mftf/ActionGroup/{StorefrontRemoveProductFromCompareListActionGroup.xml => StorefrontRemoveFirstProductFromCompareActionGroup.xml} (94%) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveProductFromCompareListActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveFirstProductFromCompareActionGroup.xml similarity index 94% rename from app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveProductFromCompareListActionGroup.xml rename to app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveFirstProductFromCompareActionGroup.xml index a80cc6022eece..fefcdb6930c61 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveProductFromCompareListActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontRemoveFirstProductFromCompareActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontClearFirstProductFromCompareActionGroup"> + <actionGroup name="StorefrontRemoveFirstProductFromCompareActionGroup"> <annotations> <description>Open Compare Products list and remove a product</description> </annotations> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml index 64a7a19eb1daa..fad0b26262d0a 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml @@ -91,7 +91,7 @@ <argument name="categoryName" value="$$category.name$$"/> </actionGroup> - <actionGroup ref="StorefrontClearFirstProductFromCompareActionGroup" stepKey="clickClearAll"/> + <actionGroup ref="StorefrontRemoveFirstProductFromCompareActionGroup" stepKey="clickClearAll"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmPageLoad"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="confirmProdDelate"/> <comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForConfirmLoad"/> From f77a37aa1ec0034eb96d365fd9974ba68da0ea98 Mon Sep 17 00:00:00 2001 From: Viktor Sevch <viktor.sevch@transoftgroup.com> Date: Fri, 26 Feb 2021 19:12:14 +0200 Subject: [PATCH 8/8] MC-39885: Improve customer api --- app/code/Magento/Customer/Model/Validator/Name.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/Validator/Name.php b/app/code/Magento/Customer/Model/Validator/Name.php index a9a8a76421875..9bab241465d6c 100644 --- a/app/code/Magento/Customer/Model/Validator/Name.php +++ b/app/code/Magento/Customer/Model/Validator/Name.php @@ -15,7 +15,7 @@ */ class Name extends AbstractValidator { - const PATTERN_NAME = '/(?:[\p{L}\p{M}\,\-\_\.\'\s\d]){1,255}+/u'; + private const PATTERN_NAME = '/(?:[\p{L}\p{M}\,\-\_\.\'\s\d]){1,255}+/u'; /** * Validate name fields.