/**
  * Assert that error message is displayed after customer with invalid email save.
  *
  * @param Customer $customer
  * @param CustomerNew $pageCustomerNew
  * @return void
  */
 public function processAssert(Customer $customer, CustomerNew $pageCustomerNew)
 {
     $expectMessage = str_replace('%email%', $customer->getEmail(), self::ERROR_EMAIL_MESSAGE);
     $message = $pageCustomerNew->getMessagesBlock()->getErrorMessages();
     $actualMessage = explode("\n", $message[0]);
     \PHPUnit_Framework_Assert::assertEquals($expectMessage, $actualMessage[0], 'Wrong error message is displayed.');
 }
Exemplo n.º 2
0
 /**
  * Search wish list by customer.
  *
  * @param Customer $customer
  * @return void
  */
 public function searchByCustomer(Customer $customer)
 {
     if ($this->_rootElement->find($this->searchType, Locator::SELECTOR_CSS, 'select')->isVisible()) {
         $this->selectSearchType('Wish List Owner Email Search');
     }
     $this->_rootElement->find($this->emailInput)->setValue($customer->getEmail());
     $this->clickSearchButton();
 }
Exemplo n.º 3
0
 /**
  * Select customer if it is specified or click create new customer button.
  *
  * @param Customer $customer
  * @return void
  */
 public function selectCustomer(Customer $customer)
 {
     if ($customer === null) {
         $this->_rootElement->find($this->createNewCustomer)->click();
     } else {
         $this->searchAndOpen(['email' => $customer->getEmail()]);
     }
 }
 /**
  * Assert that customer balance history is changed.
  *
  * @param CustomerIndex $customerIndex
  * @param Customer $customer
  * @param CustomerBalance $customerBalance
  * @param CustomerEdit $customerEdit
  * @return void
  */
 public function processAssert(CustomerIndex $customerIndex, Customer $customer, CustomerBalance $customerBalance, CustomerEdit $customerEdit)
 {
     $customerIndex->open();
     $filter = ['email' => $customer->getEmail()];
     $customerIndex->getCustomerGridBlock()->searchAndOpen($filter);
     $customerForm = $customerEdit->getCustomerBalanceForm();
     $customerForm->openTab('store_credit');
     \PHPUnit_Framework_Assert::assertTrue($customerEdit->getBalanceHistoryGrid()->verifyCustomerBalanceGrid($customerBalance), '"Balance History" grid not contains correct information.');
 }
 /**
  * Assert that products added to wishlist are present on Customers account on backend.
  *
  * @param CustomerIndex $customerIndex
  * @param Customer $customer
  * @param CustomerEdit $customerEdit
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CustomerIndex $customerIndex, Customer $customer, CustomerEdit $customerEdit, InjectableFixture $product)
 {
     $customerIndex->open();
     $customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
     $customerEdit->getCustomerForm()->openTab('wishlist');
     /** @var Grid $wishlistGrid */
     $wishlistGrid = $customerEdit->getCustomerForm()->getTabElement('wishlist')->getSearchGridBlock();
     \PHPUnit_Framework_Assert::assertTrue($wishlistGrid->isRowVisible(['product_name' => $product->getName()], true, false), $product->getName() . " is not visible in customer wishlist on backend.");
 }
 /**
  * Assert that customer balance amount is changed.
  *
  * @param CustomerIndex $customerIndex
  * @param Customer $customer
  * @param CustomerBalance $customerBalance
  * @param CustomerEdit $customerEdit
  * @return void
  */
 public function processAssert(CustomerIndex $customerIndex, Customer $customer, CustomerBalance $customerBalance, CustomerEdit $customerEdit)
 {
     $customerIndex->open();
     $filter = ['email' => $customer->getEmail()];
     $customerIndex->getCustomerGridBlock()->searchAndOpen($filter);
     $customerForm = $customerEdit->getCustomerBalanceForm();
     $customerForm->openTab('store_credit');
     \PHPUnit_Framework_Assert::assertTrue($customerForm->getStoreCreditTab()->isStoreCreditBalanceVisible($customerBalance->getAmountDelta()), '"Store Credit Balance" grid not displays total amount of store credit balance.');
 }
 /**
  * Authorize customer on frontend.
  *
  * @param Customer $customer
  * @throws \Exception
  * @return void
  */
 protected function authorize(Customer $customer)
 {
     $url = $_ENV['app_frontend_url'] . 'customer/account/login/';
     $this->transport->write(CurlInterface::POST, $url);
     $this->read();
     $url = $_ENV['app_frontend_url'] . 'customer/account/loginPost/';
     $data = ['login[username]' => $customer->getEmail(), 'login[password]' => $customer->getPassword(), 'form_key' => $this->formKey];
     $this->transport->write(CurlInterface::POST, $url, '1.1', ['Set-Cookie:' . $this->cookies], $data);
     $response = $this->read();
     if (strpos($response, 'customer/account/login')) {
         throw new \Exception($customer->getFirstname() . ', cannot be logged in by curl handler!');
     }
 }
 /**
  * Assert that grid on 'Matched Customer' tab contains customer according to conditions.
  *
  * @param Customer $customer
  * @param CustomerSegment $customerSegment
  * @param CustomerSegmentIndex $customerSegmentIndex
  * @param CustomerSegmentNew $customerSegmentNew
  * @return void
  */
 public function processAssert(Customer $customer, CustomerSegment $customerSegment, CustomerSegmentIndex $customerSegmentIndex, CustomerSegmentNew $customerSegmentNew)
 {
     $customerSegmentIndex->open();
     /** @var CustomerSegmentForm $formTabs */
     $formTabs = $customerSegmentNew->getCustomerSegmentForm();
     $customerSegmentIndex->getGrid()->searchAndOpen(['grid_segment_name' => $customerSegment->getName()]);
     $customerSegmentGrid = $formTabs->getMatchedCustomers()->getCustomersGrid();
     $formTabs->openTab('matched_customers');
     \PHPUnit_Framework_Assert::assertTrue($customerSegmentGrid->isRowVisible(['grid_email' => $customer->getEmail()]), 'Customer is absent in grid.');
     $customerSegmentGrid->resetFilter();
     $totalOnTab = $formTabs->getNumberOfCustomersOnTabs();
     $totalInGrid = $customerSegmentGrid->getTotalRecords();
     \PHPUnit_Framework_Assert::assertEquals($totalInGrid, $totalOnTab, 'Wrong count of records is displayed.');
 }
Exemplo n.º 9
0
 /**
  * Prepare order data.
  *
  * @param array $data
  * @return array
  */
 protected function prepareOrderData(array $data)
 {
     $customerGroupId = $this->customer->hasData('group_id') ? $this->customer->getDataFieldConfig('group_id')['source']->getCustomerGroup()->getCustomerGroupId() : 1;
     $result = ['name' => $this->customer->getFirstname(), 'order' => ['currency' => $data['order_currency_code'], 'account' => ['group_id' => $customerGroupId, 'email' => $this->customer->getEmail()], 'shipping_method' => $data['shipping_method']], 'item' => $this->prepareOrderProductsData($data['entity_id']), 'billing_address' => $this->prepareBillingAddress($data['billing_address_id']), 'shipping_same_as_billing' => 'on', 'payment' => $data['payment_auth_expiration']];
     return $result;
 }
 /**
  * Assert customer is subscribed to newsletter.
  *
  * @param Customer $customer
  * @param SubscriberIndex $subscriberIndex
  * @return void
  */
 public function processAssert(Customer $customer, SubscriberIndex $subscriberIndex)
 {
     $filter = ['email' => $customer->getEmail(), 'firstname' => $customer->getFirstname(), 'lastname' => $customer->getLastname(), 'status' => 'Subscribed'];
     $subscriberIndex->open();
     \PHPUnit_Framework_Assert::assertTrue($subscriberIndex->getSubscriberGrid()->isRowVisible($filter), "Customer with email " . $customer->getEmail() . " is absent in Newsletter Subscribers grid.");
 }
 /**
  * Open customer account.
  *
  * @return void
  */
 public function run()
 {
     $this->customerIndex->open();
     $this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $this->customer->getEmail()]);
 }
 /**
  * Assert that login again to frontend with new password was success.
  *
  * @param FixtureFactory $fixtureFactory
  * @param CustomerAccountIndex $customerAccountIndex
  * @param Customer $initialCustomer
  * @param Customer $customer
  * @return void
  */
 public function processAssert(FixtureFactory $fixtureFactory, CustomerAccountIndex $customerAccountIndex, Customer $initialCustomer, Customer $customer)
 {
     $customer = $fixtureFactory->createByCode('customer', ['data' => ['email' => $initialCustomer->getEmail(), 'password' => $customer->getPassword(), 'password_confirmation' => $customer->getPassword()]]);
     $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     \PHPUnit_Framework_Assert::assertTrue($customerAccountIndex->getAccountNavigationBlock()->isVisible(), 'Customer Account Dashboard is not visible.');
 }
 /**
  * Prepare request information fixture data.
  *
  * @param Rma $rma
  * @return array
  */
 protected function prepareRequestInformationData(Rma $rma)
 {
     return ['id' => $rma->getEntityId(), 'order_id' => $this->order->getId(), 'date' => date('n/j/Y'), 'customer_email' => $this->customer->getEmail(), 'contact_email' => $rma->getContactEmail()];
 }
 /**
  * Prepare condition replacement data.
  *
  * @param Customer $customer
  * @return array
  */
 protected function prepareReplacement(Customer $customer)
 {
     /** @var Address $address */
     $address = $customer->getDataFieldConfig('address')['source']->getAddresses()[0];
     return ['conditions' => ['%email%' => $customer->getEmail(), '%company%' => $address->getCompany(), '%address%' => $address->getStreet(), '%telephone%' => $address->getTelephone(), '%postcode%' => $address->getPostcode(), '%province%' => $address->getRegionId(), '%city%' => $address->getCity()]];
 }