/** * Logout customer. * * @return void */ public function run() { $this->customerAccount->open(); $this->cmsIndex->getCmsPageBlock()->waitPageInit(); if ($this->cmsIndex->getTitleBlock()->getTitle() != 'Customer Login') { $this->cmsIndex->getLinksBlock()->openLink('Sign Out'); $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page'); $this->cmsIndex->getCmsPageBlock()->waitPageInit(); } }
/** * Asserts that Asserts that 'Additional Address Entries' contains expected message * * @param CustomerAccountIndex $customerAccountIndex * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex) { $customerAccountIndex->open(); $customerAccountIndex->getAccountMenuBlock()->openMenuItem('Address Book'); $actualText = $customerAccountIndex->getAdditionalAddressBlock()->getBlockText(); \PHPUnit_Framework_Assert::assertTrue(self::EXPECTED_MESSAGE == $actualText, 'Expected text is absent in Additional Address block.'); }
/** * Assert that product is not present in Wishlist on Frontend. * * @param CustomerAccountIndex $customerAccountIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture[] $products * @param Customer $customer * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, $products, Customer $customer) { $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run(); $customerAccountIndex->open()->getAccountMenuBlock()->openMenuItem("My Wish List"); $itemBlock = $wishlistIndex->getWishlistBlock()->getProductItemsBlock(); foreach ($products as $itemProduct) { \PHPUnit_Framework_Assert::assertFalse($itemBlock->getItemProduct($itemProduct)->isVisible(), 'Product \'' . $itemProduct->getName() . '\' is present in Wish List on Frontend.'); } }
/** * Assert that product is not present in Wishlist on Frontend * * @param CustomerAccountIndex $customerAccountIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture $product * @param CustomerInjectable $customer * @param CmsIndex $cmsIndex * @param CustomerAccountLogin $customerAccountLogin * @param CustomerAccountLogout $customerAccountLogout * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, InjectableFixture $product, CustomerInjectable $customer, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout) { $productName = $product->getName(); $customerAccountLogout->open(); $cmsIndex->getLinksBlock()->openLink('Log In'); $customerAccountLogin->getLoginBlock()->login($customer); $customerAccountIndex->open()->getAccountMenuBlock()->openMenuItem("My Wish List"); \PHPUnit_Framework_Assert::assertFalse($wishlistIndex->getWishlistBlock()->getProductItemsBlock()->isProductPresent($productName), 'Product \'' . $productName . '\' is present in Wishlist on Frontend.'); }
/** * Assert that customer success log out. * * @param CustomerAccountIndex $customerAccountIndex * @param CmsIndex $cmsIndex * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, CmsIndex $cmsIndex) { $customerAccountIndex->open(); $cmsIndex->getCmsPageBlock()->waitPageInit(); $cmsIndex->getLinksBlock()->openLink('Sign Out'); $cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible(self::LOGOUT_PAGE_TITLE); $cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible(self::HOME_PAGE_TITLE); $cmsIndex->getCmsPageBlock()->waitPageInit(); \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getLinksBlock()->isLinkVisible('Sign In'), "Customer wasn't logged out."); }
/** * Assert that product is not present in Wishlist on Frontend * * @param CustomerAccountIndex $customerAccountIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture[] $products * @param Customer $customer * @param CmsIndex $cmsIndex * @param CustomerAccountLogin $customerAccountLogin * @param CustomerAccountLogout $customerAccountLogout * @return void */ public function processAssert(CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, $products, Customer $customer, CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout) { $customerAccountLogout->open(); $cmsIndex->getLinksBlock()->openLink('Log In'); $customerAccountLogin->getLoginBlock()->login($customer); $customerAccountIndex->open()->getAccountMenuBlock()->openMenuItem("My Wish List"); $itemBlock = $wishlistIndex->getWishlistBlock()->getProductItemsBlock(); foreach ($products as $itemProduct) { \PHPUnit_Framework_Assert::assertFalse($itemBlock->getItemProduct($itemProduct)->isVisible(), 'Product \'' . $itemProduct->getName() . '\' is present in Wishlist on Frontend.'); } }
/** * 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.'); }