Files
piratepoet/tests/acceptance/WooCommerceCheckoutOptinCest.php
Jan Jakeš 8c848cfa28 Convert property names to camel case
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00

53 lines
1.7 KiB
PHP

<?php
namespace MailPoet\Test\Acceptance;
use MailPoet\Test\DataFactories\Settings;
use MailPoet\Test\DataFactories\WooCommerceProduct;
class WooCommerceCheckoutOptinCest {
/** @var Settings */
private $settingsFactory;
/** @var WooCommerceProduct */
private $productFactory;
public function _before(\AcceptanceTester $i) {
$i->activateWooCommerce();
$this->productFactory = new WooCommerceProduct($i);
$this->settingsFactory = new Settings();
$this->settingsFactory->withWooCommerceListImportPageDisplayed(true);
$this->settingsFactory->withCookieRevenueTrackingDisabled();
$this->settingsFactory->withWooCommerceCheckoutOptinEnabled();
}
public function checkoutWithOptinCheckboxChecked(\AcceptanceTester $i) {
$customerEmail = 'wc_customer_checked@example.com';
$product = $this->productFactory->create();
$i->orderProduct($product, $customerEmail);
$i->login();
$i->amOnMailpoetPage('Subscribers');
$i->searchFor($customerEmail);
$i->waitForListingItemsToLoad();
$i->waitForText($customerEmail);
// Customer is subscribed to the WC customers list
$i->see('WooCommerce Customers', 'td[data-colname="Lists"]');
}
public function checkoutWithOptinCheckboxUnchecked(\AcceptanceTester $i) {
$customerEmail = 'wc_customer_unchecked@example.com';
$product = $this->productFactory->create();
$i->orderProduct($product, $customerEmail, true, false);
$i->login();
$i->amOnMailpoetPage('Subscribers');
$i->searchFor($customerEmail);
$i->waitForListingItemsToLoad();
$i->waitForText($customerEmail);
// Customer is unsubscribed from the WC customers list
$i->dontSee('WooCommerce Customers', 'td[data-colname="Lists"]');
}
}