public function testPostFinishAddPhenotypeInfoToCMTIndividual()
 {
     // Wait for redirect
     $this->waitUntil(WebDriverExpectedCondition::titleContains("Submission of"));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000003$/', $this->driver->getCurrentURL()));
     // Move mouse to Individuals tab and click 'view all individuals' option.
     $tabElement = $this->driver->findElement(WebDriverBy::id("tab_individuals"));
     $this->driver->getMouse()->mouseMove($tabElement->getCoordinates());
     $allIndividualsLink = $this->driver->findElement(WebDriverBy::partialLinkText('View all individuals'));
     $allIndividualsLink->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/individuals$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::cssSelector("td.ordered"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/individuals\\/00000001$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::id("viewentryOptionsButton_Individuals"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Add phenotype information to individual"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/phenotypes[\\s\\S]create&target=00000001$/', $this->driver->getCurrentURL()));
     $this->enterValue(WebDriverBy::name("Phenotype/Additional"), "Additional phenotype information");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="Phenotype/Inheritance"]/option[text()="Familial"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Create phenotype information entry']"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^Successfully processed your submission and sent an email notification to the relevant curator[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText()));
     // Wait for redirect
     $this->waitUntil(WebDriverExpectedCondition::titleContains("View phenotype"));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/phenotypes\\/0000000002$/', $this->driver->getCurrentURL()));
 }
 public function testPostFinishAddVariantOnlyDescribedOnGenomicLevelToCMT()
 {
     $this->logout();
     $this->login('collaborator', 'test1234');
     $this->driver->get(ROOT_URL . "/src/");
     // Move mouse to Screenings tab and click 'view all screenings' option.
     $tabElement = $this->driver->findElement(WebDriverBy::id("tab_screenings"));
     $this->driver->getMouse()->mouseMove($tabElement->getCoordinates());
     $allVariantsLink = $this->driver->findElement(WebDriverBy::partialLinkText('View all screenings'));
     $allVariantsLink->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/screenings$/', $this->driver->getCurrentURL()));
     //        $element = $this->driver->findElement(WebDriverBy::cssSelector("#0000000002 > td.ordered"));
     $element = $this->driver->findElement(WebDriverBy::xpath("//td[text()='0000000002']"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/screenings\\/0000000002$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::id("viewentryOptionsButton_Screenings"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Add variant to screening"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create&target=0000000002$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//table[2]/tbody/tr[2]/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create&reference=Genome&target=0000000002$/', $this->driver->getCurrentURL()));
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="allele"]/option[text()="Maternal (confirmed)"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="chromosome"]/option[text()="X"]'));
     $option->click();
     $this->enterValue(WebDriverBy::name("VariantOnGenome/DNA"), "g.40702876G>T");
     $element = $this->driver->findElement(WebDriverBy::linkText("PubMed"));
     $element->click();
     // Move mouse to let browser hide tooltip of pubmed link (needed for chrome)
     $this->driver->getMouse()->mouseMove(null, 200, 200);
     $this->enterValue(WebDriverBy::name("VariantOnGenome/Reference"), "{PMID:Fokkema et al (2011):21520333}");
     $this->enterValue(WebDriverBy::name("VariantOnGenome/Frequency"), "11/10000");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="effect_reported"]/option[text()="Effect unknown"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Create variant entry']"));
     $element->click();
     for ($second = 0;; $second++) {
         if ($second >= 60) {
             $this->fail("timeout");
         }
         try {
             if ($this->isElementPresent(WebDriverBy::cssSelector("table[class=info]"))) {
                 break;
             }
         } catch (Exception $e) {
         }
         sleep(1);
     }
     $this->assertTrue((bool) preg_match('/^Successfully processed your submission and sent an email notification to the relevant curator[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText()));
 }
示例#3
0
 public function testCurateSubmittedData()
 {
     $element = $this->driver->findElement(WebDriverBy::id("tab_variants"));
     $element->click();
     // Move mouse to Variants tab and click 'view all genomic variants' option.
     $tabElement = $this->driver->findElement(WebDriverBy::id("tab_variants"));
     $this->driver->getMouse()->mouseMove($tabElement->getCoordinates());
     $allVariantsLink = $this->driver->findElement(WebDriverBy::partialLinkText('View all genomic variants'));
     $allVariantsLink->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::linkText("0000000001"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/0000000001$/', $this->driver->getCurrentURL()));
     $this->assertEquals("Pending", $this->driver->findElement(WebDriverBy::xpath("//tr[13]/td/span"))->getText());
     $element = $this->driver->findElement(WebDriverBy::id("viewentryOptionsButton_Variants"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Publish (curate) variant entry"));
     $element->click();
     $this->assertEquals("Public", $this->driver->findElement(WebDriverBy::xpath("//tr[13]/td/span"))->getText());
     $element = $this->driver->findElement(WebDriverBy::linkText("00000001"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/individuals\\/00000001$/', $this->driver->getCurrentURL()));
     $this->assertEquals("Pending", $this->driver->findElement(WebDriverBy::xpath("//tr[8]/td"))->getText());
     $element = $this->driver->findElement(WebDriverBy::id("viewentryOptionsButton_Individuals"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Publish (curate) individual entry"));
     $element->click();
     $this->assertEquals("Public", $this->driver->findElement(WebDriverBy::xpath("//tr[8]/td"))->getText());
     // Move mouse to Variants tab and click 'view all genomic variants' option.
     $tabElement = $this->driver->findElement(WebDriverBy::id("tab_variants"));
     $this->driver->getMouse()->mouseMove($tabElement->getCoordinates());
     $allVariantsLink = $this->driver->findElement(WebDriverBy::partialLinkText('View all genomic variants'));
     $allVariantsLink->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::linkText("0000000002"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/0000000002$/', $this->driver->getCurrentURL()));
     $this->assertEquals("Pending", $this->driver->findElement(WebDriverBy::xpath("//tr[13]/td/span"))->getText());
     $element = $this->driver->findElement(WebDriverBy::id("viewentryOptionsButton_Variants"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Publish (curate) variant entry"));
     $element->click();
     $this->assertEquals("Public", $this->driver->findElement(WebDriverBy::xpath("//tr[13]/td/span"))->getText());
 }
 public function getDeviceInfo()
 {
     $this->driver->switchTo()->defaultContent();
     //Нажимаем ссылку "домажней страницы" в левом фрейме меню
     $leftMenuFrame = $this->driver->findElement(WebDriverBy::name('leftMenu'));
     $this->driver->switchTo()->frame($leftMenuFrame);
     $this->driver->switchTo()->frame('treeConfig');
     $this->driver->findElement(WebDriverBy::partialLinkText("DGS-1100"))->click();
     //Возвращаемся на верхний уровень страницы (выходим из фреймов)
     $this->driver->switchTo()->defaultContent();
     //Ждем когда страница прогрузится
     sleep(2);
     //Работаем с фреймом mf0
     $this->driver->switchTo()->frame('mf0');
     //Собираем строки из таблицы tabContent
     $vlanTableRows = $this->driver->findElement(WebDriverBy::id('tabContent'))->findElements(WebDriverBy::tagName('tr'));
     $result = [];
     foreach ($vlanTableRows as $vlanTableRow) {
         //Выбираем из строки ячейки
         $tds = [];
         foreach ($vlanTableRow->findElements(WebDriverBy::tagName('td')) as $td) {
             $tds[] = $td->getText();
         }
         //Разбираем данные
         foreach ($tds as $tdIndex => $td) {
             switch ($td) {
                 case 'Serial Number':
                     $result['serialNumber'] = $tds[$tdIndex + 1];
                     break;
                 case 'Firmware Version':
                     $result['firmwareVersion'] = $tds[$tdIndex + 1];
                     break;
                 case 'System Location':
                     $result['systemLocation'] = $tds[$tdIndex + 1];
                     break;
                 case 'System Name':
                     $result['systemName'] = $tds[$tdIndex + 1];
                     break;
             }
         }
     }
     return $result;
 }
 public function testPostFinishAddScreeningToCMTIndividual()
 {
     // Wait for redirect
     $this->waitUntil(WebDriverExpectedCondition::titleContains("View genomic variant"));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/0000000006$/', $this->driver->getCurrentURL()));
     // Move mouse to Screenings tab and click 'view all screenings' option.
     $tabElement = $this->driver->findElement(WebDriverBy::id("tab_individuals"));
     $this->driver->getMouse()->mouseMove($tabElement->getCoordinates());
     $allIndividualsLink = $this->driver->findElement(WebDriverBy::partialLinkText('View all individuals'));
     $allIndividualsLink->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/individuals$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::cssSelector("td.ordered"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/individuals\\/00000001$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::id("viewentryOptionsButton_Individuals"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Add screening to individual"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/screenings[\\s\\S]create&target=00000001$/', $this->driver->getCurrentURL()));
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="Screening/Template[]"]/option[text()="RNA (cDNA)"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="Screening/Template[]"]/option[text()="Protein"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="Screening/Technique[]"]/option[text()="array for Comparative Genomic Hybridisation"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="Screening/Technique[]"]/option[text()="array for resequencing"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="Screening/Technique[]"]/option[text()="array for SNP typing"]'));
     $option->click();
     //        $this->addSelection(WebDriverBy::name("genes[]"), "value=GJB1");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="genes[]"]/option[@value="GJB1"]'));
     $option->click();
     $this->check(WebDriverBy::name("variants_found"));
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="owned_by"]/option[text()="LOVD3 Admin (#00001)"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Create screening information entry']"));
     $element->click();
     $this->assertEquals("Successfully created the screening entry!", $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText());
 }
示例#6
0
 public function testWebDriverWaits()
 {
     $fakeWd = Stub::make('\\Codeception\\Module\\WebDriver', ['wait' => Stub::exactly(12, function () {
         return new \Codeception\Util\Maybe();
     })]);
     $this->module->webDriver = $fakeWd;
     $this->module->waitForElement(WebDriverBy::partialLinkText('yeah'));
     $this->module->waitForElement(['id' => 'user']);
     $this->module->waitForElement(['css' => '.user']);
     $this->module->waitForElement('//xpath');
     $this->module->waitForElementVisible(WebDriverBy::partialLinkText('yeah'));
     $this->module->waitForElementVisible(['id' => 'user']);
     $this->module->waitForElementVisible(['css' => '.user']);
     $this->module->waitForElementVisible('//xpath');
     $this->module->waitForElementNotVisible(WebDriverBy::partialLinkText('yeah'));
     $this->module->waitForElementNotVisible(['id' => 'user']);
     $this->module->waitForElementNotVisible(['css' => '.user']);
     $this->module->waitForElementNotVisible('//xpath');
 }
 /**
  * Client expects that an element is selected by the given partial link text.
  * Returns true when the element is selected and false otherwise.
  * Retry the process two times or until the attempts argument count
  * is reached when a stale element reference exception is thrown.
  * Recommended usage in web driver waits.
  *
  * @param string $partialLinkText Partial link text of expected element.
  * @param int    $attempts        (Optional) Attempts until the method will fail and return false.
  *
  * @return bool
  */
 public function expectsToBeSelectedByPartialLinkText($partialLinkText, $attempts = 2)
 {
     if ($this->isFailed()) {
         return false;
     }
     $by = WebDriverBy::partialLinkText($partialLinkText);
     return $this->expectsToBeSelected($by, $attempts);
 }
 /**
  * Returns an element by the given partial link text.
  * If nothing is found, an empty array will be returned.
  *
  * @param string $partialLinkText Partial link text of expected element.
  * @param int    $attempts        Attempts until the method will fail and return false.
  *
  * @return WebDriverElement[]|array
  */
 public function getArrayByPartialLinkText($partialLinkText, $attempts = 2)
 {
     if ($this->isFailed()) {
         return [];
     }
     $by = WebDriverBy::partialLinkText($partialLinkText);
     return $this->getArrayBy($by, $attempts);
 }
 protected function find_link($text)
 {
     return self::$driver->findElement(WebDriverBy::partialLinkText($text));
 }
示例#10
0
 function openFRMenuForCol($nCol)
 {
     // Open the find & replace menu for the specified column index
     // (numbered 1..n from left to right)
     $gearOptionsLink = $this->driver->findElement(WebDriverBy::id('viewlistOptionsButton_VOG'));
     $gearOptionsLink->click();
     $FRMenuItem = $this->driver->findElement(WebDriverBy::partialLinkText('Find and replace text in column'));
     $FRMenuItem->click();
     // Include explicit wait for overlay divs. Going directly to clicking sometimes
     // results in a StaleElementReferenceException.
     $this->waitUntil(function ($driver) use($nCol) {
         $aOverlays = $driver->findElements(WebDriverBy::xpath('//div[@class="vl_overlay"]'));
         return count($aOverlays) >= $nCol;
     });
     $columnOverlay = $this->driver->findElement(WebDriverBy::xpath('//div[@class="vl_overlay"][' . $nCol . ']'));
     $columnOverlay->click();
     // Wait a second to handle click event properly and let tooltip disappear.
     sleep(1);
 }
 /**
  * Expects to select an elements option by visible text and the elements partial link text.
  * Retry the process two times or until the attempts argument count
  * is reached when a exception is thrown.
  * Returns false when the web driver was unable to select the expected element.
  *
  * @param string $partialLinkText Partial link text of expected element.
  * @param int    $visibleText     VisibleText of option to be selected.
  * @param int    $attempts        Amount of retries until the operation will fail.
  *
  * @return bool True if the elements visible text is selected, false otherwise.
  */
 public function expectSelectVisibleTextByPartialLinkText($partialLinkText, $visibleText, $attempts = 2)
 {
     if ($this->isFailed()) {
         return false;
     }
     $by = WebDriverBy::partialLinkText($partialLinkText);
     return $this->expectSelectVisibleTextByElement($by, $visibleText, $attempts);
 }
 /**
  * Wait until an element is enabled by the given partial link text or the value of the timeout argument is achieved.
  *
  * @param int $partialLinkText Partial link text of expected element.
  * @param int $timeOut         Timeout to wait, when the amount (in seconds) is reached, the test case fails.
  * @param int $interval        Interval of repeating the waiting condition.
  *
  * @return $this Same instance for chained method calls.
  */
 public function waitUntilPartialLinkTextIsEnabled($partialLinkText, $timeOut = 30, $interval = 250)
 {
     if ($this->isFailed()) {
         return $this;
     }
     $by = WebDriverBy::partialLinkText($partialLinkText);
     return $this->waitUntilElementIsEnabled($by, $timeOut, $interval);
 }
 public function testPostFinishAddVariantLocatedWithinGeneToCMTIndividual()
 {
     // Wait for redirect
     $this->waitUntil(WebDriverExpectedCondition::titleContains("View genomic variant"));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/0000000005$/', $this->driver->getCurrentURL()));
     // Move mouse to Screenings tab and click 'view all screenings' option.
     $tabElement = $this->driver->findElement(WebDriverBy::id("tab_screenings"));
     $this->driver->getMouse()->mouseMove($tabElement->getCoordinates());
     $allScreeningsLink = $this->driver->findElement(WebDriverBy::partialLinkText('View all screenings'));
     $allScreeningsLink->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/screenings$/', $this->driver->getCurrentURL()));
     //        $element = $this->driver->findElement(WebDriverBy::cssSelector("#0000000002 > td.ordered"));
     $element = $this->driver->findElement(WebDriverBy::xpath("//td[text()='0000000002']"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/screenings\\/0000000002$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::id("viewentryOptionsButton_Screenings"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Add variant to screening"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create&target=0000000002$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath('//b[contains(., "A variant that is located within a gene")]'));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::cssSelector("td.ordered"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create&reference=Transcript&geneid=GJB1&target=0000000002$/', $this->driver->getCurrentURL()));
     $this->uncheck(WebDriverBy::name("ignore_00000001"));
     $this->enterValue(WebDriverBy::name("00000001_VariantOnTranscript/Exon"), "2");
     $this->enterValue(WebDriverBy::name("00000001_VariantOnTranscript/DNA"), "c.251T>A");
     $element = $this->driver->findElement(WebDriverBy::cssSelector("button.mapVariant"));
     $element->click();
     // Wait until RNA description field is filled after AJAX request.
     $firstRNAInputSelector = '(//input[contains(@name, "VariantOnTranscript/RNA")])[1]';
     $this->waitUntil(function ($driver) use($firstRNAInputSelector) {
         $firstRNAInput = $driver->findElement(WebDriverBy::xpath($firstRNAInputSelector));
         $firstRNAValue = $firstRNAInput->getAttribute('value');
         return !empty($firstRNAValue);
     });
     // Check RNA description for first transcript.
     $firstRNAInput = $this->driver->findElement(WebDriverBy::xpath($firstRNAInputSelector));
     $firstRNAValue = $firstRNAInput->getAttribute('value');
     $this->assertTrue((bool) preg_match('/^r\\.\\([\\s\\S]\\)$/', $firstRNAValue));
     // Check protein description for first transcript.
     $firstProteinInputSelector = '(//input[contains(@name, "VariantOnTranscript/Protein")])[1]';
     $firstProteinInput = $this->driver->findElement(WebDriverBy::xpath($firstProteinInputSelector));
     $firstProteinValue = $firstProteinInput->getAttribute('value');
     $this->assertEquals("p.(Val84Asp)", $firstProteinValue);
     $GenomicDNAChange = $this->driver->findElement(WebDriverBy::name('VariantOnGenome/DNA'));
     $this->assertEquals("g.70443808T>A", $GenomicDNAChange->getAttribute('value'));
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="00000001_effect_reported"]/option[text()="Effect unknown"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="00000001_effect_concluded"]/option[text()="Effect unknown"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="allele"]/option[text()="Paternal (confirmed)"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("PubMed"));
     $element->click();
     // Move mouse to let browser hide tooltip of pubmed link (needed for chrome)
     $this->driver->getMouse()->mouseMove(null, 200, 200);
     $this->enterValue(WebDriverBy::name("VariantOnGenome/Reference"), "{PMID:Fokkema et al (2011):21520333}");
     $this->enterValue(WebDriverBy::name("VariantOnGenome/Frequency"), "0.09");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="effect_reported"]/option[text()="Effect unknown"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="effect_concluded"]/option[text()="Effect unknown"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="owned_by"]/option[text()="LOVD3 Admin (#00001)"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="statusid"]/option[text()="Public"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Create variant entry']"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^Successfully processed your submission and sent an email notification to the relevant curator[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText()));
 }
 /**
  * Verify an element with a regular expression by partial link text.
  * Retry the process two times or until the attempts argument count
  * is reached when an exception is thrown.
  *
  * @param string $partialLinkText Partial link text of expected element.
  * @param string $regex           Regular expression to compare with.
  * @param string $type            Verification type (elements text, attributes ...).
  * @param int    $attempts        Attempts until the method will fail and return false.
  *
  * @see VerificationTrait::_validateTypeArgument
  * @return bool
  */
 public function verifyRegexByPartialLinkText($partialLinkText, $regex, $type, $attempts = 2)
 {
     if ($this->isFailed()) {
         return false;
     }
     $by = WebDriverBy::partialLinkText($partialLinkText);
     return $this->_verifyBy($by, $regex, $type, $attempts, true);
 }
示例#15
0
 public function dontSeeLink($text, $url = null)
 {
     $nodes = $this->webDriver->findElements(WebDriverBy::partialLinkText($text));
     if (!$url) {
         if (!empty($nodes)) {
             $this->fail("Link containing text '{$text}' was found in page " . $this->_getCurrentUri());
         }
         return;
     }
     $nodes = array_filter($nodes, function (WebDriverElement $e) use($url) {
         return trim($e->getAttribute('href')) == trim($url);
     });
     if (!empty($nodes)) {
         $this->fail("Link containing text '{$text}' and URL '{$url}' was found in page " . $this->_getCurrentUri());
     }
 }
示例#16
0
 public function testWebDriverWaits()
 {
     $fakeWd = Stub::make(self::WEBDRIVER_CLASS, ['wait' => Stub::exactly(12, function () {
         return new \Codeception\Util\Maybe();
     })]);
     $module = Stub::make(self::MODULE_CLASS, ['webDriver' => $fakeWd]);
     $module->waitForElement(WebDriverBy::partialLinkText('yeah'));
     $module->waitForElement(['id' => 'user']);
     $module->waitForElement(['css' => '.user']);
     $module->waitForElement('//xpath');
     $module->waitForElementVisible(WebDriverBy::partialLinkText('yeah'));
     $module->waitForElementVisible(['id' => 'user']);
     $module->waitForElementVisible(['css' => '.user']);
     $module->waitForElementVisible('//xpath');
     $module->waitForElementNotVisible(WebDriverBy::partialLinkText('yeah'));
     $module->waitForElementNotVisible(['id' => 'user']);
     $module->waitForElementNotVisible(['css' => '.user']);
     $module->waitForElementNotVisible('//xpath');
 }
示例#17
0
 public function dontSeeLink($text, $url = null)
 {
     $nodes = $this->webDriver->findElements(WebDriverBy::partialLinkText($text));
     if (!$url) {
         $this->assertNodesNotContain($text, $nodes, 'a');
         return;
     }
     $nodes = array_filter($nodes, function (WebDriverElement $e) use($url) {
         return trim($e->getAttribute('href')) == trim($url);
     });
     $this->assertNodesNotContain($text, $nodes, "a[href={$url}]");
 }
 /**
  * Types values on an element by the given partial link text.
  *
  * @param string $partialLinkText Partial link text of expected element.
  * @param string $value           Value that should be typed on the element.
  * @param bool   $clear           Clear the element before typing when true.
  * @param int    $attempts        Amount of retries until the operation will fail.
  *
  * @return bool
  */
 public function expectTypePartialLinkText($partialLinkText, $value, $clear = true, $attempts = 2)
 {
     if ($this->isFailed()) {
         return false;
     }
     $by = WebDriverBy::partialLinkText($partialLinkText);
     return $this->expectType($by, $value, $clear, $attempts);
 }