/** * Assert that gift card is redeemable on frontend. * * @param CustomerAccountIndex $customerAccountIndex * @param Customer $customer * @param string $code * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, Customer $customer, $code) { $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('Gift Card'); $customerAccountIndex->getRedeemBlock()->redeemGiftCard($code); \PHPUnit_Framework_Assert::assertEquals($customerAccountIndex->getMessagesBlock()->getSuccessMessages(), sprintf(self::SUCCESS_MESSAGE, $code)); }
/** * Assert that created gift registry type can be found on frontend. * * @param Customer $customer * @param GiftRegistryType $giftRegistryType * @param CustomerAccountIndex $customerAccountIndex * @param GiftRegistryIndex $giftRegistryIndex * @param GiftRegistryAddSelect $giftRegistryAddSelect * @return void */ public function processAssert(Customer $customer, GiftRegistryType $giftRegistryType, CustomerAccountIndex $customerAccountIndex, GiftRegistryIndex $giftRegistryIndex, GiftRegistryAddSelect $giftRegistryAddSelect) { $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $customerAccountIndex->getAccountNavigationBlock()->openNavigationItem("Gift Registry"); $giftRegistryIndex->getGiftRegistryList()->addNew(); \PHPUnit_Framework_Assert::assertTrue($giftRegistryAddSelect->getGiftRegistryEditForm()->isGiftRegistryVisible($giftRegistryType), "Gift registry '{$giftRegistryType->getLabel()}' is not present on frontend."); }
/** * Assert that created gift card account can be verified on the frontend on My Account page. * * @param Customer $customer * @param CustomerAccountIndex $customerAccountIndex * @param GiftCardAccount $giftCardAccount * @param string $code * @return void */ public function processAssert(Customer $customer, CustomerAccountIndex $customerAccountIndex, GiftCardAccount $giftCardAccount, $code) { $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('Gift Card'); $data = $giftCardAccount->getData(); $customerAccountIndex->getRedeemBlock()->checkStatusAndBalance($code); $fixtureData = ['code' => $code, 'balance' => $data['balance'], 'date_expires' => $data['date_expires']]; \PHPUnit_Framework_Assert::assertEquals($fixtureData, $customerAccountIndex->getCheckBlock()->getGiftCardAccountData($fixtureData)); }
/** * Run delete customer address entity test. * * @param Customer $customer * @return array */ public function test(Customer $customer) { // Preconditions: $customer->persist(); $addressToDelete = $customer->getDataFieldConfig('address')['source']->getAddresses()[0]; // Steps: $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $this->customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('Address Book'); $this->customerAddress->getBookBlock()->getAdditionalAddressBlock()->deleteAddress($addressToDelete); return ['deletedAddress' => $addressToDelete]; }
/** * Assert that rma is correct display on frontend (MyAccount - My Returns): * - status on rma history page * - details and items on rma view page * * @param Rma $rma * @param CmsIndex $cmsIndex * @param CustomerAccountIndex $customerAccountIndex * @param RmaReturnHistory $rmaReturnHistory * @param RmaReturnView $rmaReturnView * @return void */ public function processAssert(Rma $rma, CmsIndex $cmsIndex, CustomerAccountIndex $customerAccountIndex, RmaReturnHistory $rmaReturnHistory, RmaReturnView $rmaReturnView) { $this->rmaReturnHistory = $rmaReturnHistory; $this->rmaReturnView = $rmaReturnView; $this->order = $rma->getDataFieldConfig('order_id')['source']->getOrder(); $this->customer = $this->order->getDataFieldConfig('customer_id')['source']->getCustomer(); $this->productHandlerClass = $this->getProductHandlerClass(); $this->login(); $cmsIndex->getTopLinksBlock()->openAccountLink('My Account'); $customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('My Returns'); $this->assertRmaStatus($rma); $rmaReturnHistory->getRmaHistory()->getItemRow($rma)->open(); $this->assertRequestInformation($rma); $this->assertItemsData($rma); }
/** * Test creation for clear all compare products. * * @param string $products * @param ConfigData $config * @param CustomerAccountIndex $customerAccountIndex * @return void */ public function test(CustomerAccountIndex $customerAccountIndex, $products, ConfigData $config) { // Preconditions $config->persist(); $this->products = $this->createProducts($products); //Steps $this->cmsIndex->open(); $this->loginCustomer($this->customer); foreach ($this->products as $itemProduct) { $this->addProduct($itemProduct); $this->assertProductCompareSuccessAddMessage->processAssert($this->catalogProductView, $itemProduct); } $this->cmsIndex->getTopLinksBlock()->openAccount(); $this->cmsIndex->getLinksBlock()->openLink("My Account"); $customerAccountIndex->getCompareBlock()->clickClearAll(); }
/** * Create gift registry entity test. * * @param GiftRegistry $giftRegistry * @param Customer $customer * @return void */ public function test(GiftRegistry $giftRegistry, Customer $customer) { // Steps $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $this->customerAccountIndex->getAccountNavigationBlock()->openNavigationItem("Gift Registry"); $this->giftRegistryIndex->getGiftRegistryList()->addNew(); $this->giftRegistryAddSelect->getGiftRegistryEditForm()->selectGiftRegistryType($giftRegistry->getTypeId()); $this->giftRegistryEdit->getGiftRegistryEditForm()->fill($giftRegistry); $this->giftRegistryEdit->getGiftRegistryEditForm()->save(); }
/** * Run Create multiple wishlist entity test. * * @param Customer $customer * @param Wishlist $wishlist * @return void */ public function test(Customer $customer, Wishlist $wishlist) { // Prepare widget for assertions $this->setupConfiguration(); $this->createWishlistSearchWidget(); // Steps: $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $this->customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('My Wishlists'); $this->wishlistIndex->getManagementBlock()->clickCreateNewWishlist(); $this->wishlistIndex->getBehaviourBlock()->fillWishlist($wishlist); }
/** * 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('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $initialCustomer])->run(); $this->cmsIndex->getTopLinksBlock()->openAccount(); $this->cmsIndex->getLinksBlock()->openLink('My Account'); $this->customerAccountIndex->getInfoBlock()->openChangePassword(); $this->customerAccountEdit->getAccountInfoForm()->fill($customer); $this->customerAccountEdit->getAccountInfoForm()->submit(); }
/** * Open customer tab. * * @param string $tabName * @return void */ public function openCustomerTab($tabName) { $this->customerAccountIndex->getAccountNavigationBlock()->openNavigationItem($tabName); }
/** * Assert that order is present in Orders grid on frontend * * @param Order $order * @param Customer $customer * @param CustomerAccountIndex $customerAccountIndex * @param OrderHistory $orderHistory * @return void */ public function processAssert(Order $order, Customer $customer, CustomerAccountIndex $customerAccountIndex, OrderHistory $orderHistory) { $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('My Orders'); \PHPUnit_Framework_Assert::assertTrue($orderHistory->getOrderHistoryBlock()->isOrderVisible($order), "Order with following id {$order->getId()} is absent in Orders block on frontend."); }
/** * Asserts that 'Additional Address Entries' contains expected message. * * @param CustomerAccountIndex $customerAccountIndex * @param CustomerAddress $customerAddress * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, CustomerAddress $customerAddress) { $customerAccountIndex->open(); $customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('Address Book'); \PHPUnit_Framework_Assert::assertEquals(self::EXPECTED_MESSAGE, $customerAddress->getBookBlock()->getAdditionalAddressBlock()->getBlockText(), 'Expected text is absent in Additional Address block.'); }
/** * 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.'); }
/** * Asserts that success message equals to expected message. * * @param CustomerAccountIndex $customerAccountIndex * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex) { \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $customerAccountIndex->getMessagesBlock()->getSuccessMessages()); }
/** * Assert that multiple wishlist is present on 'My Account' page. * * @param CustomerAccountIndex $customerAccountIndex * @param WishlistIndex $wishlistIndex * @param Wishlist $wishlist * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, Wishlist $wishlist) { $customerAccountIndex->open()->getAccountNavigationBlock()->openNavigationItem('My Wishlists'); \PHPUnit_Framework_Assert::assertTrue($wishlistIndex->getManagementBlock()->isWishlistVisible($wishlist), "{$wishlist->getName()} multiple wishlist is not visible on My Account page."); }