wantTo('Restore a segment from trash'); $segmentTitle = 'Restore Segment From Trash Test'; $segmentFactory = new DynamicSegment(); $segment = $segmentFactory ->withName($segmentTitle) ->withUserRoleFilter('Administrator') ->withDeleted() ->create(); $listingAutomationSelector = '[data-automation-id="listing_item_' . $segment->id . '"]'; $i->login(); $i->amOnMailpoetPage('Segments'); $i->waitForElement('[data-automation-id="filters_trash"]', 10); $i->click('[data-automation-id="filters_trash"]'); $i->waitForText($segmentTitle, 10, $listingAutomationSelector); $i->clickItemRowActionByItemName($segmentTitle, 'Restore'); $i->waitForText('1 segment has been restored from the Trash.', 10); $i->seeInCurrentURL(urlencode('group[all]')); $i->waitForText($segmentTitle, 20, $listingAutomationSelector); $i->seeNoJSErrors(); } }