forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request magento#3509 from magento-tsg/2.2-develop-pr60
[TSG] Backporting for 2.2 (pr60) (2.2.8)
- Loading branch information
Showing
31 changed files
with
574 additions
and
170 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAnyUserActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?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"> | ||
<!--Login as any user--> | ||
<actionGroup name="AdminLoginAsAnyUser"> | ||
<arguments> | ||
<argument name="login" type="string" defaultValue="{{_ENV.MAGENTO_ADMIN_USERNAME}}"/> | ||
<argument name="password" type="string" defaultValue="{{_ENV.MAGENTO_ADMIN_PASSWORD}}"/> | ||
</arguments> | ||
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/> | ||
<fillField userInput="{{login}}" selector="{{AdminLoginFormSection.username}}" stepKey="fillUsername"/> | ||
<fillField userInput="{{password}}" selector="{{AdminLoginFormSection.password}}" stepKey="fillPassword"/> | ||
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/> | ||
<closeAdminNotification stepKey="closeAdminNotification"/> | ||
</actionGroup> | ||
</actionGroups> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
.../Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?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="AdminCreateCustomerWithWebsiteAndStoreViewActionGroup"> | ||
<arguments> | ||
<argument name="customer"/> | ||
<argument name="address"/> | ||
<argument name="websiteName" type="string"/> | ||
<argument name="storeViewName" type="string"/> | ||
</arguments> | ||
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/> | ||
<click selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}" stepKey="addNewCustomer"/> | ||
<selectOption selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{websiteName}}" stepKey="selectWebSite"/> | ||
<fillField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customer.firstname}}" stepKey="fillFirstName"/> | ||
<fillField selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customer.lastname}}" stepKey="fillLastName"/> | ||
<fillField selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customer.email}}" stepKey="fillEmail"/> | ||
<selectOption selector="{{AdminCustomerAccountInformationSection.storeView}}" userInput="{{storeViewName}}" stepKey="selectStoreView"/> | ||
<scrollToTopOfPage stepKey="scrollToTopOfThePage"/> | ||
<click selector="{{AdminCustomerAccountInformationSection.addressesButton}}" stepKey="goToAddresses"/> | ||
<waitForPageLoad stepKey="waitForAddresses"/> | ||
<click selector="{{AdminCustomerEditAddressesSection.addNewAddress}}" stepKey="clickOnAddNewAddress"/> | ||
<waitForPageLoad stepKey="waitForAddressFields"/> | ||
<click selector="{{AdminCustomerEditAddressesSection.defaultBillingAddress}}" stepKey="tickBillingAddress"/> | ||
<click selector="{{AdminCustomerEditAddressesSection.defaultShippingAddress}}" stepKey="tickShippingAddress"/> | ||
<fillField selector="{{AdminCustomerEditAddressesSection.firstName}}" userInput="{{address.firstname}}" stepKey="fillFirstNameForAddress"/> | ||
<fillField selector="{{AdminCustomerEditAddressesSection.lastName}}" userInput="{{address.lastname}}" stepKey="fillLastNameForAddress"/> | ||
<fillField selector="{{AdminCustomerEditAddressesSection.streetAddress}}" userInput="{{address.street[0]}}" stepKey="fillStreetAddress"/> | ||
<fillField selector="{{AdminCustomerEditAddressesSection.city}}" userInput="{{address.city}}" stepKey="fillCity"/> | ||
<selectOption selector="{{AdminCustomerEditAddressesSection.country}}" userInput="{{address.country}}" stepKey="selectCountry"/> | ||
<selectOption selector="{{AdminCustomerEditAddressesSection.state}}" userInput="{{address.state}}" stepKey="selectState"/> | ||
<fillField selector="{{AdminCustomerEditAddressesSection.zip}}" userInput="{{address.postcode}}" stepKey="fillZip"/> | ||
<fillField selector="{{AdminCustomerEditAddressesSection.phoneNumber}}" userInput="{{address.telephone}}" stepKey="fillPhoneNumber"/> | ||
<click selector="{{AdminMainActionsSection.save}}" stepKey="save"/> | ||
<see userInput="You saved the customer." stepKey="seeSuccessMessage"/> | ||
</actionGroup> | ||
</actionGroups> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerEditAddressesSection.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?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="AdminCustomerEditAddressesSection"> | ||
<element name="addNewAddress" type="button" selector="//span[text()='Add New Addresses']"/> | ||
<element name="defaultBillingAddress" type="button" selector="//label[text()='Default Billing Address']"/> | ||
<element name="defaultShippingAddress" type="button" selector="//label[text()='Default Shipping Address']"/> | ||
<element name="firstName" type="button" selector="input[name*='address'][name*=firstname]"/> | ||
<element name="lastName" type="button" selector="input[name*='address'][name*=lastname]"/> | ||
<element name="streetAddress" type="button" selector="input[name*='address'][name*=street]"/> | ||
<element name="city" type="input" selector="input[name*='address'][name*=city]"/> | ||
<element name="country" type="select" selector="select[name*='address'][name*=country_id]"/> | ||
<element name="state" type="select" selector="select[name*=address][name*=region_id]"/> | ||
<element name="zip" type="input" selector="input[name*=address][name*=postcode]"/> | ||
<element name="phoneNumber" type="input" selector="input[name*=address][name*=telephone]"/> | ||
</section> | ||
</sections> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
app/code/Magento/Persistent/Observer/SetCheckoutSessionPersistentDataObserver.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
/** | ||
* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Persistent\Observer; | ||
|
||
use Magento\Framework\Event\ObserverInterface; | ||
|
||
/** | ||
* Observer for a work with persistent data. | ||
*/ | ||
class SetCheckoutSessionPersistentDataObserver implements ObserverInterface | ||
{ | ||
/** | ||
* Persistent session. | ||
* | ||
* @var \Magento\Persistent\Helper\Session | ||
*/ | ||
private $persistentSession = null; | ||
|
||
/** | ||
* Customer session. | ||
* | ||
* @var \Magento\Customer\Model\Session | ||
*/ | ||
private $customerSession; | ||
|
||
/** | ||
* Persistent data. | ||
* | ||
* @var \Magento\Persistent\Helper\Data | ||
*/ | ||
private $persistentData = null; | ||
|
||
/** | ||
* Customer Repository. | ||
* | ||
* @var \Magento\Customer\Api\CustomerRepositoryInterface | ||
*/ | ||
private $customerRepository = null; | ||
|
||
/** | ||
* @param \Magento\Persistent\Helper\Session $persistentSession | ||
* @param \Magento\Customer\Model\Session $customerSession | ||
* @param \Magento\Persistent\Helper\Data $persistentData | ||
* @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository | ||
*/ | ||
public function __construct( | ||
\Magento\Persistent\Helper\Session $persistentSession, | ||
\Magento\Customer\Model\Session $customerSession, | ||
\Magento\Persistent\Helper\Data $persistentData, | ||
\Magento\Customer\Api\CustomerRepositoryInterface $customerRepository | ||
) { | ||
$this->persistentSession = $persistentSession; | ||
$this->customerSession = $customerSession; | ||
$this->persistentData = $persistentData; | ||
$this->customerRepository = $customerRepository; | ||
} | ||
|
||
/** | ||
* Pass customer data from persistent session to checkout session and set quote to be loaded even if not active. | ||
* | ||
* @param \Magento\Framework\Event\Observer $observer | ||
* @return void | ||
*/ | ||
public function execute(\Magento\Framework\Event\Observer $observer) | ||
{ | ||
/** @var $checkoutSession \Magento\Checkout\Model\Session */ | ||
$checkoutSession = $observer->getEvent()->getData('checkout_session'); | ||
if ($this->persistentData->isShoppingCartPersist() && $this->persistentSession->isPersistent()) { | ||
$checkoutSession->setCustomerData( | ||
$this->customerRepository->getById($this->persistentSession->getSession()->getCustomerId()) | ||
); | ||
} | ||
if (!(($this->persistentSession->isPersistent() && !$this->customerSession->isLoggedIn()) | ||
&& !$this->persistentData->isShoppingCartPersist() | ||
)) { | ||
return; | ||
} | ||
if ($checkoutSession) { | ||
$checkoutSession->setLoadInactive(); | ||
} | ||
} | ||
} |
78 changes: 0 additions & 78 deletions
78
app/code/Magento/Persistent/Observer/SetLoadPersistentQuoteObserver.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.