Skip to content

Commit 1064e35

Browse files
authored
Merge pull request #6167 from magento-arcticfoxes/pap-b2b-prs
[PAP B2B] Community Contributions
2 parents 97191ce + aef112e commit 1064e35

File tree

7 files changed

+241
-13
lines changed

7 files changed

+241
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="StorefrontVerifyCustomerAccountInformationActionGroup">
11+
<arguments>
12+
<argument name="customer"/>
13+
</arguments>
14+
<annotations>
15+
<description>Verifies customer information on the Edit Account Information page on the storefront</description>
16+
</annotations>
17+
<seeInField selector="{{StorefrontCustomerAccountInformationSection.firstName}}" userInput="{{customer.firstname}}" stepKey="seeCustomerFirstName"/>
18+
<seeInField selector="{{StorefrontCustomerAccountInformationSection.lastName}}" userInput="{{customer.lastname}}" stepKey="seeCustomerLastName"/>
19+
<seeElement selector="{{StorefrontCustomerAccountInformationSection.changeEmail}}" stepKey="seeChangeEmail"/>
20+
<seeElement selector="{{StorefrontCustomerAccountInformationSection.changePassword}}" stepKey="seeChangePassword"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Sales/Block/Order/Recent.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
namespace Magento\Sales\Block\Order;
77

88
use Magento\Framework\View\Element\Template\Context;
9-
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
109
use Magento\Customer\Model\Session;
1110
use Magento\Sales\Model\Order\Config;
11+
use Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface;
1212
use Magento\Store\Model\StoreManagerInterface;
1313
use Magento\Framework\App\ObjectManager;
1414

@@ -26,7 +26,7 @@ class Recent extends \Magento\Framework\View\Element\Template
2626
const ORDER_LIMIT = 5;
2727

2828
/**
29-
* @var \Magento\Sales\Model\ResourceModel\Order\CollectionFactory
29+
* @var CollectionFactoryInterface
3030
*/
3131
protected $_orderCollectionFactory;
3232

@@ -47,15 +47,15 @@ class Recent extends \Magento\Framework\View\Element\Template
4747

4848
/**
4949
* @param \Magento\Framework\View\Element\Template\Context $context
50-
* @param \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory
50+
* @param CollectionFactoryInterface $orderCollectionFactory
5151
* @param \Magento\Customer\Model\Session $customerSession
5252
* @param \Magento\Sales\Model\Order\Config $orderConfig
5353
* @param array $data
5454
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
5555
*/
5656
public function __construct(
5757
Context $context,
58-
CollectionFactory $orderCollectionFactory,
58+
CollectionFactoryInterface $orderCollectionFactory,
5959
Session $customerSession,
6060
Config $orderConfig,
6161
array $data = [],
@@ -84,11 +84,12 @@ protected function _construct()
8484
*/
8585
private function getRecentOrders()
8686
{
87-
$orders = $this->_orderCollectionFactory->create()->addAttributeToSelect(
87+
$customerId = $this->_customerSession->getCustomerId();
88+
$orders = $this->_orderCollectionFactory->create($customerId)->addAttributeToSelect(
8889
'*'
8990
)->addAttributeToFilter(
9091
'customer_id',
91-
$this->_customerSession->getCustomerId()
92+
$customerId
9293
)->addAttributeToFilter(
9394
'store_id',
9495
$this->storeManager->getStore()->getId()

app/code/Magento/Sales/CustomerData/LastOrderedItems.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LastOrderedItems implements SectionSourceInterface
2323
const SIDEBAR_ORDER_LIMIT = 5;
2424

2525
/**
26-
* @var \Magento\Sales\Model\ResourceModel\Order\CollectionFactory
26+
* @var \Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface
2727
*/
2828
protected $_orderCollectionFactory;
2929

@@ -68,7 +68,7 @@ class LastOrderedItems implements SectionSourceInterface
6868
private $logger;
6969

7070
/**
71-
* @param \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory
71+
* @param \Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface $orderCollectionFactory
7272
* @param \Magento\Sales\Model\Order\Config $orderConfig
7373
* @param \Magento\Customer\Model\Session $customerSession
7474
* @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
@@ -77,7 +77,7 @@ class LastOrderedItems implements SectionSourceInterface
7777
* @param LoggerInterface $logger
7878
*/
7979
public function __construct(
80-
\Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory,
80+
\Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface $orderCollectionFactory,
8181
\Magento\Sales\Model\Order\Config $orderConfig,
8282
\Magento\Customer\Model\Session $customerSession,
8383
\Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
@@ -103,7 +103,7 @@ protected function initOrders()
103103
{
104104
$customerId = $this->_customerSession->getCustomerId();
105105

106-
$orders = $this->_orderCollectionFactory->create()
106+
$orders = $this->_orderCollectionFactory->create($customerId)
107107
->addAttributeToFilter('customer_id', $customerId)
108108
->addAttributeToFilter('status', ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()])
109109
->addAttributeToSort('created_at', 'desc')
@@ -138,7 +138,7 @@ protected function getItems()
138138
$this->logger->critical($noEntityException);
139139
continue;
140140
}
141-
if (isset($product) && in_array($website, $product->getWebsiteIds())) {
141+
if (in_array($website, $product->getWebsiteIds())) {
142142
$url = $product->isVisibleInSiteVisibility() ? $product->getProductUrl() : null;
143143
$items[] = [
144144
'id' => $item->getId(),
@@ -188,7 +188,7 @@ protected function getLastOrder()
188188
}
189189

190190
/**
191-
* {@inheritdoc}
191+
* @inheritdoc
192192
*/
193193
public function getSectionData()
194194
{
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCreateCatalogProductsListWidgetActionGroup" extends="AdminCreateWidgetActionGroup">
12+
<annotations>
13+
<description>EXTENDS: AdminCreateWidgetActionGroup. Creates a Product List Widget. Validates that the Success Message is present and correct.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="title" defaultValue="" type="string"/>
17+
<argument name="displayPageControl" defaultValue="0" type="string"/>
18+
<argument name="numberOfProductsToDisplay" defaultValue="10" type="string"/>
19+
<argument name="cacheLifetime" defaultValue="" type="string"/>
20+
<argument name="condition" defaultValue="SKU" type="string"/>
21+
<argument name="conditionsOperator" defaultValue="is one of" type="string"/>
22+
<argument name="conditionParameter" defaultValue="" type="string"/>
23+
</arguments>
24+
<fillField selector="{{AdminNewWidgetSection.title}}" userInput="{{title}}" stepKey="fillTitleWidgetOption"/>
25+
<selectOption selector="{{AdminNewWidgetSection.displayPageControl}}" userInput="{{displayPageControl}}" stepKey="selectDisplayPageControl"/>
26+
<fillField selector="{{AdminNewWidgetSection.numberOfProductsToDisplay}}" userInput="{{numberOfProductsToDisplay}}" stepKey="fillNumberOfProductsToDisplay"/>
27+
<fillField selector="{{AdminNewWidgetSection.cacheLifetime}}" userInput="{{cacheLifetime}}" stepKey="fillCacheLifetime"/>
28+
<click selector="{{AdminNewWidgetSection.addNewCondition}}" stepKey="clickAddNewCondition"/>
29+
<selectOption selector="{{AdminNewWidgetSection.selectCondition}}" userInput="{{condition}}" stepKey="selectCondition"/>
30+
<waitForPageLoad stepKey="waitForConditionsOperator"/>
31+
<click selector="{{AdminNewWidgetSection.conditionOperator}}" stepKey="clickConditionsOperator"/>
32+
<selectOption selector="{{AdminNewWidgetSection.selectOperator}}" userInput="{{conditionsOperator}}" stepKey="selectConditionsOperator"/>
33+
<click selector="{{AdminNewWidgetSection.ruleParameter}}" stepKey="clickConditionParameter"/>
34+
<fillField selector="{{AdminNewWidgetSection.setRuleParameter}}" userInput="{{conditionParameter}}" stepKey="fillConditionParameter"/>
35+
<click selector="{{AdminNewWidgetSection.applyParameter}}" stepKey="clickApplyCondition"/>
36+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveWidget"/>
37+
<waitForPageLoad stepKey="waitForSave"/>
38+
<waitForText selector="{{AdminMessagesSection.success}}" userInput="The widget instance has been saved" stepKey="waitForSuccess"/>
39+
</actionGroup>
40+
</actionGroups>

app/code/Magento/Widget/Test/Mftf/ActionGroup/AdminCreateProductsListWidgetActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="AdminCreateProductsListWidgetActionGroup" extends="AdminCreateWidgetActionGroup">
11+
<actionGroup name="AdminCreateProductsListWidgetActionGroup" extends="AdminCreateWidgetActionGroup" deprecated="Use AdminCreateCatalogProductsListWidgetActionGroup instead">
1212
<annotations>
1313
<description>EXTENDS: AdminCreateWidgetActionGroup. Creates a Product List Widget. Validates that the Success Message is present and correct.</description>
1414
</annotations>

app/code/Magento/Widget/Test/Mftf/Section/AdminNewWidgetSection.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<element name="widgetOptions" type="select" selector="#widget_instace_tabs_properties_section"/>
2727
<element name="addNewCondition" type="select" selector=".rule-param.rule-param-new-child"/>
2828
<element name="selectCondition" type="input" selector="#conditions__1__new_child"/>
29+
<element name="conditionOperator" type="button" selector="#conditions__1__children>li:nth-child(1)>span:nth-child(3) a"/>
30+
<element name="selectOperator" type="select" selector="#conditions__1__children>li:nth-child(1)>span:nth-child(3) select"/>
2931
<element name="ruleParameter" type="select" selector="#conditions__1__children>li:nth-child(1)>span:nth-child(4)>a"/>
3032
<element name="setRuleParameter" type="input" selector="#conditions__1--1__value"/>
3133
<element name="applyParameter" type="button" selector=".rule-param-apply"/>
@@ -40,5 +42,10 @@
4042
<element name="displayMode" type="select" selector="select[id*='display_mode']"/>
4143
<element name="restrictTypes" type="select" selector="select[id*='types']"/>
4244
<element name="saveAndContinue" type="button" selector="#save_and_edit_button" timeout="30"/>
45+
<!-- Catalog Product List Widget Options -->
46+
<element name="title" type="input" selector="[name='parameters[title]']"/>
47+
<element name="displayPageControl" type="select" selector="[name='parameters[show_pager]']"/>
48+
<element name="numberOfProductsToDisplay" type="input" selector="[name='parameters[products_count]']"/>
49+
<element name="cacheLifetime" type="input" selector="[name='parameters[cache_lifetime]']"/>
4350
</section>
4451
</sections>
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
//
7+
// Actions -> Action select
8+
// _____________________________________________
9+
10+
//
11+
// Variables
12+
// _____________________________________________
13+
14+
@color-blue-pure: #007bdb;
15+
16+
@action__height: 3.2rem;
17+
@action__width: 3.2rem;
18+
19+
// Triangle marker
20+
@button-marker-triangle__height: .5rem;
21+
@button-marker-triangle__width: .8rem;
22+
23+
@button__border-color: @color-gray68;
24+
25+
@action__border-color: @color-gray68;
26+
@action__active__border-color: @action__border-color;
27+
@action__hover__border-color: @action__border-color;
28+
29+
@action-select__disabled__color: @text__color;
30+
@action-select__z-index: @z-index-5;
31+
32+
@field-control__box-shadow: 0 0 3px 1px @color-blue3;
33+
@field-control__active__border-color: @color-blue-pure;
34+
@field-control__hover__border-color: @action__hover__border-color;
35+
36+
@_dropdown__padding-right: @action__height;
37+
@_triangle__height: @button-marker-triangle__height;
38+
@_triangle__width: @button-marker-triangle__width;
39+
40+
// Action select have the same visual styles and functionality as native <select>
41+
.admin__action-group-wrap {
42+
@_action-select__border-color: @button__border-color;
43+
@_action-select__active__border-color: @action__active__border-color;
44+
@_action-select-toggle__size: @action__height;
45+
46+
display: inline-block;
47+
position: relative;
48+
49+
.action-select {
50+
.lib-text-overflow();
51+
52+
background-color: @color-white;
53+
font-weight: @font-weight__regular;
54+
text-align: left;
55+
56+
&:hover {
57+
border-color: @color-gray68;
58+
59+
&:before {
60+
border-color: @field-control__hover__border-color;
61+
}
62+
}
63+
64+
// Toggle action
65+
&:extend(.abs-icon-add all);
66+
67+
&:before {
68+
align-items: center;
69+
content: @icon-down;
70+
display: flex;
71+
font-size: 24px;
72+
justify-content: space-around;
73+
line-height: 1;
74+
position: absolute;
75+
right: 0;
76+
width: @action__width;
77+
}
78+
79+
&._active {
80+
&:before {
81+
content: @icon-up;
82+
}
83+
}
84+
85+
&[disabled] {
86+
color: @action-select__disabled__color;
87+
}
88+
89+
&._mage-error {
90+
border: 1px solid @form-element-validation__border-error;
91+
}
92+
}
93+
94+
&._focus {
95+
.action-select {
96+
&._mage-error {
97+
border: 1px solid @form-element-validation__border-error;
98+
}
99+
}
100+
}
101+
102+
&._active {
103+
z-index: @action-select__z-index;
104+
105+
.action-select {
106+
&:before {
107+
content: @icon-up;
108+
}
109+
}
110+
111+
.action-menu {
112+
.lib-css(box-shadow, @field-control__box-shadow);
113+
}
114+
}
115+
116+
.action-menu {
117+
border: 1px solid @action__border-color;
118+
display: none;
119+
max-height: 45rem;
120+
overflow-y: auto;
121+
122+
&._active {
123+
display: block;
124+
}
125+
126+
._disabled {
127+
&:hover {
128+
background: @color-white;
129+
}
130+
131+
.action-menu-item {
132+
cursor: default;
133+
opacity: .5;
134+
}
135+
}
136+
}
137+
138+
.action-menu-items {
139+
left: 0;
140+
position: absolute;
141+
right: 0;
142+
top: 100%;
143+
144+
> .action-menu {
145+
min-width: 100%;
146+
position: static;
147+
148+
.action-submenu {
149+
position: absolute;
150+
right: -100%;
151+
}
152+
}
153+
}
154+
155+
.validate-select-field {
156+
.lib-visually-hidden();
157+
}
158+
}

0 commit comments

Comments
 (0)