/** * 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(); } }
/** * 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.'); }
/** * 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(); }