-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'mainline/2.2-develop' into MAGETWO-99645
- Loading branch information
Showing
18 changed files
with
854 additions
and
93 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> | ||
<entity name="WysiwygEnabledByDefault"> | ||
<data key="path">cms/wysiwyg/enabled</data> | ||
<data key="scope_id">0</data> | ||
<data key="value">enabled</data> | ||
</entity> | ||
<entity name="WysiwygDisabledByDefault"> | ||
<data key="path">cms/wysiwyg/enabled</data> | ||
<data key="scope_id">0</data> | ||
<data key="value">hidden</data> | ||
</entity> | ||
</entities> |
22 changes: 22 additions & 0 deletions
22
...tomer/Test/Mftf/ActionGroup/StorefrontRegisterCustomerFromOrderSuccessPageActionGroup.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,22 @@ | ||
<?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="StorefrontRegisterCustomerFromOrderSuccessPage"> | ||
<arguments> | ||
<argument name="customer" /> | ||
</arguments> | ||
<click selector="{{CheckoutSuccessRegisterSection.createAccountButton}}" stepKey="clickCreateAccountButton"/> | ||
<fillField selector="{{StorefrontCustomerCreateFormSection.passwordField}}" userInput="{{customer.password}}" stepKey="typePassword"/> | ||
<fillField selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}" userInput="{{customer.password}}" stepKey="typeConfirmationPassword"/> | ||
<click selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}" stepKey="clickOnCreateAccount"/> | ||
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" stepKey="waitForSuccessMessage"/> | ||
<see selector="{{StorefrontMessagesSection.success}}" userInput="Thank you for registering" stepKey="verifyAccountCreated"/> | ||
</actionGroup> | ||
</actionGroups> |
71 changes: 71 additions & 0 deletions
71
app/code/Magento/Downloadable/Observer/UpdateLinkPurchasedObserver.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,71 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Downloadable\Observer; | ||
|
||
use Magento\Downloadable\Model\ResourceModel\Link\Purchased\Collection as PurchasedCollection; | ||
use Magento\Downloadable\Model\ResourceModel\Link\Purchased\CollectionFactory; | ||
use Magento\Framework\Event\Observer; | ||
use Magento\Framework\Event\ObserverInterface; | ||
|
||
/** | ||
* Assign Downloadable links to customer created after issuing guest order. | ||
*/ | ||
class UpdateLinkPurchasedObserver implements ObserverInterface | ||
{ | ||
/** | ||
* Purchased links collection factory | ||
* | ||
* @var CollectionFactory | ||
*/ | ||
private $purchasedCollectionFactory; | ||
|
||
/** | ||
* @param CollectionFactory $purchasedCollectionFactory | ||
*/ | ||
public function __construct( | ||
CollectionFactory $purchasedCollectionFactory | ||
) { | ||
$this->purchasedCollectionFactory = $purchasedCollectionFactory; | ||
} | ||
|
||
/** | ||
* Link customer_id to downloadable link purchased after update order | ||
* | ||
* @param Observer $observer | ||
* @return $this | ||
*/ | ||
public function execute(Observer $observer) | ||
{ | ||
$order = $observer->getEvent()->getOrder(); | ||
$orderId = $order->getId(); | ||
$customerId = $order->getCustomerId(); | ||
if (!$orderId || !$customerId) { | ||
return $this; | ||
} | ||
$purchasedLinksCollection = $this->getPurchasedCollection((int)$orderId); | ||
foreach ($purchasedLinksCollection as $linkPurchased) { | ||
$linkPurchased->setCustomerId($customerId)->save(); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get purchased collection by order id | ||
* | ||
* @param int $orderId | ||
* @return PurchasedCollection | ||
*/ | ||
private function getPurchasedCollection(int $orderId): PurchasedCollection | ||
{ | ||
return $this->purchasedCollectionFactory->create()->addFieldToFilter( | ||
'order_id', | ||
['eq' => $orderId] | ||
); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../ActionGroup/StorefrontAssertDownloadableProductIsPresentInCustomerAccountActionGroup.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,18 @@ | ||
<?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="StorefrontAssertDownloadableProductIsPresentInCustomerAccount"> | ||
<arguments> | ||
<argument name="product"/> | ||
</arguments> | ||
<amOnPage url="{{StorefrontCustomerDownloadableProductsPage.url}}" stepKey="goToCustomerDownloadableProductsPage"/> | ||
<seeElement selector="{{StorefrontCustomerDownloadableProductsSection.productName(product.name)}}" stepKey="seeStorefontDownloadableProductsProductName" /> | ||
</actionGroup> | ||
</actionGroups> |
21 changes: 21 additions & 0 deletions
21
app/code/Magento/Downloadable/Test/Mftf/Data/CatalogConfigData.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,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> | ||
<entity name="EnableGuestCheckoutWithDownloadableItems"> | ||
<data key="path">catalog/downloadable/disable_guest_checkout</data> | ||
<data key="scope_id">0</data> | ||
<data key="value">0</data> | ||
</entity> | ||
<entity name="DisableGuestCheckoutWithDownloadableItems"> | ||
<data key="path">catalog/downloadable/disable_guest_checkout</data> | ||
<data key="scope_id">0</data> | ||
<data key="value">1</data> | ||
</entity> | ||
</entities> |
13 changes: 13 additions & 0 deletions
13
app/code/Magento/Downloadable/Test/Mftf/Page/StorefrontCustomerDownloadableProductsPage.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,13 @@ | ||
<?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="StorefrontCustomerDownloadableProductsPage" url="downloadable/customer/products/" area="storefront" module="Magento_Downloadable"> | ||
<section name="StorefrontCustomerDownloadableProductsSection"/> | ||
</page> | ||
</pages> |
14 changes: 14 additions & 0 deletions
14
.../Magento/Downloadable/Test/Mftf/Section/StorefrontCustomerDownloadableProductsSection.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,14 @@ | ||
<?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="StorefrontCustomerDownloadableProductsSection"> | ||
<element name="productName" type="text" selector="//table[@id='my-downloadable-products-table']//strong[contains(@class, 'product-name') and normalize-space(.)='{{productName}}']" parameterized="true"/> | ||
</section> | ||
</sections> |
70 changes: 70 additions & 0 deletions
70
...de/Magento/Downloadable/Test/Mftf/Test/LinkDownloadableProductFromGuestToCustomerTest.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,70 @@ | ||
<?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="LinkDownloadableProductFromGuestToCustomerTest"> | ||
<annotations> | ||
<features value="Downloadable"/> | ||
<stories value="Downloadable products in customer account"/> | ||
<title value="Customer should see downloadable products after place order as guest and registering after that"/> | ||
<description value="Verify that in 'My Downloadable Products' section in customer account user can see products."/> | ||
<severity value="AVERAGE"/> | ||
<useCaseId value="MAGETWO-98655"/> | ||
<testCaseId value="MC-16148"/> | ||
<group value="catalog"/> | ||
<group value="downloadable"/> | ||
</annotations> | ||
<before> | ||
<magentoCLI command="config:set {{EnableGuestCheckoutWithDownloadableItems.path}} {{EnableGuestCheckoutWithDownloadableItems.value}}" stepKey="enableGuestCheckoutWithDownloadableItems" /> | ||
<createData entity="ApiDownloadableProduct" stepKey="createProduct"/> | ||
<createData entity="ApiDownloadableLink" stepKey="addDownloadableLink"> | ||
<requiredEntity createDataKey="createProduct"/> | ||
</createData> | ||
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> | ||
</before> | ||
<after> | ||
<magentoCLI command="config:set {{DisableGuestCheckoutWithDownloadableItems.path}} {{DisableGuestCheckoutWithDownloadableItems.value}}" stepKey="disableGuestCheckoutWithDownloadableItems" /> | ||
<deleteData stepKey="deleteProduct" createDataKey="createProduct"/> | ||
<actionGroup ref="RemoveCustomerFromAdminActionGroup" stepKey="deleteCustomer"> | ||
<argument name="customer" value="Simple_US_NY_Customer"/> | ||
</actionGroup> | ||
<actionGroup ref="logout" stepKey="logout"/> | ||
</after> | ||
<!--Step 1: Go to Storefront as Guest--> | ||
<actionGroup ref="CustomerLogoutStorefrontActionGroup" stepKey="logoutCustomer"/> | ||
<!--Step 2: Add downloadable product to shopping cart--> | ||
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="amOnStorefrontProductPage"/> | ||
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> | ||
<argument name="product" value="$$createProduct$$"/> | ||
<argument name="productCount" value="1"/> | ||
</actionGroup> | ||
<!--Step 3: Go to checkout--> | ||
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart" /> | ||
<!--Step 4: Select Check/Money Order payment, fill required fields and click Update and Place Order--> | ||
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrderPayment"/> | ||
<actionGroup ref="GuestCheckoutFillNewBillingAddressActionGroup" stepKey="changeAddress"> | ||
<argument name="customerVar" value="Simple_US_NY_Customer"/> | ||
<argument name="customerAddressVar" value="US_Address_NY"/> | ||
</actionGroup> | ||
<click selector="{{CheckoutPaymentSection.update}}" stepKey="clickUpdateButton" /> | ||
<waitForPageLoad stepKey="waitUpdateAddress"/> | ||
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="placeOrder"> | ||
<argument name="orderNumberMessage" value="CONST.successGuestCheckoutOrderNumberMessage"/> | ||
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage" /> | ||
</actionGroup> | ||
<!--Step 5: Create customer account after placing order--> | ||
<actionGroup ref="StorefrontRegisterCustomerFromOrderSuccessPage" stepKey="createCustomerAfterPlaceOrder"> | ||
<argument name="customer" value="CustomerEntityOne"/> | ||
</actionGroup> | ||
<!--Step 6: Go To My Account -> My Downloadable Products and check if downloadable product link exist--> | ||
<actionGroup ref="StorefrontAssertDownloadableProductIsPresentInCustomerAccount" stepKey="seeStorefontMyDownloadableProductsProductName"> | ||
<argument name="product" value="$$createProduct$$"/> | ||
</actionGroup> | ||
</test> | ||
</tests> |
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
Oops, something went wrong.