/** * Asserts that deleted address is not present on Frontend. * * @param CustomerAccountIndex $customerAccountIndex * @param CustomerAddressEdit $customerAddressEdit * @param Customer $customer * @param Address $addressToDelete * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, CustomerAddressEdit $customerAddressEdit, Customer $customer, Address $addressToDelete) { $this->objectManager->create(\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class, ['customer' => $customer])->run(); $customerAccountIndex->getAccountMenuBlock()->openMenuItem('Address Book'); $addressRenderer = $this->objectManager->create(\Magento\Customer\Test\Block\Address\Renderer::class, ['address' => $addressToDelete, 'type' => 'html']); $deletedAddress = $addressRenderer->render(); $isAddressDeleted = false; if ($customerAddressEdit->getEditForm()->isVisible() || $customerAccountIndex->getAdditionalAddressBlock()->getBlockText() !== null && $deletedAddress != $customerAccountIndex->getAdditionalAddressBlock()->getBlockText() || $customerAccountIndex->getDefaultAddressBlock()->getBlockText() !== null && $deletedAddress != $customerAccountIndex->getAdditionalAddressBlock()->getBlockText()) { $isAddressDeleted = true; } \PHPUnit_Framework_Assert::assertTrue($isAddressDeleted, 'Customer address was not deleted.'); }
/** * Enable Automatic Assignment of Customers to Appropriate VAT Group. * * @param Customer $customer * @param Address $vatId * @param ConfigData $vatConfig * @param string $configData * @param string $customerGroup * @return array */ public function test(Customer $customer, Address $vatId, ConfigData $vatConfig, $configData, $customerGroup) { // Preconditions $this->configData = $configData; $this->customer = $customer; $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->configData])->run(); $this->customer->persist(); $this->prepareVatConfig($vatConfig, $customerGroup); // Steps $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $this->customer])->run(); $this->customerAccountIndex->getDashboardAddress()->editBillingAddress(); $this->customerAddressEdit->getEditForm()->fill($vatId); $this->customerAddressEdit->getEditForm()->saveAddress(); return ['customer' => $this->customer]; }
/** * 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 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->cmsIndex->open(); $this->cmsIndex->getLinksBlock()->openLink('Log In'); sleep(3); $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(); }