Skip to content

Commit 2161e5c

Browse files
committed
Merge branch 'ACP2E-2693' of https://github.com/adobe-commerce-tier-4/magento2ce into 2.4-develop
2 parents f3876c1 + 37fbce3 commit 2161e5c

File tree

10 files changed

+320
-114
lines changed

10 files changed

+320
-114
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ************************************************************************
17+
*/
18+
-->
19+
20+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
22+
<actionGroup name="AssertStoreFrontCMSPageContentActionGroup">
23+
<annotations>
24+
<description>Validates that the provided CMS Page Title, Content and Heading are present and correct on a Storefront CMS Page.</description>
25+
</annotations>
26+
<arguments>
27+
<argument name="cmsContent" type="string"/>
28+
</arguments>
29+
30+
<see selector="{{StorefrontCMSPageSection.mainContent}}" userInput="{{cmsContent}}" stepKey="seeContent"/>
31+
</actionGroup>
32+
</actionGroups>
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ************************************************************************
17+
*/
18+
-->
19+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
21+
<test name="AdminCMSPageCreatePageWithBlockInNonStandardPlaceTest">
22+
<annotations>
23+
<features value="Cms"/>
24+
<stories value="Create a CMS Page via the Admin"/>
25+
<title value="Create CMS Page that puts block in non standard place via the Admin"/>
26+
<description value="Admin should be able to create a CMS Page with standard block in custom place"/>
27+
<severity value="MAJOR"/>
28+
<testCaseId value="AC-10974"/>
29+
<useCaseId value="ACP2E-2693"/>
30+
<group value="backend"/>
31+
<group value="Cms"/>
32+
<group value="WYSIWYGDisabled"/>
33+
<group value="pr_exclude"/>
34+
</annotations>
35+
<before>
36+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
37+
</before>
38+
<after>
39+
<!-- Clear Homepage -->
40+
<actionGroup ref="AdminEditCMSPageContentActionGroup" stepKey="clearRecentlyViewedWidgetsFromCMSContent">
41+
<argument name="content" value="{{CmsHomePageContent.content}}"/>
42+
<argument name="pageId" value="{{CmsHomePageContent.page_id}}"/>
43+
</actionGroup>
44+
45+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
46+
</after>
47+
48+
<!-- Add Subscribe block to HomePage -->
49+
<actionGroup ref="AdminEditCMSPageContentActionGroup" stepKey="addSubscribeBlockToHomePage">
50+
<argument name="content" value="{{block class=&apos;Magento\Newsletter\Block\Subscribe&apos; name=&apos;home.form.subscribe&apos; template=&apos;Magento_Newsletter::subscribe.phtml&apos;}}"/>
51+
<argument name="pageId" value="{{CmsHomePageContent.page_id}}"/>
52+
</actionGroup>
53+
54+
<!-- Verify page with Subscribe block on frontend -->
55+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnHomePage"/>
56+
<actionGroup ref="AssertStoreFrontCMSPageContentActionGroup" stepKey="verifySubscribeBlockToHomePage">
57+
<argument name="cmsContent" value="Subscribe"/>
58+
</actionGroup>
59+
60+
<!-- Add Contact block to HomePage -->
61+
<actionGroup ref="AdminEditCMSPageContentActionGroup" stepKey="addContactBlockToHomePage">
62+
<argument name="content" value="{{block class=&apos;Magento\Contact\Block\ContactForm&apos; name=&apos;home.form.contact&apos; template=&apos;Magento_Contact::form.phtml&apos;}}"/>
63+
<argument name="pageId" value="{{CmsHomePageContent.page_id}}"/>
64+
</actionGroup>
65+
66+
<!-- Verify page with Contact block on frontend -->
67+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnHomePage2"/>
68+
<actionGroup ref="AssertStoreFrontCMSPageContentActionGroup" stepKey="verifyContactBlockToHomePage">
69+
<argument name="cmsContent" value="Phone"/>
70+
</actionGroup>
71+
72+
<!-- Add Forgot Password block to HomePage -->
73+
<actionGroup ref="AdminEditCMSPageContentActionGroup" stepKey="addForgotPasswordBlockToHomePage">
74+
<argument name="content" value="{{block class=&apos;Magento\Customer\Block\Account\Forgotpassword&apos; name=&apos;home.form.forgotpassword&apos; template=&apos;Magento_Customer::form/forgotpassword.phtml&apos;}}"/>
75+
<argument name="pageId" value="{{CmsHomePageContent.page_id}}"/>
76+
</actionGroup>
77+
78+
<!-- Verify page with Forgot Password block on frontend -->
79+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnHomePage3"/>
80+
<actionGroup ref="AssertStoreFrontCMSPageContentActionGroup" stepKey="verifyForgotPasswordBlockToHomePage">
81+
<argument name="cmsContent" value="password"/>
82+
</actionGroup>
83+
84+
<!-- Add Login block to HomePage -->
85+
<actionGroup ref="AdminEditCMSPageContentActionGroup" stepKey="addLoginBlockToHomePage">
86+
<argument name="content" value="{{block class=&apos;Magento\Customer\Block\Form\Login&apos; name=&apos;home.form.login&apos; template=&apos;Magento_Customer::form/login.phtml&apos;}}"/>
87+
<argument name="pageId" value="{{CmsHomePageContent.page_id}}"/>
88+
</actionGroup>
89+
90+
<!-- Verify page with Login block on frontend -->
91+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnHomePage4"/>
92+
<actionGroup ref="AssertStoreFrontCMSPageContentActionGroup" stepKey="verifyLoginBlockToHomePage">
93+
<argument name="cmsContent" value="Registered"/>
94+
</actionGroup>
95+
96+
<!-- Add Register block to HomePage -->
97+
<actionGroup ref="AdminEditCMSPageContentActionGroup" stepKey="addRegisterBlockToHomePage">
98+
<argument name="content" value="{{block class=&apos;Magento\Customer\Block\Form\Register&apos; name=&apos;home.form.register&apos; template=&apos;Magento_Customer::form/register.phtml&apos;}}"/>
99+
<argument name="pageId" value="{{CmsHomePageContent.page_id}}"/>
100+
</actionGroup>
101+
102+
<!-- Verify page with Register block on frontend -->
103+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnHomePage5"/>
104+
<actionGroup ref="AssertStoreFrontCMSPageContentActionGroup" stepKey="verifyRegisterBlockToHomePage">
105+
<argument name="cmsContent" value="Personal"/>
106+
</actionGroup>
107+
108+
<!-- Add Send To Friend block to HomePage -->
109+
<actionGroup ref="AdminEditCMSPageContentActionGroup" stepKey="addSendToFriendBlockToHomePage">
110+
<argument name="content" value="{{block class=&apos;Magento\SendFriend\Block\Send&apos; name=&apos;home.form.send&apos; template=&apos;Magento_SendFriend::send.phtml&apos;}}"/>
111+
<argument name="pageId" value="{{CmsHomePageContent.page_id}}"/>
112+
</actionGroup>
113+
114+
<!-- Verify page with Send To Friend block on frontend -->
115+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnHomePage6"/>
116+
<actionGroup ref="AssertStoreFrontCMSPageContentActionGroup" stepKey="verifySendToFriendBlockToHomePage">
117+
<argument name="cmsContent" value="Sender"/>
118+
</actionGroup>
119+
120+
</test>
121+
</tests>

app/code/Magento/Contact/view/frontend/templates/form.phtml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,47 @@
88
// phpcs:disable Generic.Files.LineLength.TooLong
99

1010
/** @var \Magento\Contact\Block\ContactForm $block */
11+
if (!$block->getButtonLockManager()) {
12+
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
13+
$block->setButtonLockManager(
14+
$objectManager->get(\Magento\Framework\View\Element\ButtonLockManager::class)
15+
);
16+
}
17+
/** @var $escaper \Magento\Framework\Escaper */
1118
/** @var \Magento\Contact\ViewModel\UserDataProvider $viewModel */
1219

1320
$viewModel = $block->getViewModel();
1421
?>
1522
<form class="form contact"
16-
action="<?= $block->escapeUrl($block->getFormAction()) ?>"
23+
action="<?= $escaper->escapeUrl($block->getFormAction()) ?>"
1724
id="contact-form"
1825
method="post"
19-
data-hasrequired="<?= $block->escapeHtmlAttr(__('* Required Fields')) ?>"
26+
data-hasrequired="<?= $escaper->escapeHtmlAttr(__('* Required Fields')) ?>"
2027
data-mage-init='{"validation":{}}'>
2128
<fieldset class="fieldset">
22-
<legend class="legend"><span><?= $block->escapeHtml(__('Write Us')) ?></span></legend><br />
29+
<legend class="legend"><span><?= $escaper->escapeHtml(__('Write Us')) ?></span></legend><br />
2330
<div class="field note no-label">
24-
<?= $block->escapeHtml(__('Jot us a note and we’ll get back to you as quickly as possible.')) ?>
31+
<?= $escaper->escapeHtml(__('Jot us a note and we’ll get back to you as quickly as possible.')) ?>
2532
</div>
2633
<div class="field name required">
27-
<label class="label" for="name"><span><?= $block->escapeHtml(__('Name')) ?></span></label>
34+
<label class="label" for="name"><span><?= $escaper->escapeHtml(__('Name')) ?></span></label>
2835
<div class="control">
2936
<input name="name"
3037
id="name"
31-
title="<?= $block->escapeHtmlAttr(__('Name')) ?>"
32-
value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>"
38+
title="<?= $escaper->escapeHtmlAttr(__('Name')) ?>"
39+
value="<?= $escaper->escapeHtmlAttr($viewModel->getUserName()) ?>"
3340
class="input-text"
3441
type="text"
3542
data-validate="{required:true}"/>
3643
</div>
3744
</div>
3845
<div class="field email required">
39-
<label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
46+
<label class="label" for="email"><span><?= $escaper->escapeHtml(__('Email')) ?></span></label>
4047
<div class="control">
4148
<input name="email"
4249
id="email"
43-
title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
44-
value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>"
50+
title="<?= $escaper->escapeHtmlAttr(__('Email')) ?>"
51+
value="<?= $escaper->escapeHtmlAttr($viewModel->getUserEmail()) ?>"
4552
class="input-text"
4653
type="email"
4754
data-validate="{required:true, 'validate-email':true}"
@@ -50,42 +57,42 @@ $viewModel = $block->getViewModel();
5057
</div>
5158
</div>
5259
<div class="field telephone">
53-
<label class="label" for="telephone"><span><?= $block->escapeHtml(__('Phone Number')) ?></span></label>
60+
<label class="label" for="telephone"><span><?= $escaper->escapeHtml(__('Phone Number')) ?></span></label>
5461
<div class="control">
5562
<input name="telephone"
5663
id="telephone"
57-
title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>"
58-
value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>"
64+
title="<?= $escaper->escapeHtmlAttr(__('Phone Number')) ?>"
65+
value="<?= $escaper->escapeHtmlAttr($viewModel->getUserTelephone()) ?>"
5966
class="input-text"
6067
type="tel" />
6168
</div>
6269
</div>
6370
<div class="field comment required">
6471
<label class="label" for="comment">
65-
<span><?= $block->escapeHtml(__('What’s on your mind?')) ?></span>
72+
<span><?= $escaper->escapeHtml(__('What’s on your mind?')) ?></span>
6673
</label>
6774
<div class="control">
6875
<textarea name="comment"
6976
id="comment"
70-
title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>"
77+
title="<?= $escaper->escapeHtmlAttr(__('What’s on your mind?')) ?>"
7178
class="input-text"
7279
cols="5"
7380
rows="3"
7481
data-validate="{required:true}"
75-
><?= $block->escapeHtml($viewModel->getUserComment()) ?></textarea>
82+
><?= $escaper->escapeHtml($viewModel->getUserComment()) ?></textarea>
7683
</div>
7784
</div>
7885
<?= $block->getChildHtml('form.additional.info') ?>
7986
</fieldset>
8087
<div class="actions-toolbar">
8188
<div class="primary">
8289
<input type="hidden" name="hideit" id="hideit" value="" />
83-
<button type="submit" title="<?= $block->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary"
90+
<button type="submit" title="<?= $escaper->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary"
8491
id="send2"
8592
<?php if ($block->getButtonLockManager()->isDisabled('contact_us_form_submit')): ?>
8693
disabled="disabled"
8794
<?php endif; ?>>
88-
<span><?= $block->escapeHtml(__('Submit')) ?></span>
95+
<span><?= $escaper->escapeHtml(__('Submit')) ?></span>
8996
</button>
9097
</div>
9198
</div>

0 commit comments

Comments
 (0)