Files
piratepoet/tests/acceptance/DeleteAutomaticWooCommerceEmailCest.php
2019-10-08 14:22:55 +01:00

78 lines
2.6 KiB
PHP

<?php
namespace MailPoet\Test\Acceptance;
use MailPoet\Test\DataFactories\Newsletter;
class DeleteAutomaticWooCommerceEmailCest {
function _before(\AcceptanceTester $I) {
$I->activateWooCommerce();
}
function trashAutomaticWooCommerceEmail(\AcceptanceTester $I) {
$newsletter_name = 'Trash Automatic WooCommerce Email Test';
$newsletter_factory = new Newsletter();
$newsletter_factory
->withSubject($newsletter_name)
->withAutomaticTypeWooCommerceFirstPurchase()
->create();
$I->wantTo('Trash automatic WooCommerce email');
$I->login();
$I->amOnMailpoetPage('Emails');
$I->click('[data-automation-id="tab-WooCommerce"]');
$I->waitForText($newsletter_name);
$I->clickItemRowActionByItemName($newsletter_name, 'Move to trash');
$I->waitForElement('[data-automation-id="filters_trash"]');
$I->click('[data-automation-id="filters_trash"]');
$I->waitForText($newsletter_name);
}
function restoreTrashedAutomaticWooCommerceEmail(\AcceptanceTester $I) {
$newsletter_name = 'Restore Trashed Automatic WooCommerce Email Test';
$newsletter_factory = new Newsletter();
$newsletter_factory
->withSubject($newsletter_name)
->withAutomaticTypeWooCommerceFirstPurchase()
->withDeleted()
->create();
$I->wantTo('Restore trashed automatic WooCommerce email');
$I->login();
$I->amOnMailpoetPage('Emails');
$I->click('[data-automation-id="tab-WooCommerce"]');
$I->waitForElement('[data-automation-id="filters_trash"]');
$I->click('[data-automation-id="filters_trash"]');
$I->waitForText($newsletter_name);
$I->clickItemRowActionByItemName($newsletter_name, 'Restore');
$I->amOnMailpoetPage('Emails');
$I->click('[data-automation-id="tab-WooCommerce"]');
$I->waitForText($newsletter_name);
}
function deleteTrashedAutomaticWooCommerceEmail(\AcceptanceTester $I) {
$newsletter_name = 'Delete Trashed Automatic WooCommerce Email Test';
$newsletter_factory = new Newsletter();
$newsletter_factory
->withSubject($newsletter_name)
->withAutomaticTypeWooCommerceFirstPurchase()
->withDeleted()
->create();
$I->wantTo('Delete trashed automatic WooCommerce email');
$I->login();
$I->amOnMailpoetPage('Emails');
$I->click('[data-automation-id="tab-WooCommerce"]');
$I->waitForElement('[data-automation-id="filters_trash"]');
$I->click('[data-automation-id="filters_trash"]');
$I->waitForText($newsletter_name);
$I->clickItemRowActionByItemName($newsletter_name, 'Delete Permanently');
$I->waitForText('permanently deleted.');
$I->waitForElementNotVisible($newsletter_name);
}
}