public function submit() { $this->searchButton->click(); sleep(1); $this->waitPageToLoad(); $this->waitForAjax(); return $this; }
/** * @param $user * @return $this */ public function setUser($user) { $this->user->click(); $this->user->value($user); $this->waitForAjax(); $this->assertElementPresent("//div[@id='select2-drop']//div[contains(., '{$user}')]", "Users autocomplete field doesn't return entity"); $this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$user}')]")->click(); return $this; }
public function setB2BCustomer($customer) { $this->b2b_customer->click(); $this->waitForAjax(); $this->test->byXpath("//div[@id='select2-drop']/div/input")->value($customer); $this->waitForAjax(); $this->assertElementPresent("//div[@id='select2-drop']//div[contains(., '{$customer}')]", "Account autocomplete doesn't return search value"); $this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$customer}')]")->click(); return $this; }
public function setOwner($owner) { $this->owner->click(); $this->waitForAjax(); $this->test->byXPath("//div[@id='select2-drop']/div/input")->value($owner); $this->waitForAjax(); $this->assertElementPresent("//div[@id='select2-drop']//div[contains(., '{$owner}')]", "Owner autocomplete doesn't return search value"); $this->test->byXPath("//div[@id='select2-drop']//div[contains(., '{$owner}')]")->click(); return $this; }
public function setOwner($owner) { $this->owner = $this->test->byXPath("//div[starts-with(@id,'s2id_orocrm_account_form_owner')]/a"); $this->owner->click(); $this->waitForAjax(); $this->test->byXPath("//div[@id='select2-drop']/div/input")->value($owner); $this->waitForAjax(); $this->assertElementPresent("//div[@id='select2-drop']//div[contains(., '{$owner}')]", "Owner autocomplete doesn't return search value"); $this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$owner}')]")->click(); return $this; }
public function selectEntity($type, $entity) { $this->opportunity = $this->test->byXpath("(//button[contains(@class, 'entity-select-btn')])[last()]"); $this->opportunity->click(); $this->waitPageToLoad(); $this->waitForAjax(); $this->test->byXpath("//div[@class='filter-container']//*[contains(@class,'filter-criteria-selector')]" . "[contains(., '{$type} name')]")->click(); $filter = $this->test->byXpath("//div[contains(@class, 'filter-item oro-drop open-filter' )]//input[@name='value']"); $filter->clear(); $filter->value($entity); $this->test->byXPath("//div[contains(@class, 'filter-item oro-drop open-filter' )]//button[contains(., 'Update')]")->click(); $this->waitForAjax(); $this->test->byXpath("//table[@class='grid table-hover table table-bordered table-condensed']//td[contains(., '{$entity}')]")->click(); sleep(1); $this->waitPageToLoad(); $this->waitForAjax(); return $this; }
public function setReportsTo($reportsTo) { $this->reportsTo->click(); $this->waitForAjax(); $this->test->byXpath("//div[@id='select2-drop']/div/input")->value($reportsTo); $this->waitForAjax(); $this->assertElementPresent("//div[@id='select2-drop']//div[contains(., '{$reportsTo}')]", "Reports to autocomplete doesn't return search value"); $this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$reportsTo}')]")->click(); return $this; }
public function setCampaign($campaign) { $this->test->moveto($this->campaign); $this->campaign->click(); $this->waitForAjax(); $this->test->byXpath("//div[@id='select2-drop']/div/input")->value($campaign); $this->waitForAjax(); $this->assertElementPresent("//div[@id='select2-drop']//div[contains(., '{$campaign}')]", "Campaign autocomplete doesn't return search value"); $this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$campaign}')]")->click(); return $this; }
/** * @param $dueDate string Due date * @return $this * @throws \Exception */ public function setDueDate($dueDate) { $this->dueDate = $this->test->byXpath("//*[@data-ftid='orocrm_task_dueDate']/.." . "/following-sibling::*//input[contains(@class,'datepicker-input')]"); $this->dueTime = $this->test->byXpath("//*[@data-ftid='orocrm_task_dueDate']/.." . "/following-sibling::*//input[contains(@class,'timepicker-input')]"); $this->dueDate->clear(); $this->dueTime->clear(); $dueDateParts = []; if (preg_match('/^(.+\\d{4}),?\\s(\\d{1,2}\\:\\d{2}\\s\\w{2})$/', $dueDate, $dueDateParts)) { $this->dueDate->click(); // focus $this->dueDate->value($dueDateParts[1]); $this->dueTime->click(); // focus $this->dueTime->clear(); $this->dueTime->value($dueDateParts[2]); } else { throw new Exception("Value {$dueDate} is not a valid date"); } return $this; }
/** * @param $tag * @return $this * @throws \Exception */ public function setTag($tag) { if ($this->isElementPresent("//div[starts-with(@id,'s2id_oro_user_user_form_tags_autocomplete')]")) { $this->tags = $this->test->byXpath("//div[starts-with(@id,'s2id_oro_user_user_form_tags_autocomplete')]//input"); $this->tags->click(); $this->tags->value($tag); $this->waitForAjax(); $this->assertElementPresent("//div[@id='select2-drop']//div[contains(., '{$tag}')]", "Tag's autocomplete doesn't return entity"); $this->test->byXpath("//div[@id='select2-drop']//div[contains(., '{$tag}')]")->click(); return $this; } else { throw new \Exception("Tag field can't be found"); } }
/** * @param \PHPUnit_Extensions_Selenium2TestCase_Element $clickElement * @param string $waitForSelector * @param boolean $displayCheck * @return \PHPUnit_Extensions_Selenium2TestCase_Element|null */ protected function clickAndWait(\PHPUnit_Extensions_Selenium2TestCase_Element $clickElement, $waitForSelector, $displayCheck = false) { $this->execute(['script' => 'window.scrollTo(' . $clickElement->location()['x'] . ', ' . $clickElement->location()['y'] . ');', 'args' => []]); $clickElement->click(); try { $element = $this->waitUntil(function (BaseSeleniumTestCase $testCase) use($waitForSelector, $displayCheck) { try { $element = $testCase->byCssSelector($waitForSelector); if (!$displayCheck || $element->displayed()) { return $element; } } catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { // nothing to do } return null; }, $this->timeout); } catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { $element = null; } return $element; }
public function setLoadFixtures() { $this->loadFixtures->click(); return $this; }
public function sendKeys(\PHPUnit_Extensions_Selenium2TestCase_Element $element, $keys) { if ($this->fileDetectorFunction && call_user_func($this->fileDetectorFunction, $keys)) { $remote_file = $this->file($keys); $element->value($remote_file); } else { $element->click(); $this->keys($keys); } }