diff --git a/assets/js/src/segments/list.jsx b/assets/js/src/segments/list.jsx index a07643a496..125ca6e36c 100644 --- a/assets/js/src/segments/list.jsx +++ b/assets/js/src/segments/list.jsx @@ -193,7 +193,9 @@ const itemActions = [ name: 'view_subscribers', link: function link(item) { return ( - {MailPoet.I18n.t('viewSubscribers')} + + {MailPoet.I18n.t('viewSubscribers')} + ); }, }, @@ -240,7 +242,7 @@ class SegmentList extends React.Component { return (
- + { segmentName } diff --git a/tests/acceptance/WooCommerceListImportPageCest.php b/tests/acceptance/WooCommerceListImportPageCest.php index e936afef5a..5da3d6028b 100644 --- a/tests/acceptance/WooCommerceListImportPageCest.php +++ b/tests/acceptance/WooCommerceListImportPageCest.php @@ -50,6 +50,7 @@ class WooCommerceListImportPageCest { $I->seeNoJSErrors(); $I->click($submit_button); $I->seeNoJSErrors(); + $I->waitForElement('[data-automation-id="newsletters_listing_tabs"]'); $I->seeInCurrentUrl('wp-admin/admin.php?page=mailpoet-newsletters'); } @@ -64,4 +65,45 @@ class WooCommerceListImportPageCest { $I->seeInCurrentUrl('wp-admin/admin.php?page=mailpoet-woocommerce-list-import'); $this->order_factory->delete($order['id']); } + + function importListPageImportTest(\AcceptanceTester $I) { + $settings_factory = new Settings(); + $settings_factory->withWooCommerceListImportPageDisplayed(false); + $order = $this->order_factory->create(); + $guest_user_data = $order['billing']; + $registered_customer = $this->customer_factory->withEmail('customer1@email.com')->create(); + $I->login(); + $I->amOnPage('wp-admin/admin.php?page=mailpoet-woocommerce-list-import'); + $subscribed_radio = '[data-automation-id="import_as_subscribed"]'; + $submit_button = '[data-automation-id="submit_woo_commerce_list_import"]'; + $I->selectOption($subscribed_radio, 'subscribed'); + $I->click($submit_button); + $I->seeNoJSErrors(); + $I->waitForElement('[data-automation-id="newsletters_listing_tabs"]'); + $I->seeInCurrentUrl('wp-admin/admin.php?page=mailpoet-newsletters'); + $I->amOnMailpoetPage('Lists'); + $I->waitForText('WooCommerce Customers'); + $I->moveMouseOver('[data-automation-id="segment_name_WooCommerce Customers"]'); + $I->click('[data-automation-id="view_subscribers_WooCommerce Customers"]'); + $I->waitForListingItemsToLoad(); + $I->canSee($registered_customer['email']); + $I->reloadPage(); + // It takes more time to sync guest user + // So we reload page several times and check for guest customer email + for ($i = 0; $i < 15; $i++) { + try { + $I->wait(1); + $I->reloadPage(); + $I->see($guest_user_data['email']); + return; + } catch (\PHPUnit_Framework_Exception $e) { + continue; + } + } + $I->see($guest_user_data['email']); + } + + function _after(\AcceptanceTester $I) { + $I->deactivateWooCommerce(); + } }