Skip to content

Commit

Permalink
Merge pull request magento#3495 from magento-borg/BugFixPR
Browse files Browse the repository at this point in the history
[2.3-develop] Bug Fixes
  • Loading branch information
joanhe authored Dec 1, 2018
2 parents 6ea3d2f + e342395 commit 5498231
Show file tree
Hide file tree
Showing 17 changed files with 223 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,7 @@ public function loadProductCount($items, $countRegular = true, $countAnchor = tr
['e' => $this->getTable('catalog_category_entity')],
'main_table.category_id=e.entity_id',
[]
)->where(
'e.entity_id = :entity_id'
)->orWhere(
'e.path LIKE :c_path'
);
)->where('e.entity_id = :entity_id OR e.path LIKE :c_path');
if ($websiteId) {
$select->join(
['w' => $this->getProductWebsiteTable()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
userInput="$$createProduct1.name$$" stepKey="seeProductName4"/>
<see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct12.name$$)}}"
userInput="$$createProduct12.name$$" stepKey="seeProductName5"/>
<waitForText userInput="$$createCategory.name$$ (2)" stepKey="seeCorrectProductCount"/>
<dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct0.name$$)}}"
userInput="$$createProduct0.name$$" stepKey="dontSeeProductName"/>
<dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct2.name$$)}}"
Expand All @@ -164,6 +165,7 @@
userInput="$$createProduct2.name$$" stepKey="seeProductName6"/>
<see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct12.name$$)}}"
userInput="$$createProduct12.name$$" stepKey="seeProductName7"/>
<waitForText userInput="$$createCategory.name$$ (2)" stepKey="seeCorrectProductCount2"/>
<dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct0.name$$)}}"
userInput="$$createProduct0.name$$" stepKey="dontSeeProductName2"/>
<dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct2.name$$)}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<level>2</level>
<label translate="true">Base</label>
</settings>
<field name="watermark_image_image" formElement="fileUploader">
<field name="watermark_image_image" formElement="imageUploader">
<settings>
<notice translate="true">Allowed file types: jpeg, gif, png.</notice>
<label translate="true">Image</label>
Expand Down Expand Up @@ -78,7 +78,7 @@
<level>2</level>
<label translate="true">Thumbnail</label>
</settings>
<field name="watermark_thumbnail_image" formElement="fileUploader">
<field name="watermark_thumbnail_image" formElement="imageUploader">
<settings>
<label translate="true">Image</label>
<componentType>imageUploader</componentType>
Expand Down Expand Up @@ -137,7 +137,7 @@
<level>2</level>
<label translate="true">Small</label>
</settings>
<field name="watermark_small_image_image" formElement="fileUploader">
<field name="watermark_small_image_image" formElement="imageUploader">
<settings>
<label translate="true">Image</label>
<componentType>imageUploader</componentType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<element name="availablePaymentSolutions" type="text" selector="#checkout-payment-method-load>div>div>div:nth-child(2)>div.payment-method-title.field.choice"/>
<element name="notAvailablePaymentSolutions" type="text" selector="#checkout-payment-method-load>div>div>div.payment-method._active>div.payment-method-title.field.choice"/>
<element name="billingNewAddressForm" type="text" selector="[data-form='billing-new-address']"/>
<element name="billingAddressNotSameCheckbox" type="checkbox" selector="#billing-address-same-as-shipping-checkmo"/>
<element name="placeOrderDisabled" type="button" selector="#checkout-payment-method-load button.disabled"/>
<element name="update" type="button" selector=".payment-method-billing-address .action.action-update"/>
<element name="guestFirstName" type="input" selector=".billing-address-form input[name*='firstname']"/>
Expand Down
7 changes: 6 additions & 1 deletion app/code/Magento/Customer/Controller/Address/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
*/
namespace Magento\Customer\Controller\Address;

use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\Action\HttpPostActionInterface;

class Delete extends \Magento\Customer\Controller\Address implements HttpPostActionInterface
/**
* Delete customer address controller action.
*/
class Delete extends \Magento\Customer\Controller\Address implements HttpPostActionInterface, HttpGetActionInterface
{
/**
* @inheritdoc
* @return \Magento\Framework\Controller\Result\Redirect
*/
public function execute()
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Customer/Model/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ public function isLocked($customerId)
public function authenticate($customerId, $password)
{
$customerSecure = $this->customerRegistry->retrieveSecureData($customerId);
$hash = $customerSecure->getPasswordHash();
if (!$hash || !$this->encryptor->validateHash($password, $hash)) {
$hash = $customerSecure->getPasswordHash() ?? '';
if (!$this->encryptor->validateHash($password, $hash)) {
$this->processAuthenticationFailure($customerId);
if ($this->isLocked($customerId)) {
throw new UserLockedException(__('The account is locked.'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontCustomerAddressesSection">
<element name="addressesList" type="text" selector=".block-addresses-list" />
<element name="deleteAdditionalAddress" type="button" selector="//ol[@class='items addresses']/li[@class='item'][{{var}}]//a[@class='action delete']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontDeleteCustomerAddressTest">
<annotations>
<stories value="Delete customer address from storefront"/>
<title value="User should be able to delete Customer address successfully from storefront"/>
<description value="User should be able to delete Customer address successfully from storefront"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-5713"/>
<group value="Customer"/>
</annotations>
<before>
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
</before>
<after>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
</after>
<amOnPage stepKey="amOnSignInPage" url="{{StorefrontCustomerSignInPage.url}}"/>
<fillField stepKey="fillEmail" userInput="$$createCustomer.email$$" selector="{{StorefrontCustomerSignInFormSection.emailField}}"/>
<fillField stepKey="fillPassword" userInput="$$createCustomer.password$$" selector="{{StorefrontCustomerSignInFormSection.passwordField}}"/>
<click stepKey="clickSignInAccountButton" selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}"/>
<actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddressInfo">
<argument name="Address" value="US_Address_NY"/>
</actionGroup>
<see userInput="You saved the address." stepKey="verifyAddressCreated"/>
<click selector="{{StorefrontCustomerAddressesSection.deleteAdditionalAddress('1')}}" stepKey="deleteAdditionalAddress"/>
<waitForElementVisible selector="{{ModalConfirmationSection.modalContent}}" stepKey="waitFortheConfirmationModal"/>
<see selector="{{ModalConfirmationSection.modalContent}}" userInput="Are you sure you want to delete this address?" stepKey="seeAddressDeleteConfirmationMessage"/>
<click selector="{{ModalConfirmationSection.OkButton}}" stepKey="confirmDelete"/>
<waitForPageLoad stepKey="waitForDeleteToFinish"/>
<see userInput="You deleted the address." stepKey="verifyDeleteAddress"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminWatermarkUploadTest">
<waitForElement selector="{{AdminDesignConfigSection.imageUploadInputByFieldsetName('Swatch Image')}}" stepKey="waitForInputVisible4" after="waitForPreviewImage3"/>
<attachFile selector="{{AdminDesignConfigSection.imageUploadInputByFieldsetName('Swatch Image')}}" userInput="adobe-small.jpg" stepKey="attachFile4" after="waitForInputVisible4"/>
<waitForElementVisible selector="{{AdminDesignConfigSection.imageUploadPreviewByFieldsetName('Swatch Image')}}" stepKey="waitForPreviewImage4" after="attachFile4"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<level>2</level>
<label translate="true">Swatch Image</label>
</settings>
<field name="watermark_swatch_image_image" formElement="fileUploader">
<field name="watermark_swatch_image_image" formElement="imageUploader">
<settings>
<label translate="true">Image</label>
<componentType>imageUploader</componentType>
Expand Down
14 changes: 14 additions & 0 deletions app/code/Magento/Theme/Test/Mftf/Page/DesignConfigPage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="DesignConfigPage" url="theme/design_config/" area="admin" module="Magento_Theme">
<section name="AdminDesignConfigSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminDesignConfigSection">
<element name="scopeRow" type="button" selector="//*[contains(@class,'data-row')][{{arg1}}]//*[contains(@class,'action-menu-item')]" parameterized="true"/>
<element name="watermarkSectionHeader" type="text" selector="[data-index='watermark']"/>
<element name="watermarkSection" type="text" selector="[data-index='watermark'] .admin__fieldset-wrapper-content"/>
<element name="imageUploadInputByFieldsetName" type="input" selector="//*[contains(@class,'fieldset-wrapper')][child::*[contains(@class,'fieldset-wrapper-title')]//*[contains(text(),'{{arg1}}')]]//*[contains(@class,'file-uploader')]//input" parameterized="true"/>
<element name="imageUploadPreviewByFieldsetName" type="input" selector="//*[contains(@class,'fieldset-wrapper')][child::*[contains(@class,'fieldset-wrapper-title')]//*[contains(text(),'{{arg1}}')]]//*[contains(@class,'file-uploader-preview')]//img" parameterized="true"/>
</section>
</sections>
46 changes: 46 additions & 0 deletions app/code/Magento/Theme/Test/Mftf/Test/AdminWatermarkUploadTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminWatermarkUploadTest">
<annotations>
<features value="Watermark"/>
<stories value="Watermark"/>
<title value="MAGETWO-95934: Can't upload Watermark Image"/>
<description value="Watermark images should be able to be uploaded in the admin"/>
<severity value="MAJOR"/>
<testCaseId value="MC-5796"/>
<group value="Watermark"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/>
</before>
<after>
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
</after>
<amOnPage url="{{DesignConfigPage.url}}" stepKey="navigateToDesignConfigPage" />
<waitForPageLoad stepKey="waitForPageload1"/>
<click selector="{{AdminDesignConfigSection.scopeRow('3')}}" stepKey="editStoreView"/>
<waitForPageLoad stepKey="waitForPageload2"/>
<scrollTo selector="{{AdminDesignConfigSection.watermarkSectionHeader}}" stepKey="scrollToWatermarkSection"/>
<click selector="{{AdminDesignConfigSection.watermarkSectionHeader}}" stepKey="openWatermarkSection"/>

<waitForElement selector="{{AdminDesignConfigSection.imageUploadInputByFieldsetName('Base')}}" stepKey="waitForInputVisible1"/>
<attachFile selector="{{AdminDesignConfigSection.imageUploadInputByFieldsetName('Base')}}" userInput="adobe-base.jpg" stepKey="attachFile1"/>
<waitForElementVisible selector="{{AdminDesignConfigSection.imageUploadPreviewByFieldsetName('Base')}}" stepKey="waitForPreviewImage"/>

<waitForElement selector="{{AdminDesignConfigSection.imageUploadInputByFieldsetName('Thumbnail')}}" stepKey="waitForInputVisible2"/>
<attachFile selector="{{AdminDesignConfigSection.imageUploadInputByFieldsetName('Thumbnail')}}" userInput="adobe-thumb.jpg" stepKey="attachFile2"/>
<waitForElementVisible selector="{{AdminDesignConfigSection.imageUploadPreviewByFieldsetName('Thumbnail')}}" stepKey="waitForPreviewImage2"/>

<waitForElement selector="{{AdminDesignConfigSection.imageUploadInputByFieldsetName('Small')}}" stepKey="waitForInputVisible3"/>
<attachFile selector="{{AdminDesignConfigSection.imageUploadInputByFieldsetName('Small')}}" userInput="adobe-small.jpg" stepKey="attachFile3"/>
<waitForElementVisible selector="{{AdminDesignConfigSection.imageUploadPreviewByFieldsetName('Small')}}" stepKey="waitForPreviewImage3"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="ModalConfirmationSection">
<element name="modalContent" type="text" selector="aside.confirm div.modal-content"/>
<element name="CancelButton" type="button" selector="//footer[@class='modal-footer']/button[contains(@class, 'action-dismiss')]"/>
<element name="OkButton" type="button" selector="//footer[@class='modal-footer']/button[contains(@class, 'action-accept')]"/>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,35 @@ public function testIndexAction()
$this->assertContains('Green str, 67', $body);
}

/**
* @magentoDataFixture Magento/Customer/_files/customer_no_password.php
*/
public function testLoginWithIncorrectPassword()
{
$expectedMessage = 'The account sign-in was incorrect or your account is disabled temporarily. '
. 'Please wait and try again later.';
$this->getRequest()
->setMethod('POST')
->setPostValue(
[
'login' => [
'username' => '[email protected]',
'password' => '123123q'
]
]
);

$this->dispatch('customer/account/loginPost');
$this->assertRedirect($this->stringContains('customer/account/login'));
$this->assertSessionMessages(
$this->equalTo(
[
$expectedMessage
]
)
);
}

/**
* Test sign up form displaying.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Customer\Model\CustomerRegistry;

$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $repository \Magento\Customer\Api\CustomerRepositoryInterface */
$repository = $objectManager->create(\Magento\Customer\Api\CustomerRepositoryInterface::class);
$customer = $objectManager->create(\Magento\Customer\Model\Customer::class);
/** @var CustomerRegistry $customerRegistry */
$customerRegistry = $objectManager->get(CustomerRegistry::class);
/** @var Magento\Customer\Model\Customer $customer */
$customer->setWebsiteId(1)
->setId(1)
->setEmail('[email protected]')
->setGroupId(1)
->setStoreId(1)
->setIsActive(1)
->setPrefix('Mr.')
->setFirstname('John')
->setMiddlename('A')
->setLastname('Smith')
->setSuffix('Esq.')
->setDefaultBilling(1)
->setDefaultShipping(1)
->setTaxvat('12')
->setGender(0);

$customer->isObjectNew(true);
$customer->save();
$customerRegistry->remove($customer->getId());
10 changes: 8 additions & 2 deletions lib/internal/Magento/Framework/Encryption/Encryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function validateHashVersion($hash, $validateCount = false)
}

/**
* Split password hash into parts: hash, salt, version
* Explode password hash
*
* @param string $hash
* @return array
Expand Down Expand Up @@ -271,7 +271,13 @@ private function getPasswordSalt()
*/
private function getPasswordVersion()
{
return array_map('intval', explode(self::DELIMITER, $this->passwordHashMap[self::PASSWORD_VERSION]));
return array_map(
'intval',
explode(
self::DELIMITER,
(string)$this->passwordHashMap[self::PASSWORD_VERSION]
)
);
}

/**
Expand Down

0 comments on commit 5498231

Please sign in to comment.