Skip to content

Commit b075d5e

Browse files
authored
ENGCOM-7977: #29354 :- Login as Customer storefront banner is not sticky #29415
2 parents 2e021fd + bb051f2 commit b075d5e

File tree

4 files changed

+122
-31
lines changed

4 files changed

+122
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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="AssertStorefrontStickyLoginAsCustomerNotificationBannerActionGroup">
12+
<annotations>
13+
<description>Verify Sticky Login as Customer notification banner present on page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="customerFullName" type="string"/>
17+
<argument name="websiteName" type="string" defaultValue="Main Website"/>
18+
</arguments>
19+
20+
<waitForElementVisible selector="{{StorefrontLoginAsCustomerNotificationSection.notificationText}}" stepKey="waitForNotificationBanner"/>
21+
<see selector="{{StorefrontLoginAsCustomerNotificationSection.notificationText}}"
22+
userInput="You are connected as {{customerFullName}} on {{websiteName}}"
23+
stepKey="assertCorrectNotificationBannerMessage"/>
24+
<seeElement selector="{{StorefrontLoginAsCustomerNotificationSection.closeLink}}"
25+
stepKey="assertCloseNotificationBannerPresent"/>
26+
<executeJS function="window.scrollTo(0,document.body.scrollHeight);" stepKey="scrollToBottomOfPage"/>
27+
<see selector="{{StorefrontLoginAsCustomerNotificationSection.notificationText}}"
28+
userInput="You are connected as {{customerFullName}} on {{websiteName}}"
29+
stepKey="assertCorrectNotificationBannerMessageAfterScroll"/>
30+
<seeElement selector="{{StorefrontLoginAsCustomerNotificationSection.closeLink}}"
31+
stepKey="assertCloseNotificationBannerPresentAfterScroll"/>
32+
</actionGroup>
33+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontStickyLoginAsCustomerNotificationBannerTest">
12+
<annotations>
13+
<features value="Login as Customer"/>
14+
<useCaseId value="https://github.com/magento/magento2/issues/29354"/>
15+
<stories value="Availability of sticky UI elements if module enable/disable"/>
16+
<title value="Sticky Notification Banner is present on Storefront page"/>
17+
<description
18+
value="Verify that Sticky Notification Banner is present on page if 'Login as customer' functionality used"/>
19+
<testCaseId value=""/>
20+
<group value="login_as_customer"/>
21+
<severity value="CRITICAL"/>
22+
</annotations>
23+
<before>
24+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 1"
25+
stepKey="enableLoginAsCustomer"/>
26+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanConfigCache">
27+
<argument name="tags" value="config"/>
28+
</actionGroup>
29+
<createData entity="Simple_US_Customer_Assistance_Allowed" stepKey="createCustomer"/>
30+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
31+
</before>
32+
33+
<after>
34+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
35+
<magentoCLI command="config:set {{LoginAsCustomerConfigDataEnabled.path}} 0"
36+
stepKey="disableLoginAsCustomer"/>
37+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanConfigCache">
38+
<argument name="tags" value="config"/>
39+
</actionGroup>
40+
</after>
41+
42+
<actionGroup ref="AdminLoginAsCustomerLoginFromCustomerPageActionGroup" stepKey="loginAsCustomerFromCustomerPage">
43+
<argument name="customerId" value="$$createCustomer.id$$"/>
44+
</actionGroup>
45+
46+
<actionGroup ref="AssertStorefrontStickyLoginAsCustomerNotificationBannerActionGroup" stepKey="assertStickyNotificationBanner">
47+
<argument name="customerFullName" value="$$createCustomer.firstname$$ $$createCustomer.lastname$$"/>
48+
</actionGroup>
49+
50+
<actionGroup ref="StorefrontSignOutNotificationBannerAndCloseTabActionGroup" stepKey="signOutAndCloseTab"/>
51+
</test>
52+
</tests>

app/code/Magento/LoginAsCustomerFrontendUi/view/frontend/templates/html/notices.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
$viewFileUrl = $block->getViewFileUrl('Magento_LoginAsCustomerFrontendUi::images/magento-icon.svg');
1212
?>
1313
<?php if ($block->getConfig()->isEnabled()): ?>
14-
<div data-bind="scope: 'loginAsCustomer'" >
14+
<div class="lac-notification-sticky"
15+
data-mage-init='{"sticky":{"container": "body"}}'
16+
data-bind="scope: 'loginAsCustomer'" >
1517
<div class="lac-notification clearfix" data-bind="visible: isVisible" style="display: none">
1618
<div class="top-container">
1719
<div class="lac-notification-icon wrapper">

app/code/Magento/LoginAsCustomerFrontendUi/view/frontend/web/css/source/_module.less

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,47 @@
1616
// ---------------------------------------------
1717

1818
& when (@media-common = true) {
19-
.lac-notification {
20-
background-color: @lac-notification-background-color;
21-
color: @lac-notification-color;
22-
font-size: 16px;
19+
.lac-notification-sticky {
20+
position: relative;
21+
z-index: 999;
22+
.lac-notification {
23+
background-color: @lac-notification-background-color;
24+
color: @lac-notification-color;
25+
font-size: 16px;
2326

24-
.lac-notification-icon {
25-
float: left;
26-
margin: 10px 25px 10px 10px;
27+
.lac-notification-icon {
28+
float: left;
29+
margin: 10px 25px 10px 10px;
2730

28-
.logo-img {
29-
display: block
31+
.logo-img {
32+
display: block
33+
}
3034
}
31-
}
3235

33-
.lac-notification-text {
34-
float: left;
35-
padding: 15px 0;
36-
}
36+
.lac-notification-text {
37+
float: left;
38+
padding: 15px 0;
39+
}
3740

38-
.lac-notification-links {
39-
float: right;
40-
padding: 15px 0;
41+
.lac-notification-links {
42+
float: right;
43+
padding: 15px 0;
4144

42-
a {
43-
color: @lac-notification-links-color;
44-
font-size: 14px;
45-
}
45+
a {
46+
color: @lac-notification-links-color;
47+
font-size: 14px;
48+
}
4649

47-
.lac-notification-close-link {
48-
&:after {
49-
background: url('../Magento_LoginAsCustomerFrontendUi/images/close.svg');
50-
content: ' ';
51-
display: inline-block;
52-
height: 12px;
53-
margin-left: 5px;
54-
vertical-align: middle;
55-
width: 12px;
50+
.lac-notification-close-link {
51+
&:after {
52+
background: url('../Magento_LoginAsCustomerFrontendUi/images/close.svg');
53+
content: ' ';
54+
display: inline-block;
55+
height: 12px;
56+
margin-left: 5px;
57+
vertical-align: middle;
58+
width: 12px;
59+
}
5660
}
5761
}
5862
}

0 commit comments

Comments
 (0)