/** * Create Customer account on Storefront. * * @param Customer $customer * @return void */ public function test(Customer $customer) { // Steps $this->cmsIndex->open(); $this->cmsIndex->getLinksBlock()->openLink('Create an Account'); $this->customerAccountCreate->getRegisterForm()->registerCustomer($customer); }
/** * Create Customer account on frontend * * @param CustomerInjectable $customer */ public function testCreateCustomer(CustomerInjectable $customer) { //Steps $this->cmsIndex->open(); $this->cmsIndex->getLinksBlock()->openLink('Register'); $this->customerAccountCreate->getRegisterForm()->registerCustomer($customer); }
/** * Create Existing Customer account on frontend. * * @param Customer $customer * @return void */ public function testCreateExistingCustomer(Customer $customer) { // Precondition $existingCustomer = clone $customer; $customer->persist(); // Steps $this->cmsIndex->open(); $this->cmsIndex->getLinksBlock()->openLink('Create an Account'); $this->customerAccountCreate->getRegisterForm()->registerCustomer($existingCustomer); }
/** * Assert that success message is displayed after customer registered on frontend * * @param CustomerAccountCreate $registerPage * @return void */ public function processAssert(CustomerAccountCreate $registerPage) { $actualMessage = $registerPage->getMessagesBlock()->getSuccessMessages(); \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $actualMessage, 'Wrong success message is displayed.' . "\nExpected: " . self::SUCCESS_MESSAGE . "\nActual: " . $actualMessage); }
/** * Assert that error message is displayed on "Create New Customer Account" page(frontend) * * @param CustomerAccountCreate $registerPage * @return void */ public function processAssert(CustomerAccountCreate $registerPage) { $errorMessage = $registerPage->getMessagesBlock()->getErrorMessage(); \PHPUnit_Framework_Assert::assertNotEmpty($errorMessage, 'No error message is displayed.'); }
/** * Assert that appropriate message is displayed on "Create New Customer Account" page(frontend) if password length * is below 8 characters. * * @param CustomerAccountCreate $registerPage * @return void */ public function processAssert(CustomerAccountCreate $registerPage) { $errorMessage = $registerPage->getRegisterForm()->getPasswordError(); \PHPUnit_Framework_Assert::assertContains(self::PASSWORD_LENGTH_ERROR_MESSAGE, $errorMessage, 'Incorrect password error message.'); }
/** * Assert that appropriate message is displayed on "Create New Customer Account" page(frontend) if password is not * secure enough. * * @param CustomerAccountCreate $registerPage * @return void */ public function processAssert(CustomerAccountCreate $registerPage) { $expectedErrorMessage = 'Minimum of different classes of characters in password is 3.' . ' Classes of characters: Lower Case, Upper Case, Digits, Special Characters.'; $errorMessage = $registerPage->getRegisterForm()->getPasswordError(); \PHPUnit_Framework_Assert::assertEquals($expectedErrorMessage, $errorMessage, 'The messages are not equal.'); }