Skip to content

Commit

Permalink
Merge pull request #3586 from magento-tsg/2.3-develop-pr39
Browse files Browse the repository at this point in the history
[TSG] Upporting for 2.3 (pr39) (2.3.1)
  • Loading branch information
xmav authored Jan 10, 2019
2 parents e62d140 + 706aec8 commit d7ac52b
Show file tree
Hide file tree
Showing 35 changed files with 658 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
<click selector="{{AdminProductGridSection.bulkActionOption('Change status')}}" stepKey="clickChangeStatusAction"/>
<click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled" parameterized="true"/>
<waitForPageLoad stepKey="waitForStatusToBeChanged"/>
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/>
<waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<!--Create website, Sore adn Store View-->
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="adminCreateWebsite">
<argument name="newWebsiteName" value="secondWebsite"/>
<argument name="websiteCode" value="second_website"/>
<!--Create website, Store and Store View-->
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createSecondWebsite">
<argument name="newWebsiteName" value="{{secondCustomWebsite.name}}"/>
<argument name="websiteCode" value="{{secondCustomWebsite.code}}"/>
</actionGroup>
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="adminCreateStore">
<argument name="website" value="secondWebsite"/>
<argument name="storeGroupName" value="secondStore"/>
<argument name="storeGroupCode" value="second_store"/>
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createSecondStoreGroup">
<argument name="website" value="{{secondCustomWebsite.name}}"/>
<argument name="storeGroupName" value="{{SecondStoreGroupUnique.name}}"/>
<argument name="storeGroupCode" value="{{SecondStoreGroupUnique.code}}"/>
</actionGroup>
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="adminCreateStoreView">
<argument name="StoreGroup" value="customStoreTierPrice"/>
<argument name="customStore" value="customStoreView"/>
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView">
<argument name="StoreGroup" value="SecondStoreGroupUnique"/>
<argument name="customStore" value="SecondStoreUnique"/>
</actionGroup>

<!--Create Simple Product and Category -->
Expand Down Expand Up @@ -60,9 +60,7 @@
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenWebsiteSection"/>
<waitForPageLoad stepKey="waitForToOpenedWebsiteSection"/>
<uncheckOption selector="{{ProductInWebsitesSection.website('Main Website')}}" stepKey="uncheckWebsite"/>
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."
stepKey="seeSuccessMessage"/>
<actionGroup ref="saveProductForm" stepKey="saveProduct1"/>

<!-- Set filter to product name and product2 in website 2 only -->
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct2">
Expand All @@ -72,12 +70,10 @@
<argument name="product" value="$$createProduct2$$"/>
</actionGroup>
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectProductInWebsites">
<argument name="website" value="secondWebsite"/>
<argument name="website" value="{{secondCustomWebsite.name}}"/>
</actionGroup>
<uncheckOption selector="{{ProductInWebsitesSection.website('Main Website')}}" stepKey="uncheckWebsite1"/>
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct1"/>
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."
stepKey="seeSuccessMessage1"/>
<actionGroup ref="saveProductForm" stepKey="saveProduct2"/>

<!-- Set filter to product name and product12 assigned to both websites 1 and 2 -->
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct12">
Expand All @@ -87,15 +83,13 @@
<argument name="product" value="$$createProduct12$$"/>
</actionGroup>
<actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectProductInWebsites1">
<argument name="website" value="secondWebsite"/>
<argument name="website" value="{{secondCustomWebsite.name}}"/>
</actionGroup>
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct2"/>
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."
stepKey="seeSuccessMessage2"/>
<actionGroup ref="saveProductForm" stepKey="saveProduct3"/>
</before>
<after>
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
<argument name="websiteName" value="secondWebsite"/>
<argument name="websiteName" value="{{secondCustomWebsite.name}}"/>
</actionGroup>
<actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/>
<deleteData createDataKey="createProduct0" stepKey="deleteProduct"/>
Expand All @@ -107,7 +101,6 @@
</after>
<!-- Step 1-2: Open Category page and Set scope selector to All Store Views-->
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/>
<waitForPageLoad stepKey="waitForCategoryPageLoad"/>
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}"
stepKey="clickCategoryName"/>
<click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection"/>
Expand All @@ -126,17 +119,9 @@

<!-- Step 3: Set scope selector to Website1( Storeview for the Website 1) -->
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}"
stepKey="clickStoresList"/>
<waitForPageLoad stepKey="waitForCategoryPageLoad1"/>
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption('Default Store View')}}"
stepKey="clickStoreView"/>
<waitForElementVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
stepKey="waitForPopup1"/>
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}" stepKey="clickActionAccept"/>
<waitForElementNotVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
stepKey="waitForNotVisibleModalAccept"/>
<waitForPageLoad stepKey="waitForCategoryPageLoad2"/>
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="swichToDefaultStoreView">
<argument name="storeView" value="_defaultStore.name"/>
</actionGroup>
<grabTextFrom selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}"
stepKey="grabTextFromCategory1"/>
<assertRegExp expected="/\(2\)$/" expectedType="string" actual="$grabTextFromCategory1" actualType="variable"
Expand All @@ -154,18 +139,9 @@

<!-- Step 4: Set scope selector to Website2 ( StoreView for Website 2) -->
<scrollToTopOfPage stepKey="scrollToTopOfPage1"/>
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}"
stepKey="clickStoresList1"/>
<waitForPageLoad stepKey="waitForCategoryPageLoad3"/>
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewOption('secondStoreView')}}"
stepKey="clickStoreView1"/>
<waitForElementVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
stepKey="waitForPopup2"/>
<click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
stepKey="clickActionAccept1"/>
<waitForElementNotVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}"
stepKey="waitForNotVisibleModalAccept1"/>
<waitForPageLoad stepKey="waitForCategoryPageLoad4"/>
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="swichToSecondStoreView">
<argument name="storeView" value="SecondStoreUnique.name"/>
</actionGroup>
<click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection2"/>
<grabTextFrom selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}"
stepKey="grabTextFromCategory2"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ protected function collectMultiselectValues($item, $attrCode, $storeId)
}

/**
* Check attribute is valid
* Check attribute is valid.
*
* @param string $code
* @param mixed $value
Expand All @@ -1175,6 +1175,10 @@ protected function isValidAttributeValue($code, $value)
$isValid = false;
}

if (is_array($value)) {
$isValid = false;
}

return $isValid;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?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="StorefrontGuestCheckoutDataPersistTest">
<annotations>
<features value="Checkout"/>
<stories value="MAGETWO-95068: Checkout data (shipping address etc) not persistant after cart update"/>
<title value="Check that checkout data persist after cart update"/>
<description value="Checkout data should be persist after updating cart"/>
<severity value="CRITICAL"/>
<testCaseId value="MAGETWO-96979"/>
<group value="checkout"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="_defaultProduct" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
</before>
<after>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
</after>

<!-- Add simple product to cart -->
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>
<!-- Navigate to checkout -->
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
<!-- Fill shipping address -->
<actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShipping">
<argument name="shippingMethod" value="Flat Rate"/>
</actionGroup>
<!-- Add simple product to cart -->
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart1">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>
<!-- Navigate to checkout -->
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart1"/>
<seeInField selector="{{CheckoutShippingGuestInfoSection.email}}" userInput="{{CustomerEntityOne.email}}" stepKey="assertGuestEmail"/>
<seeInField selector="{{CheckoutShippingGuestInfoSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="assertGuestFirstName"/>
<seeInField selector="{{CheckoutShippingGuestInfoSection.lastName}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="assertGuestLastName"/>
<seeInField selector="{{CheckoutShippingGuestInfoSection.street}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="assertGuestStreet"/>
<seeInField selector="{{CheckoutShippingGuestInfoSection.city}}" userInput="{{CustomerAddressSimple.city}}" stepKey="assertGuestCity"/>
<seeInField selector="{{CheckoutShippingGuestInfoSection.region}}" userInput="{{CustomerAddressSimple.state}}" stepKey="assertGuestRegion"/>
<seeInField selector="{{CheckoutShippingGuestInfoSection.postcode}}" userInput="{{CustomerAddressSimple.postcode}}" stepKey="assertGuestPostcode"/>
<seeInField selector="{{CheckoutShippingGuestInfoSection.telephone}}" userInput="{{CustomerAddressSimple.telephone}}" stepKey="assertGuestTelephone"/>
</test>
</tests>
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="CustomerLogoutStorefrontByMenuItemsActionGroup">
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcome}}"
dependentSelector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}"
visible="false"
stepKey="clickHeaderCustomerMenuButton" />
<click selector="{{StorefrontPanelHeaderSection.customerLogoutLink}}" stepKey="clickSignOutButton" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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="StorefrontCustomerLogoutSuccessPage" url="customer/account/logoutSuccess/" area="storefront" module="Magento_Customer"/>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
<element name="WelcomeMessage" type="text" selector=".greet.welcome span"/>
<element name="createAnAccountLink" type="select" selector=".panel.header li:nth-child(3)" timeout="30"/>
<element name="notYouLink" type="button" selector=".greet.welcome span a"/>
<element name="customerWelcome" type="text" selector=".panel.header .customer-welcome"/>
<element name="customerWelcomeMenu" type="text" selector=".panel.header .customer-welcome .customer-menu"/>
<element name="customerLogoutLink" type="text" selector=".panel.header .customer-welcome .customer-menu .authorization-link a" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ define([
$.cookieStorage.set(privateContentVersion, privateContent);
}
$.localStorage.set(privateContentVersion, privateContent);
_.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {
buffer.notify(sectionName, sectionData);
});
this.reload([], false);
isLoading = true;
} else if (expiredSectionNames.length > 0) {
Expand Down
54 changes: 43 additions & 11 deletions app/code/Magento/Persistent/Block/Header/Additional.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*/
namespace Magento\Persistent\Block\Header;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Persistent\Helper\Data;

/**
* Remember Me block
*
Expand All @@ -30,27 +34,46 @@ class Additional extends \Magento\Framework\View\Element\Html\Link
protected $customerRepository;

/**
* Constructor
*
* @var string
*/
protected $_template = 'Magento_Persistent::additional.phtml';

/**
* @var Json
*/
private $jsonSerializer;

/**
* @var Data
*/
private $persistentHelper;

/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Customer\Helper\View $customerViewHelper
* @param \Magento\Persistent\Helper\Session $persistentSessionHelper
* @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
* @param array $data
* @param Json|null $jsonSerializer
* @param Data|null $persistentHelper
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Customer\Helper\View $customerViewHelper,
\Magento\Persistent\Helper\Session $persistentSessionHelper,
\Magento\Customer\Api\CustomerRepositoryInterface $customerRepository,
array $data = []
array $data = [],
Json $jsonSerializer = null,
Data $persistentHelper = null
) {
$this->isScopePrivate = true;
$this->_customerViewHelper = $customerViewHelper;
$this->_persistentSessionHelper = $persistentSessionHelper;
$this->customerRepository = $customerRepository;
parent::__construct($context, $data);
$this->_isScopePrivate = true;
$this->jsonSerializer = $jsonSerializer ?: ObjectManager::getInstance()->get(Json::class);
$this->persistentHelper = $persistentHelper ?: ObjectManager::getInstance()->get(Data::class);
}

/**
Expand All @@ -64,17 +87,26 @@ public function getHref()
}

/**
* Render additional header html
* Get customer id.
*
* @return string
* @return int
*/
protected function _toHtml()
public function getCustomerId(): int
{
if ($this->_persistentSessionHelper->getSession()->getCustomerId()) {
return '<span><a ' . $this->getLinkAttributes() . ' >' . __('Not you?')
. '</a></span>';
}
return $this->_persistentSessionHelper->getSession()->getCustomerId();
}

return '';
/**
* Get persistent config.
*
* @return string
*/
public function getConfig(): string
{
return $this->jsonSerializer->serialize(
[
'expirationLifetime' => $this->persistentHelper->getLifeTime(),
]
);
}
}
Loading

0 comments on commit d7ac52b

Please sign in to comment.