diff --git a/codeception.yml b/codeception.yml index c38b039d8..9d56ab4bd 100644 --- a/codeception.yml +++ b/codeception.yml @@ -6,8 +6,8 @@ include: # - tests/PyzTest/Yves/Availability # # - tests/PyzTest/Yves/Cart -# - tests/PyzTest/Yves/Checkout - - tests/PyzTest/Yves/Customer + - tests/PyzTest/Yves/Checkout +# - tests/PyzTest/Yves/Customer # - tests/PyzTest/Yves/Newsletter # - tests/PyzTest/Zed/Calculation # - tests/PyzTest/Zed/CmsGui diff --git a/tests/PyzTest/Yves/Customer/Customer/CustomerDependencyProviderTest.php b/tests/PyzTest/Yves/Customer/Customer/CustomerDependencyProviderTest.php index fe5e69184..04ac5c642 100644 --- a/tests/PyzTest/Yves/Customer/Customer/CustomerDependencyProviderTest.php +++ b/tests/PyzTest/Yves/Customer/Customer/CustomerDependencyProviderTest.php @@ -17,7 +17,6 @@ use Spryker\Yves\Kernel\Application; use Spryker\Yves\Kernel\Container; use Spryker\Yves\Kernel\Plugin\Pimple; -use Spryker\Yves\Messenger\FlashMessenger\FlashMessengerInterface; /** * Auto-generated group annotations @@ -52,7 +51,6 @@ public function testProvideDependencies() $this->assertInstanceOf(AuthenticationHandler::class, $container[CustomerDependencyProvider::PLUGIN_AUTHENTICATION_HANDLER]); $this->assertInstanceOf(CheckoutAuthenticationHandlerPluginInterface::class, $container[CustomerDependencyProvider::PLUGIN_LOGIN_AUTHENTICATION_HANDLER]); $this->assertInstanceOf(CheckoutAuthenticationHandlerPluginInterface::class, $container[CustomerDependencyProvider::PLUGIN_GUEST_AUTHENTICATION_HANDLER]); - $this->assertInstanceOf(FlashMessengerInterface::class, $container[CustomerDependencyProvider::FLASH_MESSENGER]); } } diff --git a/tests/PyzTest/Yves/Customer/Presentation/CustomerLoginCest.php b/tests/PyzTest/Yves/Customer/Presentation/CustomerLoginCest.php index 2e5306d5a..cfa92234d 100644 --- a/tests/PyzTest/Yves/Customer/Presentation/CustomerLoginCest.php +++ b/tests/PyzTest/Yves/Customer/Presentation/CustomerLoginCest.php @@ -55,8 +55,8 @@ public function testICanOpenForgotPasswordPage(CustomerPresentationTester $i) public function testICanLoginWithValidData(CustomerPresentationTester $i) { $i->amOnPage(CustomerLoginPage::URL); - $i->haveRegisteredCustomer(CustomerLoginPage::NEW_CUSTOMER_EMAIL); - $i->submitLoginForm(); + $customerTransfer = $i->haveRegisteredCustomer(); + $i->submitLoginForm($customerTransfer->getEmail(), $customerTransfer->getPassword()); $i->seeCurrentUrlEquals(CustomerOverviewPage::URL); } diff --git a/tests/PyzTest/Yves/Customer/Presentation/CustomerLogoutCest.php b/tests/PyzTest/Yves/Customer/Presentation/CustomerLogoutCest.php index 84564833f..37d6fc23d 100644 --- a/tests/PyzTest/Yves/Customer/Presentation/CustomerLogoutCest.php +++ b/tests/PyzTest/Yves/Customer/Presentation/CustomerLogoutCest.php @@ -32,8 +32,8 @@ class CustomerLogoutCest public function testICanLogoutWhenLoggedIn(CustomerPresentationTester $i) { $i->amOnPage(CustomerLoginPage::URL); - $i->haveRegisteredCustomer(CustomerLoginPage::NEW_CUSTOMER_EMAIL); - $i->submitLoginForm(); + $customerTransfer = $i->haveRegisteredCustomer(); + $i->submitLoginForm($customerTransfer->getEmail(), $customerTransfer->getPassword()); $i->seeCurrentUrlEquals(CustomerOverviewPage::URL); $i->amOnPage(CustomerLogoutPage::URL); diff --git a/tests/PyzTest/Yves/Customer/Presentation/CustomerNewsletterCest.php b/tests/PyzTest/Yves/Customer/Presentation/CustomerNewsletterCest.php index 51d9687b1..ab8716c73 100644 --- a/tests/PyzTest/Yves/Customer/Presentation/CustomerNewsletterCest.php +++ b/tests/PyzTest/Yves/Customer/Presentation/CustomerNewsletterCest.php @@ -49,11 +49,11 @@ public function testICanSubscribeNewsletter(CustomerPresentationTester $i) */ public function testICanUnSubscribeNewsletter(CustomerPresentationTester $i) { - $i->amLoggedInCustomer(); + $customerTransfer = $i->amLoggedInCustomer(); $i->setDependency(NewsletterDependencyProvider::FACADE_MAIL, Stub::makeEmpty(NewsletterToMailInterface::class)); - $i->addNewsletterSubscription(CustomerNewsletterPage::NEW_CUSTOMER_EMAIL); + $i->addNewsletterSubscription($customerTransfer->getEmail()); $i->amOnPage(CustomerNewsletterPage::URL); $i->click(['name' => CustomerNewsletterPage::FORM_FIELD_SELECTOR_NEWSLETTER_SUBSCRIPTION]); $i->click(CustomerNewsletterPage::BUTTON_SUBMIT); diff --git a/tests/PyzTest/Yves/Customer/Presentation/CustomerOverviewCest.php b/tests/PyzTest/Yves/Customer/Presentation/CustomerOverviewCest.php index f2f169ae5..4aa64f7c1 100644 --- a/tests/PyzTest/Yves/Customer/Presentation/CustomerOverviewCest.php +++ b/tests/PyzTest/Yves/Customer/Presentation/CustomerOverviewCest.php @@ -57,24 +57,6 @@ public function testCustomerWithoutAddressShouldSeeAddAddressInfoText(CustomerPr $i->see(CustomerOverviewPage::INFO_TEXT_ADD_BILLING_ADDRESS); } - /** - * @param \PyzTest\Yves\Customer\CustomerPresentationTester $i - * - * @return void - */ - public function testCustomerWithAddressShouldNotSeeAddressInfoText(CustomerPresentationTester $i) - { - $i->haveRegisteredCustomer(CustomerOverviewPage::NEW_CUSTOMER_EMAIL); - $i->addAddressToCustomer(CustomerOverviewPage::NEW_CUSTOMER_EMAIL, CustomerAddressesPage::ADDRESS_A); - - $i->amLoggedInCustomer(); - - $i->amOnPage(CustomerOverviewPage::URL); - - $i->dontSee(CustomerOverviewPage::INFO_TEXT_ADD_SHIPPING_ADDRESS); - $i->dontSee(CustomerOverviewPage::INFO_TEXT_ADD_BILLING_ADDRESS); - } - /** * @param \PyzTest\Yves\Customer\CustomerPresentationTester $i * diff --git a/tests/PyzTest/Yves/Customer/Presentation/CustomerProfileCest.php b/tests/PyzTest/Yves/Customer/Presentation/CustomerProfileCest.php index 34bda1fad..b206774fb 100644 --- a/tests/PyzTest/Yves/Customer/Presentation/CustomerProfileCest.php +++ b/tests/PyzTest/Yves/Customer/Presentation/CustomerProfileCest.php @@ -66,7 +66,7 @@ public function testICanUpdateEmail(CustomerPresentationTester $i) public function testICanNotUpdateEmailToAnAlreadyUsedOne(CustomerPresentationTester $i) { $i->amLoggedInCustomer(); - $i->haveRegisteredCustomer(CustomerProfilePage::REGISTERED_CUSTOMER_EMAIL); + $i->haveRegisteredCustomer(['email' => CustomerProfilePage::REGISTERED_CUSTOMER_EMAIL]); $i->amOnPage(CustomerProfilePage::URL); $i->fillField(CustomerProfilePage::FORM_FIELD_SELECTOR_EMAIL, CustomerProfilePage::REGISTERED_CUSTOMER_EMAIL); @@ -82,10 +82,9 @@ public function testICanNotUpdateEmailToAnAlreadyUsedOne(CustomerPresentationTes */ public function testICanChangePassword(CustomerPresentationTester $i) { - $i->amLoggedInCustomer(); + $customerTransfer = $i->amLoggedInCustomer(); $i->amOnPage(CustomerProfilePage::URL); - $customerTransfer = CustomerProfilePage::getCustomerData(CustomerProfilePage::REGISTERED_CUSTOMER_EMAIL); $oldPassword = $customerTransfer->getPassword(); $newPassword = strrev($oldPassword); diff --git a/tests/PyzTest/Yves/Customer/_support/CustomerPresentationTester.php b/tests/PyzTest/Yves/Customer/_support/CustomerPresentationTester.php index 0c5e73536..d73510ba6 100644 --- a/tests/PyzTest/Yves/Customer/_support/CustomerPresentationTester.php +++ b/tests/PyzTest/Yves/Customer/_support/CustomerPresentationTester.php @@ -37,16 +37,17 @@ public function __construct(Scenario $scenario) } /** + * @param string $email + * @param string $password + * * @return void */ - public function submitLoginForm() + public function submitLoginForm($email, $password) { $i = $this; - $customerTransfer = CustomerLoginPage::getCustomerData(CustomerLoginPage::NEW_CUSTOMER_EMAIL); - $i->submitForm(['name' => 'loginForm'], [ - CustomerLoginPage::FORM_FIELD_SELECTOR_EMAIL => $customerTransfer->getEmail(), - CustomerLoginPage::FORM_FIELD_SELECTOR_PASSWORD => $customerTransfer->getPassword(), + CustomerLoginPage::FORM_FIELD_SELECTOR_EMAIL => $email, + CustomerLoginPage::FORM_FIELD_SELECTOR_PASSWORD => $password, ]); } diff --git a/tests/PyzTest/Yves/Customer/_support/Helper/CustomerHelper.php b/tests/PyzTest/Yves/Customer/_support/Helper/CustomerHelper.php index cea2437cd..7eaa9aaf9 100644 --- a/tests/PyzTest/Yves/Customer/_support/Helper/CustomerHelper.php +++ b/tests/PyzTest/Yves/Customer/_support/Helper/CustomerHelper.php @@ -126,7 +126,7 @@ public function loadCustomerByEmail($email) * * @return \Generated\Shared\Transfer\CustomerTransfer */ - public function haveRegisteredCustomer(array $seed) + public function haveRegisteredCustomer(array $seed = []) { $this->setupSession(); @@ -219,7 +219,7 @@ public function addNewsletterSubscription($email, $type = NewsletterConstants::E * * @return \Generated\Shared\Transfer\CustomerTransfer */ - public function amLoggedInCustomer(array $seed) + public function amLoggedInCustomer(array $seed = []) { $customerTransfer = $this->haveRegisteredCustomer($seed); diff --git a/tests/PyzTest/Yves/Customer/codeception.yml b/tests/PyzTest/Yves/Customer/codeception.yml index 358389644..61f2fb496 100644 --- a/tests/PyzTest/Yves/Customer/codeception.yml +++ b/tests/PyzTest/Yves/Customer/codeception.yml @@ -19,6 +19,9 @@ suites: enabled: - \PyzTest\Shared\Testify\Helper\Environment - \SprykerTest\Shared\Propel\Helper\ConnectionHelper + - \SprykerTest\Shared\Testify\Helper\LocatorHelper: + projectNamespaces: ['Pyz'] + - \SprykerTest\Shared\Testify\Helper\DependencyHelper - \PyzTest\Yves\Customer\Helper\CustomerHelper - \SprykerTest\Shared\Config\Helper\ConfigInit - \SprykerTest\Shared\Propel\Helper\PropelInstallHelper