Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

25162 fixed wrong format link #26455

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ public function execute()
$message = $this->getSuccessMessage((int)$subscriber->getSubscriberStatus());
$this->messageManager->addSuccessMessage($message);
} catch (LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
$this->messageManager->addComplexErrorMessage(
'localizedSubscriptionErrorMessage',
['message' => $e->getMessage()]
);
} catch (\Exception $e) {
$this->messageManager->addExceptionMessage($e, __('Something went wrong with the subscription.'));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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="StorefrontCreateNewSubscriberActionGroup">
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/>
<submitForm selector="{{BasicFrontendNewsletterFormSection.subscribeForm}}"
parameterArray="['email' => '{{_defaultNewsletter.senderEmail}}']"
button="{{BasicFrontendNewsletterFormSection.subscribeButton}}" stepKey="submitForm"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<waitForElementVisible stepKey="waitForErrorAppears" selector="{{StorefrontMessagesSection.error}}"/>
</actionGroup>
</actionGroups>
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="AdminNewsletterConfigPage" url="admin/system_config/edit/section/newsletter/" area="admin" module="Magento_Newsletter">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to provide admin/ at the beginning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lbajsarowicz.
After changes url="admin/system_config/edit/section/newsletter/" to url="system_config/edit/section/newsletter/"

I am getting such issue. I can't visit config page correctly.
Screenshot 2020-01-27 at 13 38 03

Also I couldn't find examples in core without admin/
Could You Please advise me something about it. If you can.

Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'm sorry, revert admin/ then. I'll take a look into it later :-)

<section name="AdminNewsletterConfigPageSubscriptionOptionsSection"/>
</page>
</pages>
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="AdminNewsletterConfigPageSubscriptionOptionsSection">
<element name="allowGuestSubscription" type="checkbox" selector="input[name='groups[subscription][fields][allow_guest_subscribe][inherit]']" timeout="30"/>
<element name="guestSubscription" type="select" selector="#newsletter_subscription_allow_guest_subscribe" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
-->
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="BasicFrontendNewsletterFormSection">
<element name="newsletterEmail" type="input" selector="#newsletter"/>
<element name="subscribeButton" type="button" selector=".subscribe" timeout="30"/>
<element name="subscribeForm" type="input" selector="#newsletter-validate-detail" timeout="30"/>
</section>
<section name="BasicFieldNewsletterSection">
<element name="templateName" type="input" selector="#code"/>
<element name="templateSubject" type="input" selector="#subject"/>
Expand Down
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.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="VerifyRegistredLinkDisplayedForGuestSubscriptionNoTest">
<before>
<magentoCLI command="config:set newsletter/subscription/allow_guest_subscribe 0"
stepKey="setConfigGuestSubscriptionDisable"/>
</before>
<actionGroup ref="StorefrontCreateNewSubscriberActionGroup" stepKey="createSubscriber"/>
</test>
</tests>
12 changes: 12 additions & 0 deletions app/code/Magento/Newsletter/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,16 @@
</argument>
</arguments>
</type>
<type name="Magento\Framework\View\Element\Message\MessageConfigurationsPool">
<arguments>
<argument name="configurationsMap" xsi:type="array">
<item name="localizedSubscriptionErrorMessage" xsi:type="array">
<item name="renderer" xsi:type="const">\Magento\Framework\View\Element\Message\Renderer\BlockRenderer::CODE</item>
<item name="data" xsi:type="array">
<item name="template" xsi:type="string">Magento_Newsletter::messages/localizedSubscriptionErrorMessage.phtml</item>
</item>
</item>
</argument>
</arguments>
</type>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/** @var \Magento\Framework\View\Element\Template $block */
?>
<?= $block->escapeHtml(__($block->getData('message')), ['a']); ?>