/**
  * Changes the shipping method
  * @param array $data
  */
 public function changeShippingMethod($data = array())
 {
     $element = $this->getElement('CheckoutPayment');
     $language = Helper::getCurrentLanguage($this);
     Helper::clickNamedLink($element, 'changeButton', $language);
     Helper::fillForm($this, 'shippingPaymentForm', $data);
     Helper::pressNamedButton($this, 'changePaymentButton');
 }
 /**
  * Searches the given term in the shop
  * @param string $searchTerm
  */
 public function searchFor($searchTerm)
 {
     $data = array(array('field' => 'sSearch', 'value' => $searchTerm));
     $searchForm = $this->getElement('SearchForm');
     $language = Helper::getCurrentLanguage($this);
     Helper::fillForm($searchForm, 'searchForm', $data);
     Helper::pressNamedButton($searchForm, 'searchButton', $language);
     $this->verifyResponse();
 }
 /**
  * @Given /^I click to read the blog article on position (\d+)$/
  */
 public function iClickToReadTheBlogArticleOnPosition($position)
 {
     /** @var Blog $page */
     $page = $this->getPage('Blog');
     $language = Helper::getCurrentLanguage($page);
     /** @var BlogBox $blogBox */
     $blogBox = $this->getMultipleElement($page, 'BlogBox', $position);
     Helper::clickNamedLink($blogBox, 'readMore', $language);
 }
 /**
  * @When /^I order the article on position (?P<position>\d+)$/
  */
 public function iOrderTheArticleOnPosition($position)
 {
     /** @var Listing $page */
     $page = $this->getPage('Listing');
     $language = Helper::getCurrentLanguage($page);
     /** @var ArticleBox $articleBox */
     $articleBox = $this->getMultipleElement($page, 'ArticleBox', $position);
     Helper::clickNamedLink($articleBox, 'order', $language);
 }
 private function clickActionLink($position, $name)
 {
     /** @var Note $page */
     $page = $this->getPage('Note');
     $language = Helper::getCurrentLanguage($page);
     /** @var NotePosition $notePosition */
     $notePosition = $this->getMultipleElement($page, 'NotePosition', $position);
     Helper::clickNamedLink($notePosition, $name, $language);
 }
 /**
  * @Given /^my finished order should look like this:$/
  */
 public function myFinishedOrderShouldLookLikeThis(TableNode $positions)
 {
     $orderNumber = $this->getPage('CheckoutConfirm')->getOrderNumber();
     $values = $positions->getHash();
     /** @var \Shopware\Tests\Mink\Page\Emotion\Account $page */
     $page = $this->getPage('Account');
     $language = Helper::getCurrentLanguage($page);
     $page->open();
     Helper::clickNamedLink($page, 'myOrdersLink', $language);
     /** @var \Shopware\Tests\Mink\Element\Emotion\AccountOrder $order */
     $order = $this->getMultipleElement($page, 'AccountOrder');
     $page->checkOrder($order, $orderNumber, $values);
 }
 /**
  * Verify if we're on an expected page. Throw an exception if not.
  */
 public function verifyPage()
 {
     if ($this->getDriver() instanceof Selenium2Driver) {
         $this->getSession()->wait(5000, '$("#sAGB").length > 0');
     }
     $namedSelectors = $this->getNamedSelectors();
     $language = Helper::getCurrentLanguage();
     try {
         $assert = new WebAssert($this->getSession());
         $assert->pageTextContains($namedSelectors['gtc'][$language]);
     } catch (ResponseTextException $e) {
         $message = ['You are not on the checkout confirmation page!', 'Current URL: ' . $this->getSession()->getCurrentUrl()];
         Helper::throwException($message);
     }
 }
 /**
  * @When /^I follow the link "(?P<linkName>[^"]*)" of the element "(?P<elementClass>[^"]*)"$/
  * @When /^I follow the link "(?P<linkName>[^"]*)" of the element "(?P<elementClass>[^"]*)" on position (?P<position>\d+)$/
  */
 public function iFollowTheLinkOfTheElementOnPosition($linkName, $elementClass, $position = 1)
 {
     /** @var HelperSelectorInterface $element */
     $element = $this->getElement($elementClass);
     if ($element instanceof MultipleElement) {
         /** @var Homepage $page */
         $page = $this->getPage('Homepage');
         /** @var MultipleElement $element */
         $element->setParent($page);
         $element = $element->setInstance($position);
     }
     if (empty($linkName)) {
         $element->click();
         return;
     }
     $language = Helper::getCurrentLanguage($this->getPage('Homepage'));
     $selectors = $element->getNamedSelectors();
     $element->clickLink($selectors[$linkName][$language]);
 }
 /**
  * @param AddressBox $addresses
  * @param string $name
  * @throws \Exception
  */
 protected function searchAddress(AddressBox $addresses, $name)
 {
     /** @var AddressBox $address */
     foreach ($addresses as $address) {
         if (strpos($address->getProperty('title'), $name) === false) {
             continue;
         }
         $language = Helper::getCurrentLanguage($this);
         Helper::pressNamedButton($address, 'chooseButton', $language);
         return;
     }
     $messages = array('The address "' . $name . '" is not available. Available are:');
     /** @var AddressBox $address */
     foreach ($addresses as $address) {
         $messages[] = $address->getProperty('title');
     }
     Helper::throwException($messages);
 }
Exemple #10
0
 /**
  * Proceeds to the confirmation page with login
  * @param string $eMail
  * @param string $password
  */
 public function proceedToOrderConfirmationWithLogin($eMail, $password)
 {
     if ($this->verifyPage()) {
         $locatorArray = $this->getNamedSelectors();
         $parent = Helper::getContentBlock($this);
         $language = Helper::getCurrentLanguage();
         $link = $parent->findLink($locatorArray['checkout'][$language]);
         if ($this->getDriver() instanceof Selenium2Driver) {
             $this->getSession()->visit($link->getAttribute('href'));
         } else {
             $link->click();
         }
     }
     $this->getPage('Account')->login($eMail, $password);
     $this->getPage('CheckoutConfirm')->verifyPage();
 }
 /**
  * Proceeds to the confirmation page with registration
  * @param array $data
  */
 public function proceedToOrderConfirmationWithRegistration(array $data)
 {
     $language = Helper::getCurrentLanguage($this);
     if ($this->verifyPage($language)) {
         Helper::clickNamedLink($this, 'checkout', $language);
     }
     $this->getPage('Account')->register($data);
 }
 /**
  * @param array $data
  */
 public function changeShippingAddress($data = array())
 {
     $element = $this->getElement('CheckoutShipping');
     $language = Helper::getCurrentLanguage($this);
     Helper::clickNamedLink($element, 'changeButton', $language);
     $account = $this->getPage('Account');
     Helper::fillForm($account, 'shippingForm', $data);
     Helper::pressNamedButton($account, 'changeShippingButton', $language);
 }