/**
  * Assert that Secure Urls Enabled.
  *
  * @param BrowserInterface $browser
  * @param Dashboard $dashboard
  * @param CustomerAccountLogin $customerAccountLogin
  * @return void
  */
 public function processAssert(BrowserInterface $browser, Dashboard $dashboard, CustomerAccountLogin $customerAccountLogin)
 {
     $dashboard->open();
     \PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'https://') !== false, 'Secure Url is not displayed on backend.');
     $customerAccountLogin->open();
     \PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'https://') !== false, 'Secure Url is not displayed on frontend.');
 }
 /**
  * Login customer.
  *
  * @return void
  */
 public function run()
 {
     $this->logoutCustomerOnFrontend->run();
     $this->cmsIndex->getLinksBlock()->openLink('Sign In');
     $this->cmsIndex->getCmsPageBlock()->waitPageInit();
     $this->customerAccountLogin->getLoginBlock()->login($this->customer);
     $this->cmsIndex->getCmsPageBlock()->waitPageInit();
 }
 /**
  * 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.');
 }
 /**
  * Login customer.
  *
  * @return void
  */
 public function run()
 {
     $this->cmsIndex->open();
     $this->cmsIndex->getCmsPageBlock()->waitPageInit();
     if ($this->cmsIndex->getLinksBlock()->isLinkVisible("Log Out")) {
         $this->cmsIndex->getLinksBlock()->openLink("Log Out");
         $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page');
     }
     $this->cmsIndex->getLinksBlock()->openLink("Log In");
     $this->customerAccountLogin->getLoginBlock()->login($this->customer);
 }
 /**
  * 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.');
     }
 }
 /**
  * Run Lock customer on login page test.
  *
  * @param Customer $initialCustomer
  * @param int $attempts
  * @param FixtureFactory $fixtureFactory
  * @param $incorrectPassword
  * @param string $configData
  * @return void
  */
 public function test(Customer $initialCustomer, $attempts, FixtureFactory $fixtureFactory, $incorrectPassword, $configData = null)
 {
     $this->configData = $configData;
     // Preconditions
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->configData])->run();
     $initialCustomer->persist();
     $incorrectCustomer = $fixtureFactory->createByCode('customer', ['data' => ['email' => $initialCustomer->getEmail(), 'password' => $incorrectPassword]]);
     // Steps
     for ($i = 0; $i < $attempts; $i++) {
         $this->customerAccountLogin->open();
         $this->customerAccountLogin->getLoginBlock()->fill($incorrectCustomer);
         $this->customerAccountLogin->getLoginBlock()->submit();
     }
 }
 /**
  * Runs Delete Customer Address test.
  *
  * @param Customer $customer
  * @return array
  */
 public function test(Customer $customer)
 {
     $this->markTestIncomplete('Bug: MAGETWO-34634');
     // Precondition:
     $customer->persist();
     $addressToDelete = $customer->getDataFieldConfig('address')['source']->getAddresses()[1];
     // Steps:
     $this->cmsIndex->open();
     $this->cmsIndex->getLinksBlock()->openLink("Log In");
     $this->customerAccountLogin->getLoginBlock()->login($customer);
     $this->customerAccountIndex->getAccountMenuBlock()->openMenuItem('Address Book');
     $this->customerAccountIndex->getAdditionalAddressBlock()->deleteAdditionalAddress($addressToDelete);
     return ['deletedAddress' => $addressToDelete];
 }
 /**
  * Login customer.
  *
  * @return void
  */
 protected function loginCustomer()
 {
     if (!$this->cmsIndex->getLinksBlock()->isLinkVisible('Log Out')) {
         $this->cmsIndex->getLinksBlock()->openLink("Log In");
         $this->customerAccountLogin->getLoginBlock()->login($this->customer);
     }
 }
 /**
  * Login customer
  *
  * @param CustomerInjectable $customer
  * @return void
  */
 protected function loginCustomer(CustomerInjectable $customer)
 {
     $this->cmsIndex->open();
     if (!$this->cmsIndex->getLinksBlock()->isLinkVisible('Log Out')) {
         $this->cmsIndex->getLinksBlock()->openLink('Log In');
         $this->customerAccountLogin->getLoginBlock()->login($customer);
     }
 }
 /**
  * Create products in cart report entity
  *
  * @param Customer $customer
  * @param CatalogProductSimple $product
  * @param string $isGuest
  * @param BrowserInterface $browser
  * @return void
  */
 public function test(Customer $customer, CatalogProductSimple $product, $isGuest, BrowserInterface $browser)
 {
     // Preconditions
     $product->persist();
     //Steps
     $this->cmsIndex->open()->getLinksBlock()->openLink("Log In");
     $this->customerAccountLogin->getLoginBlock()->login($customer);
     $productUrl = $_ENV['app_frontend_url'] . $product->getUrlKey() . '.html';
     $browser->open($productUrl);
     $this->catalogProductView->getViewBlock()->addToCart($product);
     if ($isGuest) {
         $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LogoutCustomerOnFrontendStep')->run();
         $browser->open($productUrl);
         $this->catalogProductView->getViewBlock()->addToCart($product);
     }
 }
 /**
  * Test Creation for CustomerReviewReportEntity
  *
  * @param Review $review
  * @param Customer $customer
  * @param $customerLogin
  * @param CatalogProductSimple $product
  * @param BrowserInterface $browser
  * @return array
  *
  * @SuppressWarnings(PHPMD.ConstructorWithNameAsEnclosingClass)
  */
 public function test(Review $review, Customer $customer, CatalogProductSimple $product, BrowserInterface $browser, $customerLogin)
 {
     // Preconditions
     $product->persist();
     $this->cmsIndex->open();
     if ($customerLogin == 'Yes') {
         $this->cmsIndex->getLinksBlock()->openLink("Log In");
         $this->customerAccountLogin->getLoginBlock()->login($customer);
     }
     // Steps
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->pageCatalogProductView->getReviewSummary()->getAddReviewLink()->click();
     $this->pageCatalogProductView->getReviewFormBlock()->fill($review);
     $this->pageCatalogProductView->getReviewFormBlock()->submit();
     return ['product' => $product];
 }
 /**
  * Create products in cart report entity
  *
  * @param CustomerInjectable $customer
  * @param CatalogProductSimple $product
  * @param string $isGuest
  * @param Browser $browser
  * @return void
  */
 public function test(CustomerInjectable $customer, CatalogProductSimple $product, $isGuest, Browser $browser)
 {
     // Preconditions
     $product->persist();
     //Steps
     $this->cmsIndex->open()->getLinksBlock()->openLink("Log In");
     $this->customerAccountLogin->getLoginBlock()->login($customer);
     $productUrl = $_ENV['app_frontend_url'] . $product->getUrlKey() . '.html';
     $browser->open($productUrl);
     $this->catalogProductView->getViewBlock()->addToCart($product);
     if ($isGuest) {
         $this->customerAccountLogout->open();
         $browser->open($productUrl);
         $this->catalogProductView->getViewBlock()->addToCart($product);
     }
 }
Ejemplo n.º 13
0
 /**
  * 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();
 }
Ejemplo n.º 14
0
 /**
  * 1. Creating product simple with custom tax product class
  * 2. Log In as customer
  * 3. Add product to shopping cart
  * 4. Estimate Shipping and Tax
  * 5. Implementation assert
  *
  * @param FixtureFactory $fixtureFactory
  * @param TaxRule $taxRule
  * @param CustomerAccountLogin $customerAccountLogin
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CustomerInjectable $customer
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param AddressInjectable $address
  * @param array $shipping
  * @param Browser $browser
  * @param TaxRule $initialTaxRule
  * @return void
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(FixtureFactory $fixtureFactory, TaxRule $taxRule, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout, CustomerInjectable $customer, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, AddressInjectable $address, array $shipping, Browser $browser, TaxRule $initialTaxRule = null)
 {
     $this->initialTaxRule = $initialTaxRule;
     $this->taxRule = $taxRule;
     $this->checkoutCart = $checkoutCart;
     $this->shipping = $shipping;
     if ($this->initialTaxRule !== null) {
         $this->taxRuleCode = $this->taxRule->hasData('code') ? $this->taxRule->getCode() : $this->initialTaxRule->getCode();
     } else {
         $this->taxRuleCode = $this->taxRule->getCode();
     }
     // Creating simple product with custom tax class
     /** @var \Magento\Tax\Test\Fixture\TaxClass $taxProductClass */
     $taxProductClass = $taxRule->getDataFieldConfig('tax_product_class')['source']->getFixture()[0];
     $this->productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => '100_dollar_product_for_tax_rule', 'data' => ['tax_class_id' => ['tax_product_class' => $taxProductClass]]]);
     $this->productSimple->persist();
     // Customer login
     $customerAccountLogout->open();
     $customerAccountLogin->open();
     $customerAccountLogin->getLoginBlock()->login($customer);
     // Clearing shopping cart and adding product to shopping cart
     $checkoutCart->open()->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $this->productSimple->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCart();
     // Estimate Shipping and Tax
     $checkoutCart->getShippingBlock()->openEstimateShippingAndTax();
     $checkoutCart->getShippingBlock()->fill($address);
     $checkoutCart->getShippingBlock()->clickGetQuote();
     $checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
     $this->assert();
 }
 /**
  * Assert that customer forgot password message is present on customer account forgot password page.
  *
  * @param CustomerAccountLogin $customerLogin
  * @param Customer $customer
  * @return void
  */
 public function processAssert(CustomerAccountLogin $customerLogin, Customer $customer)
 {
     $message = sprintf(self::SUCCESS_MESSAGE_FIRST_PART . self::SUCCESS_MESSAGE_SECOND_PART, $customer->getEmail());
     \PHPUnit_Framework_Assert::assertEquals($message, $customerLogin->getMessages()->getSuccessMessages(), 'Wrong forgot password message is displayed.');
 }
 /**
  * Assert that customer locked message is present on customer login page.
  *
  * @param CustomerAccountLogin $customerLogin
  * @return void
  */
 public function processAssert(CustomerAccountLogin $customerLogin)
 {
     \PHPUnit_Framework_Assert::assertEquals(self::CUSTOMER_LOCKED_MESSAGE, $customerLogin->getMessages()->getErrorMessage(), 'Wrong message is displayed.');
 }