public function nextAction()
 {
     $button = $this->webdriver->byXpath($this->theme->getCustomerButtonXpath());
     $button->click();
     $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getBillingFirstNameXpath(), AbstractTestCase::BY_XPATH));
     return true;
 }
Пример #2
0
 public function extract()
 {
     if (!$this->nodePath) {
         throw new InvalidInstructionException('Node path was not specified');
     }
     $parts = explode('/', $this->nodePath);
     $xpath = $this->theme->getXTreeRootXpath();
     if ($this->rootCategory) {
         $xpath = $this->theme->getXTreeNamedRootXpath($this->rootCategory);
     }
     $xpath .= $this->theme->getXTreeChildNodePrefixXpath();
     $previousExpandXpath = '';
     $element = null;
     foreach ($parts as $part) {
         $xpath .= '/' . $this->theme->getXTreeChildXpath($part);
         if (!$this->webDriver->elementExists($xpath, WebDriver::BY_XPATH)) {
             if ($previousExpandXpath) {
                 $this->testCase->assertElementExists($previousExpandXpath, WebDriver::BY_XPATH);
                 $this->webDriver->byXpath($previousExpandXpath)->click();
                 $this->webDriver->wait()->until(ExpectedCondition::elementExists($xpath, WebDriver::BY_XPATH));
                 $this->testCase->sleep('1s');
                 // Give the menu time to render
             }
         }
         $this->testCase->assertElementExists($xpath, WebDriver::BY_XPATH);
         $element = $this->webDriver->byXpath($xpath);
         if (!$element->isDisplayed()) {
             throw new ElementNotVisibleException('Node element is not visible and cannot be made visible: ' . $part);
         }
         $previousExpandXpath = $xpath . $this->theme->getXTreeChildNodeExpandPrefixXpath();
         $xpath .= $this->theme->getXTreeChildNodePrefixXpath();
     }
     $this->node = $element;
 }
Пример #3
0
    public function testWaitUntilElementExists()
    {
        $time = time();
        $script = <<<SCRIPT
<html><script>
setTimeout(
    function(){
    document.getElementById('test').innerHTML = '<div id="a">test</div>';
    },
    5000
);
</script>
<body>
<div id="test"></div>
</body>
</html>
SCRIPT;
        $filename = tempnam(sys_get_temp_dir(), 'test');
        $fh = fopen($filename, 'w+');
        fwrite($fh, $script);
        fclose($fh);
        chmod($filename, 0666);
        $this->commandOpen('file://' . $filename);
        unlink($filename);
        $this->webdriver->wait()->until(ExpectedCondition::elementExists('a'));
        $doneTime = time();
        self::assertGreaterThan($time + 3, $doneTime);
    }
 public function nextAction()
 {
     $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getShippingMethodContinueButtonXpath(), WebDriver::BY_XPATH));
     $this->webdriver->wait()->until(ExpectedCondition::visibilityOf($this->webdriver->byXpath($this->theme->getShippingMethodContinueButtonXpath())));
     $this->webdriver->byXpath($this->theme->getShippingMethodContinueButtonXpath())->click();
     $this->webdriver->wait()->until(WebDriverExpectedCondition::not(WebDriverExpectedCondition::visibilityOf($this->webdriver->byXpath($this->theme->getShippingMethodContinueCompletedXpath()))));
     return true;
 }
Пример #5
0
 public function execute()
 {
     $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getShippingMethodContinueButtonXpath(), WebDriver::BY_XPATH));
     $this->webdriver->wait()->until(ExpectedCondition::visibilityOf($this->webdriver->byXpath($this->theme->getShippingMethodContinueButtonXpath())));
     $this->shipping->choose($this->requireShipping);
     return true;
     // continue to next step
 }
Пример #6
0
 public function execute(WebDriverElement $testElement = null)
 {
     if ($testElement instanceof WebDriverElement) {
         $this->webDriver->wait()->until(ExpectedCondition::elementRemoved($testElement));
     }
     $this->webDriver->wait()->until(ExpectedCondition::elementExists($this->theme->getGuaranteedPageLoadedElementDisplayedXpath(), WebDriver::BY_XPATH));
     $element = $this->webDriver->byXpath($this->theme->getGuaranteedPageLoadedElementDisplayedXpath());
     $this->webDriver->wait()->until(ExpectedCondition::visibilityOf($element));
 }
 public function execute()
 {
     $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getGuestCheckoutButtonXpath(), AbstractTestCase::BY_XPATH));
     $this->testCase->assertElementDisplayed($this->theme->getGuestCheckoutButtonXpath(), AbstractTestCase::BY_XPATH);
     $element = $this->webdriver->byXpath($this->theme->getGuestCheckoutButtonXpath());
     $this->testCase->assertWebDriverElement($element);
     $element->click();
     return true;
 }
Пример #8
0
 public function save()
 {
     $this->webDriver->executeScript('window.scrollTo(0, 0);');
     $this->webDriver->wait()->until(ExpectedCondition::elementExists($this->adminThemeConfiguration->getSystemConfigurationSaveButtonXpath(), AbstractTestCase::BY_XPATH));
     $this->testCase->assertElementDisplayed($this->adminThemeConfiguration->getSystemConfigurationSaveButtonXpath(), AbstractTestCase::BY_XPATH);
     $element = $this->webDriver->byXpath($this->adminThemeConfiguration->getSystemConfigurationSaveButtonXpath());
     $element->click();
     $this->webDriver->wait()->until(ExpectedCondition::elementRemoved($element));
     $this->testCase->assertElementDisplayed($this->adminThemeConfiguration->getSystemConfigSaveSuccessfulXpath(), WebDriver::BY_XPATH);
 }
Пример #9
0
 /**
  * @param array $instructions
  * @throws ElementNotVisibleException
  * @throws InvalidConfigurationException
  * @throws \Facebook\WebDriver\Exception\NoSuchElementException
  * @throws \Facebook\WebDriver\Exception\TimeOutException
  */
 public function navigateTo(array $instructions)
 {
     $this->testCase->assertGreaterThan(0, count($instructions), 'Instruction navigator requires at least one instruction');
     $useAutomaticTiming = true;
     foreach ($instructions as $key => $instruction) {
         if (count($instruction) > 0 && $instruction[0] == self::INSTRUCTION_USE_MANUAL_TIMING) {
             $useAutomaticTiming = false;
         }
     }
     foreach ($instructions as $instruction) {
         $this->testCase->assertCount(2, $instruction, 'Navigation instructions need to be a 2 member array.  First item is the instruction type, the second is the XPath');
         list($instruction, $xpath) = $instruction;
         if ($useAutomaticTiming) {
             $this->testCase->sleep('100ms');
             // Courtesy sleep of 100ms
             if ($instruction == self::INSTRUCTION_MOUSE_MOVETO || $instruction == self::INSTRUCTION_MOUSE_CLICK) {
                 $this->webdriver->wait()->until(ExpectedCondition::elementExists($xpath, WebDriver::BY_XPATH));
                 $this->webdriver->wait(5)->until(ExpectedCondition::elementToBeClickable(WebDriverBy::xpath($xpath)));
             }
         }
         switch ($instruction) {
             case self::INSTRUCTION_MOUSE_CLICK:
                 $element = $this->webdriver->byXpath($xpath);
                 if (!$element->isDisplayed()) {
                     throw new ElementNotVisibleException('The element is not visible: ' . $xpath);
                 }
                 $element->click();
                 break;
             case self::INSTRUCTION_MOUSE_MOVETO:
                 $element = $this->webdriver->byXpath($xpath);
                 $this->webdriver->getMouse()->mouseMove($element->getCoordinates());
                 break;
             case self::INSTRUCTION_WAIT_FOR_EXISTS:
                 $this->webdriver->wait()->until(ExpectedCondition::elementExists($xpath, WebDriver::BY_XPATH));
                 break;
             case self::INSTRUCTION_WAIT_FOR_NOT_EXISTS:
                 $this->webdriver->wait()->until(ExpectedCondition::not(ExpectedCondition::elementExists($xpath, WebDriver::BY_XPATH)));
                 break;
             case self::INSTRUCTION_WAIT_FOR_DISPLAYED:
                 $element = $this->webdriver->byXpath($xpath);
                 $this->webdriver->wait()->until(ExpectedCondition::visibilityOf($element));
                 break;
             case self::INSTRUCTION_PAUSE:
                 $this->testCase->sleep($xpath);
                 break;
             case self::INSTRUCTION_WAIT_FOR_HIDDEN:
                 $element = $this->webdriver->byXpath($xpath);
                 $this->webdriver->wait()->until(ExpectedCondition::not(ExpectedCondition::visibilityOf($element)));
                 break;
             default:
                 throw new InvalidConfigurationException('Unknown login instruction: ' . $instruction);
         }
     }
 }
Пример #10
0
 /**
  * Navigates to the section of the account management based off the section provided.  IF the header value is provided
  * it will issue a wait() command until the proper page header exists before returning.  This takes into account
  * the possibility of a section being loaded by Ajax while also retaining compatibility with templates based off
  * of the core template
  *
  * @param $section
  * @param null $header The title of the page
  */
 public function navigateTo($section, $header = null)
 {
     $xpath = $this->themeConfiguration->getAccountNavigationXpath($section);
     $element = $this->webDriver->byXpath($xpath);
     $element->click();
     $this->loader->execute($element);
     if ($header !== null) {
         $xpath = $this->themeConfiguration->getAccountSectionHeaderXpath($header);
         $this->webDriver->wait()->until(ExpectedCondition::elementExists($xpath, WebDriver::BY_XPATH));
     }
 }
 public function execute()
 {
     if (!$this->customer->isUniqueEmailAddressGenerated()) {
         $this->customer->generateUniqueEmailAddress();
     }
     $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getRegisterNewCustomerCheckoutButtonXpath(), AbstractTestCase::BY_XPATH));
     $element = $this->webdriver->byXpath($this->theme->getRegisterNewCustomerCheckoutButtonXpath());
     $this->testCase->assertWebDriverElement($element);
     $element->click();
     return true;
 }
Пример #12
0
 public function execute()
 {
     $this->webdriver->wait(10)->until(ExpectedCondition::elementExists($this->theme->getPaymentMethodContinueButtonXpath(), WebDriver::BY_XPATH));
     $element = $this->webdriver->byXpath($this->theme->getPaymentMethodContinueButtonXpath());
     $this->webdriver->wait(5)->until(ExpectedCondition::visibilityOf($element));
     /* Given that there is the possibility of either a) products with $0, and b) payment methods that do not use
      * the standard form we do not fail if we cannot find payment elements
      */
     $this->paymentMethod->pay($this->requirePayment);
     return true;
 }
 public function choose($required)
 {
     $this->webDriver->wait()->until(ExpectedCondition::elementExists($this->theme->getShippingMethodFormXpath(), AbstractTestCase::BY_XPATH));
     // Some products, such as virtual products, do not get shipped
     if ($required) {
         $this->testCase->assertElementExists($this->theme->getDefaultShippingXpath(), AbstractTestCase::BY_XPATH);
         $this->testCase->assertElementDisplayed($this->theme->getDefaultShippingXpath(), AbstractTestCase::BY_XPATH);
     }
     if ($this->webDriver->elementDisplayed($this->theme->getDefaultShippingXpath(), AbstractTestCase::BY_XPATH)) {
         $this->webDriver->byXpath($this->theme->getDefaultShippingXpath())->click();
     }
 }
 protected function clickAddToCart()
 {
     $element = $this->addToCart->getElement();
     // Because, for some reason, the M2 design HIDES the add-to-cart button as part of the default theme.   Why
     // would you want to hide the second most important button on the site?
     try {
         $element->click();
     } catch (\Exception $e) {
         $e2 = $this->webDriver->byXpath($this->theme->getAddToCartXpath() . '/ancestor::li');
         $this->webDriver->getMouse()->mouseMove($e2->getCoordinates());
         $element->click();
     }
     $this->webDriver->wait()->until(ExpectedCondition::elementExists($this->theme->getAddToCartSuccessXpath(), WebDriver::BY_XPATH));
 }
 public function extract()
 {
     $testXpath = $this->theme->getSearchSuggestionTextXpath(1);
     $this->webDriver->wait(5)->until(ExpectedCondition::elementExists($testXpath, WebDriver::BY_XPATH));
     $testElement = $this->webDriver->byXpath($testXpath);
     $this->webDriver->wait(5)->until(ExpectedCondition::visibilityOf($testElement));
     $count = 0;
     $this->suggestions = [];
     while ($this->webDriver->elementExists($this->theme->getSearchSuggestionTextXpath(++$count), WebDriver::BY_XPATH)) {
         $suggestionCount = trim($this->webDriver->byXpath($this->theme->getSearchSuggestionCountXpath($count))->getText());
         $suggestionText = trim($this->webDriver->byXpath($this->theme->getSearchSuggestionTextXpath($count))->getText());
         $suggestionText = trim($suggestionText, $suggestionCount);
         $this->suggestions[] = new SearchSuggestion($this->webDriver->byXpath($this->theme->getSearchSuggestionTextXpath($count)), $suggestionCount, $suggestionText);
     }
 }
Пример #16
0
 public function extract()
 {
     $productIterator = new ProductIterator();
     $this->values[self::VALUE_PRODUCTS] = $productIterator;
     $count = 1;
     $testProductXpath = $this->theme->getCartSummaryCheckoutProductLoopNameXpath($count);
     $this->webDriver->wait()->until(ExpectedCondition::elementExists($testProductXpath, WebDriver::BY_XPATH));
     while ($this->webDriver->elementExists($testProductXpath, WebDriver::BY_XPATH)) {
         $xpath = $this->theme->getCartSummaryCheckoutProductLoopNameXpath($count);
         $nameElement = $this->webDriver->byXpath($xpath);
         $name = trim($nameElement->getText());
         $xpath = $this->theme->getCartSummaryCheckoutProductLoopPriceXpath($count);
         if ($this->webDriver->elementExists($xpath, WebDriver::BY_XPATH)) {
             $priceElement = $this->webDriver->byXpath($xpath);
             $price = trim($priceElement->getText());
             // We do not extract the number value so currency checks can be done
         } else {
             $price = 0;
         }
         $xpath = $this->theme->getCartSummaryCheckoutProductLoopQtyXpath($count);
         if ($this->webDriver->elementExists($xpath, WebDriver::BY_XPATH)) {
             $qtyElement = $this->webDriver->byXpath($xpath);
             $qty = trim($qtyElement->getText());
         } else {
             $qty = 0;
         }
         $xpath = $this->theme->getCartSummaryCheckoutProductLoopSubtotalXpath($count);
         if ($this->webDriver->elementExists($xpath, WebDriver::BY_XPATH)) {
             $subtotalElement = $this->webDriver->byXpath($xpath);
             $subtotal = trim($subtotalElement->getText());
         } else {
             $subtotal = 0;
         }
         $product = new Product($name, $qty, $price, $subtotal);
         $productIterator->addProduct($product);
         $testProductXpath = $this->theme->getCartSummaryCheckoutProductLoopNameXpath(++$count);
     }
     // Tax and shipping may not be displayed
     if ($this->webDriver->elementDisplayed($this->theme->getCartSummaryCheckoutTax(), WebDriver::BY_XPATH)) {
         $this->values[self::VALUE_TAX] = trim($this->webDriver->byXpath($this->theme->getCartSummaryCheckoutTax())->getText());
     }
     if ($this->webDriver->elementDisplayed($this->theme->getCartSummaryCheckoutShippingTotal(), WebDriver::BY_XPATH)) {
         $this->values[self::VALUE_SnH] = trim($this->webDriver->byXpath($this->theme->getCartSummaryCheckoutShippingTotal())->getText());
     }
     $this->values[self::VALUE_GRAND_TOTAL] = trim($this->webDriver->byXpath($this->theme->getCartSummaryCheckoutGrandTotal())->getText());
     $this->values[self::VALUE_SUBTOTAL] = trim($this->webDriver->byXpath($this->theme->getCartSummaryCheckoutSubTotal())->getText());
 }
Пример #17
0
 public function navigateTo($tab)
 {
     $tabs = explode('::', $tab);
     $tab = $header = array_shift($tabs);
     if (count($tabs)) {
         $header = array_shift($tabs);
     }
     $element = $this->webDriver->byXpath($this->themeConfiguration->getWidgetTabXpath($tab));
     $element->click();
     if ($header) {
         $this->webDriver->wait()->until(ExpectedCondition::elementExists($this->themeConfiguration->getWidgetTabHeaderXpath($header), WebDriver::BY_XPATH));
         $element = $this->webDriver->byXpath($this->themeConfiguration->getWidgetTabHeaderXpath($header));
     } else {
         $this->loadingMask->wait();
     }
     $this->webDriver->wait()->until(ExpectedCondition::visibilityOf($element));
 }
Пример #18
0
 public function testTwitterAuth()
 {
     // This part of the test will not work on your system.  You will need to change it.
     $this->commandOpen('http://magiumlib.loc/');
     $this->byText('Log In')->click();
     // This part of the test should work on your system.  If it doesn't work then something is probably wrong.
     // Make sure you configure your twitter account in the file /configuration/Magium/Twitter/Identities/Twitter.php
     /*
      * $this->username = '******';
      * $this->password = '******';
      */
     $action = $this->getAction(Login::ACTION);
     /* @var $action Login */
     $action->setIdentity($this->getIdentity(Twitter::IDENTITY));
     $action->execute();
     $this->webdriver->wait(5)->until(ExpectedCondition::elementExists('login-link'));
 }
 public function execute($registerForNewsletter = false)
 {
     $this->webdriver->wait(5)->until(ExpectedCondition::elementExists($this->theme->getRegisterFirstNameXpath(), WebDriver::BY_XPATH));
     $firstnameElement = $this->webdriver->byXpath($this->theme->getRegisterFirstNameXpath());
     $this->webdriver->wait(5)->until(ExpectedCondition::visibilityOf($firstnameElement));
     $lastnameElement = $this->webdriver->byXpath($this->theme->getRegisterLastNameXpath());
     $emailElement = $this->webdriver->byXpath($this->theme->getRegisterEmailXpath());
     $passwordElement = $this->webdriver->byXpath($this->theme->getRegisterPasswordXpath());
     $confirmElement = $this->webdriver->byXpath($this->theme->getRegisterConfirmPasswordXpath());
     $registerElement = $this->webdriver->byXpath($this->theme->getRegisterNewsletterXpath());
     $firstnameElement->sendKeys($this->customerIdentity->getFirstName());
     $lastnameElement->sendKeys($this->customerIdentity->getLastName());
     $emailElement->sendKeys($this->customerIdentity->getEmailAddress());
     $passwordElement->sendKeys($this->customerIdentity->getPassword());
     $confirmElement->sendKeys($this->customerIdentity->getPassword());
     if ($registerForNewsletter) {
         $registerElement->click();
     }
 }
 public function navigateTo($path)
 {
     $instructions = explode('/', $path);
     if (count($instructions) !== 2) {
         throw new InvalidInstructionException('System Configuration instructions need to be in the format of "Tab/Section"');
     }
     $tabXpath = $this->themeConfiguration->getSystemConfigTabsXpath($instructions[0]);
     $sectionDisplayXpath = $this->themeConfiguration->getSystemConfigSectionDisplayCheckXpath($instructions[1]);
     $sectionToggleXpath = $this->themeConfiguration->getSystemConfigSectionToggleXpath($instructions[1]);
     $this->testCase->assertElementExists($tabXpath, AbstractTestCase::BY_XPATH);
     if (!$this->webdriver->elementDisplayed($sectionDisplayXpath, WebDriver::BY_XPATH)) {
         $this->webdriver->byXpath($tabXpath)->click();
         $this->webdriver->wait()->until(ExpectedCondition::elementExists($sectionDisplayXpath, AbstractTestCase::BY_XPATH));
     }
     $this->testCase->assertElementExists($sectionToggleXpath, AbstractTestCase::BY_XPATH);
     if (!$this->webdriver->elementDisplayed($sectionDisplayXpath, AbstractTestCase::BY_XPATH)) {
         $element = $this->webdriver->byXpath($sectionToggleXpath);
         $element->click();
     }
 }
Пример #21
0
 public function choose($required)
 {
     if (!$this->name) {
         throw new MissingInformationException('Missing the names');
     }
     $xpath = $this->theme->getShippingByNameXpath($this->name);
     try {
         $this->webDriver->wait()->until(ExpectedCondition::elementExists($xpath, AbstractTestCase::BY_XPATH));
     } catch (\Exception $e) {
         throw new NoSuchShippingMethodException('Unable to find the shipping method: ' . $this->name);
     }
     // Some products, such as virtual products, do not get shipped
     if ($required) {
         $this->testCase->assertElementExists($xpath, AbstractTestCase::BY_XPATH);
         $this->testCase->assertElementDisplayed($xpath, AbstractTestCase::BY_XPATH);
     }
     if ($this->webDriver->elementDisplayed($xpath, AbstractTestCase::BY_XPATH)) {
         $this->webDriver->byXpath($xpath)->click();
     }
 }
Пример #22
0
 public function navigateTo(AbstractCustomerNavigation $navigation)
 {
     $this->adminMenuNavigator->navigateTo('Customers/Manage Customers');
     $this->clearTableFilters->clear();
     $parts = explode('-', $navigation->getSelectorID());
     foreach ($parts as $part) {
         $element = $this->webDriver->byId($part);
         $element->sendKeys($navigation->getSearch());
     }
     $this->clickButton->click($this->themeConfiguration->getSearchButtonText());
     $this->testCase->sleep('100ms');
     $this->waitForLoadingMask->wait();
     $selectXpath = $this->themeConfiguration->getSelectCustomerXpath($navigation->getSearch());
     $this->testCase->assertElementDisplayed($selectXpath, WebDriver::BY_XPATH);
     $element = $this->webDriver->byXpath($selectXpath);
     $element->click();
     $elementExists = $this->testCase->getTranslator()->translatePlaceholders('//h4[.="{{Personal Information}}"]');
     $this->webDriver->wait()->until(ExpectedCondition::elementExists($elementExists, WebDriver::BY_XPATH));
     $element = $this->webDriver->byXpath($elementExists);
     $this->webDriver->wait()->until(ExpectedCondition::visibilityOf($element));
 }
Пример #23
0
 public function testAuthenticationWorksEvenIfCurrentUserIsLoggedIn()
 {
     $this->markTestSkipped('This test requires a local Magium environment.  It will not work.');
     // This test is based off of my own test environment and so everything up until the Twitter authentication will
     // not work.  So ignore the first part.
     // Also note that this test only works for users that have NOT signed in with your app.
     $identity = $this->getIdentity(Twitter::IDENTITY);
     /* @var $identity Twitter */
     $this->commandOpen('https://www.twitter.com/');
     $this->byText('Log In')->click();
     $this->byXpath('//input[@name="session[username_or_email]"]')->sendKeys($identity->getUsername());
     $this->byXpath('//input[@name="session[password]"]')->sendKeys($identity->getPassword());
     $this->byXpath('//input[@type="submit" and @value="Log in"]')->click();
     $this->commandOpen('http://magiumlib.loc/');
     $this->byText('Log In')->click();
     $this->webdriver->wait()->until(ExpectedCondition::elementExists('//div[@data-strategy="twitter"]', WebDriver::BY_XPATH));
     $element = $this->byXpath('//div[@data-strategy="twitter"]');
     $this->webdriver->wait()->until(ExpectedCondition::visibilityOf($element));
     $this->byXpath('//div[@data-strategy="twitter"]')->click();
     // This part should work for you
     $action = $this->getAction(SignInWithTwitter::ACTION);
     /* @var $action AuthenticateTwitter */
     $action->execute();
 }
 public function navigateTo($subject)
 {
     $this->navigate($subject);
     $waitXpath = sprintf('//h2[contains(., "%s")]', $subject);
     $this->webDriver->wait()->until(ExpectedCondition::elementExists($waitXpath, WebDriver::BY_XPATH));
 }
Пример #25
0
 public function logout()
 {
     $this->instructionsNavigator->navigateTo($this->theme->getLogoutNavigationInstructions());
     $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getLogoutSuccessXpath(), WebDriver::BY_XPATH));
 }
Пример #26
0
 public function extract()
 {
     if ($this->elementTest instanceof WebDriverElement && $this->webDriver->elementAttached($this->elementTest)) {
         return;
     }
     // For some reason Firefox sometimes cannot find the body element, so we'll wait for it to exist instead.
     $this->webDriver->wait()->until(ExpectedCondition::elementExists('//body', WebDriver::BY_XPATH));
     $this->elementTest = $this->webDriver->byXpath('//body');
     $element = $this->webDriver->byXpath($this->theme->getProductCollectionProductCountXpath());
     $this->statedProductCount = trim($element->getText());
     $element = $this->webDriver->byXpath($this->theme->getProductCollectionViewModeXpath());
     $this->viewMode = strtolower($element->getAttribute($this->theme->getViewModeAttributeName()));
     $element = $this->webDriver->byXpath($this->theme->getProductCollectionSortByXpath());
     $this->sortBy = trim($element->getText());
     $element = $this->webDriver->byXpath($this->theme->getProductCollectionShowCountXpath());
     $this->showCount = trim($element->getText());
     $this->showCountOptions = [];
     $elements = $this->webDriver->findElements(WebDriverBy::xpath($this->theme->getProductCollectionShowCountOptionsXpath()));
     foreach ($elements as $element) {
         $this->showCountOptions[] = trim($element->getText());
     }
 }
Пример #27
0
 public function nextAction()
 {
     $this->webdriver->byXpath($this->theme->getPlaceOrderButtonXpath())->click();
     $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getOrderReceivedCompleteXpath(), AbstractTestCase::BY_XPATH));
     return true;
 }