Add empty trash tests
[MAILPOET-2982]
This commit is contained in:
@ -82,6 +82,7 @@ class ListingFilters extends React.Component {
|
||||
onClick={this.handleEmptyTrash}
|
||||
type="submit"
|
||||
value={MailPoet.I18n.t('emptyTrash')}
|
||||
data-automation-id="empty_trash"
|
||||
className="button"
|
||||
/>
|
||||
);
|
||||
|
@ -55,4 +55,27 @@ class DeleteNewsletterCest {
|
||||
|
||||
$i->waitForText($newsletterName . '2');
|
||||
}
|
||||
|
||||
public function emptyTrash(\AcceptanceTester $i) {
|
||||
$newsletterName = 'Goodbye Forever Newsletter';
|
||||
$i->wantTo('Empty a trash on Newsletters page');
|
||||
$newsletter = new Newsletter();
|
||||
$newsletter->withSubject($newsletterName)->withDeleted()->create();
|
||||
$newsletter = new Newsletter();
|
||||
$newsletter->withSubject($newsletterName . '2')->create();
|
||||
|
||||
$i->login();
|
||||
$i->amOnMailpoetPage('Emails');
|
||||
$i->waitForElement('[data-automation-id="filters_trash"]');
|
||||
$i->click('[data-automation-id="filters_trash"]');
|
||||
$i->waitForText($newsletterName);
|
||||
|
||||
$i->click('[data-automation-id="empty_trash"]');
|
||||
|
||||
$i->waitForText('1 email was permanently deleted.');
|
||||
$i->waitForElementNotVisible($newsletterName);
|
||||
$i->click('[data-automation-id="filters_all"]');
|
||||
|
||||
$i->waitForText($newsletterName . '2');
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,48 @@ class DeleteTrashedSegmentCest {
|
||||
$i->amOnMailpoetPage('Lists');
|
||||
$i->waitForElement('[data-automation-id="dynamic-segments-tab"]');
|
||||
$i->click('[data-automation-id="dynamic-segments-tab"]');
|
||||
$i->waitForElement('[data-automation-id="filters_trash"]', 10);
|
||||
$i->waitForElement('[data-automation-id="filters_trash"]');
|
||||
$i->click('[data-automation-id="filters_trash"]');
|
||||
$i->waitForText($segmentTitle, 10, $listingAutomationSelector);
|
||||
$i->clickItemRowActionByItemName($segmentTitle, 'Delete permanently');
|
||||
$i->waitForText('1 segment was permanently deleted.', 10);
|
||||
$i->waitForText('1 segment was permanently deleted.');
|
||||
$i->dontSeeElement($listingAutomationSelector);
|
||||
$i->seeNoJSErrors();
|
||||
$i->waitForText($segmentTitle . '2');
|
||||
}
|
||||
|
||||
public function emptyTrash(\AcceptanceTester $i) {
|
||||
$i->wantTo('Empty a trash on Segment page');
|
||||
|
||||
$segmentTitle = 'Empty Trash';
|
||||
|
||||
$segmentFactory = new DynamicSegment();
|
||||
$segment = $segmentFactory
|
||||
->withName($segmentTitle)
|
||||
->withUserRoleFilter('Administrator')
|
||||
->withDeleted()
|
||||
->create();
|
||||
$segmentFactory = new DynamicSegment();
|
||||
$segmentFactory
|
||||
->withName($segmentTitle . '2')
|
||||
->withUserRoleFilter('Administrator')
|
||||
->create();
|
||||
$listingAutomationSelector = '[data-automation-id="listing_item_' . $segment->id . '"]';
|
||||
|
||||
$i->login();
|
||||
$i->amOnMailpoetPage('Lists');
|
||||
$i->waitForElement('[data-automation-id="dynamic-segments-tab"]');
|
||||
$i->click('[data-automation-id="dynamic-segments-tab"]');
|
||||
$i->waitForElement('[data-automation-id="filters_trash"]');
|
||||
$i->click('[data-automation-id="filters_trash"]');
|
||||
$i->waitForText($segmentTitle, 10, $listingAutomationSelector);
|
||||
|
||||
$i->click('[data-automation-id="empty_trash"]');
|
||||
$i->waitForText('1 segment was permanently deleted.');
|
||||
$i->dontSeeElement($listingAutomationSelector);
|
||||
$i->seeNoJSErrors();
|
||||
|
||||
$i->click('[data-automation-id="filters_all"]');
|
||||
$i->waitForText($segmentTitle . '2');
|
||||
}
|
||||
}
|
||||
|
@ -66,4 +66,29 @@ class FormsDeletingCest {
|
||||
$i->waitForElementNotVisible($formName);
|
||||
$i->waitForText($formName . '2');
|
||||
}
|
||||
|
||||
public function emptyTrash(\AcceptanceTester $i) {
|
||||
$formName = 'Delete form permanently';
|
||||
$form = new Form();
|
||||
$form->withName($formName)->withDeleted()->create();
|
||||
$form = new Form();
|
||||
$form->withName($formName . '2')->create();
|
||||
|
||||
$i->wantTo('Empty a trash on Forms page');
|
||||
|
||||
$i->login();
|
||||
$i->amOnMailpoetPage('Forms');
|
||||
|
||||
$i->waitForElement('[data-automation-id="filters_trash"]');
|
||||
$i->click('[data-automation-id="filters_trash"]');
|
||||
$i->waitForText($formName);
|
||||
|
||||
$i->click('[data-automation-id="empty_trash"]');
|
||||
|
||||
$i->waitForText('1 form was permanently deleted.');
|
||||
$i->waitForElementNotVisible($formName);
|
||||
$i->click('[data-automation-id="filters_all"]');
|
||||
|
||||
$i->waitForText($formName . '2');
|
||||
}
|
||||
}
|
||||
|
@ -61,34 +61,66 @@ class ManageListsCest {
|
||||
|
||||
// Trash existing list
|
||||
$i->clickItemRowActionByItemName($editedListTitle, 'Move to trash');
|
||||
$i->waitForText('1 list was moved to the trash. Note that deleting a list does not delete its subscribers.', 10);
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]', 10);
|
||||
$i->waitForText('1 list was moved to the trash. Note that deleting a list does not delete its subscribers.');
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]');
|
||||
$i->click('[data-automation-id="filters_trash"]');
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]', 10);
|
||||
$i->waitForText($editedListTitle, 10);
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]');
|
||||
$i->waitForText($editedListTitle);
|
||||
$i->seeNoJSErrors();
|
||||
|
||||
// Restore trashed list
|
||||
$i->clickItemRowActionByItemName($editedListTitle, 'Restore');
|
||||
$i->waitForText('1 list has been restored from the Trash.', 10);
|
||||
$i->waitForText('1 list has been restored from the Trash.');
|
||||
$i->seeInCurrentURL(urlencode('group[all]'));
|
||||
$i->waitForText($editedListTitle, 10);
|
||||
$i->waitForText($editedListTitle);
|
||||
$i->seeNoJSErrors();
|
||||
|
||||
// Trash and delete existing list
|
||||
$segmentFactory = new Segment();
|
||||
$segmentFactory
|
||||
->withName($newListTitle . '2')
|
||||
->withDescription($newListDesc)
|
||||
->create();
|
||||
$i->clickItemRowActionByItemName($editedListTitle, 'Move to trash');
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]', 10);
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]');
|
||||
$i->click('[data-automation-id="filters_trash"]');
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]', 10);
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]');
|
||||
$i->clickItemRowActionByItemName($editedListTitle, 'Delete permanently');
|
||||
$i->waitForText('1 list was permanently deleted. Note that deleting a list does not delete its subscribers.', 10);
|
||||
$i->waitForText('1 list was permanently deleted. Note that deleting a list does not delete its subscribers.');
|
||||
$i->seeNoJSErrors();
|
||||
$i->seeInCurrentURL(urlencode('group[all]'));
|
||||
$i->dontSee($editedListTitle, '[data-automation-id="listing_item_4"]');
|
||||
$i->see($newListTitle . '2');
|
||||
}
|
||||
|
||||
public function emptyTrash(\AcceptanceTester $i) {
|
||||
// Trash and delete existing list
|
||||
$newListTitle = 'Empty Trash List';
|
||||
$newListDesc = 'Description';
|
||||
$segmentFactory = new Segment();
|
||||
$segmentFactory
|
||||
->withName($newListTitle)
|
||||
->withDescription($newListDesc)
|
||||
->withDeleted()
|
||||
->create();
|
||||
$segmentFactory = new Segment();
|
||||
$segmentFactory
|
||||
->withName('List to keep')
|
||||
->withDescription($newListDesc)
|
||||
->create();
|
||||
|
||||
$i->login();
|
||||
$i->amOnMailpoetPage('Lists');
|
||||
$i->waitForElementVisible('[data-automation-id="filters_trash"]');
|
||||
$i->click('[data-automation-id="filters_trash"]');
|
||||
$i->waitForElementVisible('[data-automation-id="empty_trash"]');
|
||||
|
||||
$i->click('[data-automation-id="empty_trash"]');
|
||||
|
||||
$i->waitForText('1 list was permanently deleted. Note that deleting a list does not delete its subscribers.');
|
||||
$i->dontSee($newListTitle);
|
||||
$i->seeNoJSErrors();
|
||||
$i->click('[data-automation-id="filters_all"]');
|
||||
$i->see('List to keep');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user