/** * Asserts that customer name in Contact information block and Account info tab matches name in fixture. * * @param CustomerAccountIndex $customerAccountIndex * @param CustomerAccountEdit $customerAccountEdit * @param Customer $customer * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, CustomerAccountEdit $customerAccountEdit, Customer $customer) { $customerName = $customer->getFirstname() . " " . $customer->getLastname(); $customerAccountIndex->open(); $infoBlock = $customerAccountIndex->getInfoBlock()->getContactInfoContent(); $infoBlock = explode(PHP_EOL, $infoBlock); $nameInDashboard = $infoBlock[0]; \PHPUnit_Framework_Assert::assertTrue($nameInDashboard == $customerName, 'Customer name in Contact info block is not matching the fixture.'); $customerAccountIndex->getInfoBlock()->openEditContactInfo(); $nameInEdit = $customerAccountEdit->getAccountInfoForm()->getFirstName() . " " . $customerAccountEdit->getAccountInfoForm()->getLastName(); \PHPUnit_Framework_Assert::assertTrue($nameInEdit == $customerName, 'Customer name on Account info tab is not matching the fixture.'); }
/** * Run Change customer password test. * * @param Customer $initialCustomer * @param Customer $customer * @return void */ public function test(Customer $initialCustomer, Customer $customer) { // Preconditions $initialCustomer->persist(); // Steps $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $initialCustomer])->run(); $this->cmsIndex->getLinksBlock()->openLink('My Account'); $this->customerAccountIndex->getInfoBlock()->openChangePassword(); $this->customerAccountEdit->getAccountInfoForm()->fill($customer); $this->customerAccountEdit->getAccountInfoForm()->submit(); }
/** * Run Update Customer Entity test * * @param Customer $initialCustomer * @param Customer $customer * @param Address $address * @param AssertCustomerInfoSuccessSavedMessage $assertCustomerInfoSuccessSavedMessage * @return void */ public function test(Customer $initialCustomer, Customer $customer, Address $address, AssertCustomerInfoSuccessSavedMessage $assertCustomerInfoSuccessSavedMessage) { // Preconditions $initialCustomer->persist(); // Steps $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $initialCustomer])->run(); $this->customerAccountIndex->getInfoBlock()->openEditContactInfo(); $this->customerAccountEdit->getAccountInfoForm()->fill($customer); $this->customerAccountEdit->getAccountInfoForm()->submit(); \PHPUnit_Framework_Assert::assertThat($this->getName(), $assertCustomerInfoSuccessSavedMessage); $this->cmsIndex->getCmsPageBlock()->waitPageInit(); $this->customerAccountIndex->getDashboardAddress()->editBillingAddress(); $this->customerAddressEdit->getEditForm()->fill($address); $this->customerAddressEdit->getEditForm()->saveAddress(); }
/** * Run Update Customer Entity test * * @param CustomerInjectable $initialCustomer * @param CustomerInjectable $customer * @param AddressInjectable $address * @param AssertCustomerInfoSuccessSavedMessage $assertCustomerInfoSuccessSavedMessage * @return void */ public function test(CustomerInjectable $initialCustomer, CustomerInjectable $customer, AddressInjectable $address, AssertCustomerInfoSuccessSavedMessage $assertCustomerInfoSuccessSavedMessage) { // Preconditions $initialCustomer->persist(); // Steps $this->cmsIndex->open(); $this->cmsIndex->getLinksBlock()->openLink('Log In'); $this->customerAccountLogin->getLoginBlock()->fill($initialCustomer); $this->customerAccountLogin->getLoginBlock()->submit(); $this->customerAccountIndex->getInfoBlock()->openEditContactInfo(); $this->customerAccountEdit->getAccountInfoForm()->fill($customer); $this->customerAccountEdit->getAccountInfoForm()->submit(); \PHPUnit_Framework_Assert::assertThat($this->getName(), $assertCustomerInfoSuccessSavedMessage); $this->customerAccountIndex->getDashboardAddress()->editBillingAddress(); $this->customerAddressEdit->getEditForm()->fill($address); $this->customerAddressEdit->getEditForm()->saveAddress(); }
/** * Run Lock customer on edit page test. * * @param Customer $initialCustomer * @param Customer $customer * @param int $attempts * @param string $configData * @return void */ public function test(Customer $initialCustomer, Customer $customer, $attempts, $configData = null) { $this->configData = $configData; // Preconditions $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->configData])->run(); $initialCustomer->persist(); // Steps $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $initialCustomer])->run(); $this->cmsIndex->getLinksBlock()->openLink('My Account'); $this->customerAccountIndex->getInfoBlock()->openChangePassword(); for ($i = 0; $i < $attempts; $i++) { if ($i > 0) { $this->customerAccountIndex->getInfoBlock()->checkChangePassword(); } $this->customerAccountEdit->getAccountInfoForm()->fill($customer); $this->customerAccountEdit->getAccountInfoForm()->submit(); } }