-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-56349: [GITHUB] Newsletter Queue doesn't set to local time #5943
- Loading branch information
1 parent
86eed24
commit d00a950
Showing
6 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Queue/Grid.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Newsletter\Test\Block\Adminhtml\Queue; | ||
|
||
use Magento\Mtf\Client\Locator; | ||
|
||
/** | ||
* Newsletter queue templates grid block. | ||
*/ | ||
class Grid extends \Magento\Backend\Test\Block\Widget\Grid | ||
{ | ||
/** | ||
* Filters array mapping. | ||
* | ||
* @var array | ||
*/ | ||
protected $filters = [ | ||
'newsletter_subject' => [ | ||
'selector' => 'input[name="newsletter_subject"]', | ||
], | ||
]; | ||
|
||
/** | ||
* Locator value for link in action column. | ||
* | ||
* @var string | ||
*/ | ||
protected $editLink = 'td.col-subject'; | ||
|
||
/** | ||
* Locator for "Action". | ||
* | ||
* @var string | ||
*/ | ||
protected $action = '.col-actions [class*="control-select"]'; | ||
|
||
/** | ||
* Action for newsletter queue template. | ||
* | ||
* @param string $action | ||
* @return void | ||
*/ | ||
public function performAction($action) | ||
{ | ||
$this->_rootElement->find($this->action, Locator::SELECTOR_CSS, 'select')->setValue($action); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...unctional/tests/app/Magento/Newsletter/Test/Constraint/AssertNewsletterQueueDateStart.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Newsletter\Test\Constraint; | ||
|
||
use Magento\Mtf\Constraint\AbstractAssertForm; | ||
use Magento\Newsletter\Test\Fixture\Template; | ||
use Magento\Newsletter\Test\Page\Adminhtml\TemplateQueue; | ||
use Magento\Newsletter\Test\Page\Adminhtml\TemplateQueueIndex; | ||
|
||
/** | ||
* Assert that field "Queue Date Start" saved correctly. | ||
*/ | ||
class AssertNewsletterQueueDateStart extends AbstractAssertForm | ||
{ | ||
/** | ||
* Assert that Field "Queue Date Start" saved correctly. | ||
* | ||
* @param TemplateQueueIndex $indexQueue | ||
* @param TemplateQueue $templateQueue | ||
* @param Template $newsletter | ||
* @param string $date | ||
* @return void | ||
*/ | ||
public function processAssert( | ||
TemplateQueueIndex $indexQueue, | ||
TemplateQueue $templateQueue, | ||
Template $newsletter, | ||
string $date | ||
) { | ||
$indexQueue->open(); | ||
$indexQueue->getQueueTemplateGrid()->searchAndOpen(['newsletter_subject' => $newsletter->getSubject()]); | ||
\PHPUnit_Framework_Assert::assertEquals( | ||
$date, | ||
$templateQueue->getEditForm()->getDateStart(), | ||
'Field "Queue Date Start" did\'t save correctly' | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function toString() | ||
{ | ||
return 'Field "Queue Date Start" saved correctly'; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueueIndex.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> | ||
<page name="TemplateQueueIndex" area="Adminhtml" mca="newsletter/queue/index" module="Magento_Newsletter"> | ||
<block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> | ||
<block name="gridPageActions" class="Magento\Newsletter\Test\Block\Adminhtml\Template\GridPageActions" locator=".page-main-actions" strategy="css selector"/> | ||
<block name="queueTemplateGrid" class="Magento\Newsletter\Test\Block\Adminhtml\Queue\Grid" locator="[id='page:main-container']" strategy="css selector"/> | ||
</page> | ||
</config> |
97 changes: 97 additions & 0 deletions
97
dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/UpdateQueueStartDateTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Newsletter\Test\TestCase; | ||
|
||
use Magento\Newsletter\Test\Fixture\Template; | ||
use Magento\Newsletter\Test\Page\Adminhtml\TemplateIndex; | ||
use Magento\Mtf\TestCase\Injectable; | ||
use Magento\Newsletter\Test\Page\Adminhtml\TemplateQueue; | ||
use Magento\Newsletter\Test\Page\Adminhtml\TemplateQueueIndex; | ||
|
||
/** | ||
* Test to update Start Date in Newsletter Queue. | ||
* | ||
* Test Flow: | ||
* Preconditions: | ||
* 1. Create newsletter | ||
* | ||
* Steps: | ||
* 1. Open Backend | ||
* 2. Go to Marketing > Newsletter Template | ||
* 3. Find created template in grid | ||
* 4. Execute "Queue Newsletter" action | ||
* 5. Fill Date Start | ||
* 6. Save Newsletter Queue | ||
* | ||
* @group Newsletters | ||
* @ZephyrId MAGETWO-71653 | ||
*/ | ||
class UpdateQueueStartDateTest extends Injectable | ||
{ | ||
/* tags */ | ||
const MVP = 'yes'; | ||
const STABLE = 'no'; | ||
/* end tags */ | ||
|
||
/** | ||
* Page with newsletter template grid. | ||
* | ||
* @var TemplateIndex | ||
*/ | ||
protected $templateIndex; | ||
|
||
/** | ||
* Page with newsletter queue grid. | ||
* | ||
* @var TemplateQueueIndex | ||
*/ | ||
protected $indexQueue; | ||
|
||
/** | ||
* Page for edit newsletter queue. | ||
* | ||
* @var TemplateQueue | ||
*/ | ||
protected $templateQueue; | ||
|
||
/** | ||
* Inject newsletter page. | ||
* | ||
* @param TemplateIndex $templateIndex | ||
* @param TemplateQueueIndex $indexQueue | ||
* @param TemplateQueue $templateQueue | ||
* @return void | ||
*/ | ||
public function __inject( | ||
TemplateIndex $templateIndex, | ||
TemplateQueueIndex $indexQueue, | ||
TemplateQueue $templateQueue | ||
) { | ||
$this->templateIndex = $templateIndex; | ||
$this->indexQueue = $indexQueue; | ||
$this->templateQueue = $templateQueue; | ||
} | ||
|
||
/** | ||
* @param Template $newsletter | ||
* @param string $date | ||
* @return void | ||
*/ | ||
public function test(Template $newsletter, $date) | ||
{ | ||
// Preconditions | ||
$newsletter->persist(); | ||
|
||
// Steps | ||
$this->templateIndex->open(); | ||
$this->templateIndex->getNewsletterTemplateGrid()->search(['code' => $newsletter->getCode()]); | ||
$this->templateIndex->getNewsletterTemplateGrid()->performAction('Queue Newsletter'); | ||
$this->templateQueue->getEditForm()->setDateStart($date); | ||
$this->templateQueue->getFormPageActions()->save(); | ||
$this->indexQueue->getMessagesBlock()->assertSuccessMessage(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/UpdateQueueStartDateTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> | ||
<testCase name="Magento\Newsletter\Test\TestCase\UpdateQueueStartDateTest" summary="Update Queue Date Start" ticketId="MAGETWO-71653"> | ||
<variation name="UpdateQueueStartDateTestVariation1"> | ||
<data name="newsletter/dataset" xsi:type="string">default</data> | ||
<data name="date" xsi:type="string">Aug 17, 2017 2:50:30 PM</data> | ||
<constraint name="Magento\Newsletter\Test\Constraint\AssertNewsletterQueueDateStart" /> | ||
</variation> | ||
</testCase> | ||
</config> |