Example #1
0
 public function login($username = null, $password = null)
 {
     // We break SOLID here there might be scenarios where multiple logins are required.  So for expediency's sake
     // We're having the login action take responsibility for figuring out how to get to the login screen.
     $url = $this->webdriver->getCurrentURL();
     if (strpos($url, 'http') === false) {
         $this->openCommand->open($this->theme->getBaseUrl());
     } else {
         $this->webdriver->navigate()->to($this->theme->getBaseUrl());
         $title = $this->webdriver->getTitle();
         if (strpos($title, $this->testCase->getTranslator()->translate('Dashboard')) !== false) {
             return;
         }
     }
     $usernameElement = $this->webdriver->byXpath($this->theme->getLoginUsernameField());
     $passwordElement = $this->webdriver->byXpath($this->theme->getLoginPasswordField());
     $submitElement = $this->webdriver->byXpath($this->theme->getLoginSubmitButton());
     $this->testCase->assertWebDriverElement($usernameElement);
     $this->testCase->assertWebDriverElement($passwordElement);
     $this->testCase->assertWebDriverElement($submitElement);
     if ($username === null) {
         $username = $this->adminIdentity->getAccount();
     }
     if ($password === null) {
         $password = $this->adminIdentity->getPassword();
     }
     $usernameElement->clear();
     $passwordElement->clear();
     $usernameElement->sendKeys($username);
     $passwordElement->sendKeys($password);
     $submitElement->click();
     $this->webdriver->wait()->until(ExpectedCondition::titleContains($this->testCase->getTranslator()->translate('Dashboard')));
     $this->messages->extract();
 }
 public function navigateTo($orderId)
 {
     $xpath = $this->themeConfiguration->getAccountNavigationXpath($this->themeConfiguration->getOrderPageName());
     $element = $this->webDriver->byXpath($xpath);
     $element->click();
     $this->loaded->execute($element);
     $xpath = $this->themeConfiguration->getViewOrderLinkXpath($orderId);
     $element = $this->webDriver->byXpath($xpath);
     $element->click();
     $this->loaded->execute($element);
     $this->webDriver->wait()->until(ExpectedCondition::titleContains($this->themeConfiguration->getOrderPageTitleContainsText()));
 }
Example #3
0
 public function navigateTo($orderId, $doLoginIfNeeded = false)
 {
     if ($doLoginIfNeeded) {
         $this->adminLogin->login();
     }
     $this->adminMenuNavigator->navigateTo('Sales/Orders');
     $this->clearTableFilters->clear();
     $element = $this->webDriver->byId('sales_order_grid_filter_real_order_id');
     $element->sendKeys($orderId);
     $this->clickButton->click($this->themeConfiguration->getSearchButtonText());
     $this->testCase->sleep('100ms');
     $this->waitForLoadingMask->wait();
     $selectXpath = $this->themeConfiguration->getSelectOrderXpath($orderId);
     $this->testCase->assertElementDisplayed($selectXpath, WebDriver::BY_XPATH);
     $element = $this->webDriver->byXpath($selectXpath);
     $element->click();
     $this->webDriver->wait()->until(ExpectedCondition::titleContains($orderId));
 }