コード例 #1
0
 /**
  * @param $selector
  * @param $content
  */
 private function fillRteEditor($selector, $content)
 {
     $this->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver) use($selector, $content) {
         $webDriver->switchTo()->frame($webDriver->findElement($selector));
         $webDriver->executeScript('arguments[0].innerHTML = "' . addslashes($content) . '"', [$webDriver->findElement(\Facebook\WebDriver\WebDriverBy::tagName('body'))]);
         $webDriver->switchTo()->defaultContent();
     });
 }
コード例 #2
0
ファイル: IntegrationTests.php プロジェクト: kbcmdba/pjs2
 function doSelectOption($location, $displayedValue)
 {
     $select = $this->webDriver->findElement($location);
     $options = $select->findElements(WebDriverBy::tagName('option'));
     $wasFound = 0;
     foreach ($options as $option) {
         if ($displayedValue === $option->getText()) {
             $option->click();
             $wasFound = 1;
         }
     }
     $this->assertEquals(1, $wasFound);
 }
コード例 #3
0
 public function testAddVCFFileToCMTIndividual()
 {
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000002$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr[2]/td[2]"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Are you sure you are done with submitting the variants found with this screening[\\s\\S][\\s\\S]*$/', $this->getConfirmation()));
     $this->chooseOkOnNextConfirmation();
     $element = $this->driver->findElement(WebDriverBy::xpath("//tr[3]/td[2]/b"));
     $element->click();
     //        $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\\/variants[\\s\\S]create&target=0000000002$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//tr[3]/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create&target=0000000002$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create&type=VCF&target=0000000002$/', $this->driver->getCurrentURL()));
     $this->enterValue(WebDriverBy::name("variant_file"), ROOT_PATH . "../tests/test_data_files/ShortVCFfilev1.vcf");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="hg_build"]/option[text()="hg19"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="dbSNP_column"]/option[text()="VariantOnGenome/Reference"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="genotype_field"]/option[text()="Use Phred-scaled genotype likelihoods (PL)"]'));
     $option->click();
     $this->check(WebDriverBy::name("allow_mapping"));
     $this->check(WebDriverBy::name("allow_create_genes"));
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="owned_by"]/option[text()="LOVD3 Admin"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="statusid"]/option[text()="Public"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Upload VCF file']"));
     $element->click();
     $this->assertEquals("25 variants were imported, 1 variant could not be imported.", $this->driver->findElement(WebDriverBy::id("lovd__progress_message"))->getText());
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000002$/', $this->driver->getCurrentURL()));
     for ($second = 0;; $second++) {
         if ($second >= 600) {
             $this->fail("timeout");
         }
         $this->driver->get(ROOT_URL . "/src/ajax/map_variants.php");
         if (strcmp("0 99 There are no variants to map in the database", $this->driver->findElement(WebDriverBy::tagName("body"))->getText())) {
             break;
         }
         $this->assertNotContains("of 25 variants", $this->driver->findElement(WebDriverBy::tagName("body"))->getText());
         sleep(1);
     }
 }
コード例 #4
0
 public function testAddSummaryVariantVCFFile()
 {
     // Mouse hover over Submit tab, to make 'submit new data' link visible.
     $tabElement = $this->driver->findElement(WebDriverBy::xpath("//img[@id='tab_submit']"));
     $this->driver->getMouse()->mouseMove($tabElement->getCoordinates());
     $element = $this->driver->findElement(WebDriverBy::linkText("Submit new data"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr[2]/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Please reconsider to submit individual data as well, as it makes the data you submit much more valuable![\\s\\S]*$/', $this->getConfirmation()));
     $this->chooseOkOnNextConfirmation();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//tr[3]/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
     $element->click();
     $this->driver->get(ROOT_URL . "/src/variants/upload?create&type=VCF");
     $this->enterValue(WebDriverBy::name("variant_file"), ROOT_PATH . "../tests/test_data_files/ShortVCFfilev1.vcf");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="hg_build"]/option[text()="hg19"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="dbSNP_column"]/option[text()="VariantOnGenome/Reference"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="genotype_field"]/option[text()="Use Phred-scaled genotype likelihoods (PL)"]'));
     $option->click();
     $this->check(WebDriverBy::name("allow_mapping"));
     $this->check(WebDriverBy::name("allow_create_genes"));
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="owned_by"]/option[text()="LOVD3 Admin"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="statusid"]/option[text()="Public"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Upload VCF file']"));
     $element->click();
     $this->assertEquals("25 variants were imported, 1 variant could not be imported.", $this->driver->findElement(WebDriverBy::id("lovd__progress_message"))->getText());
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
     $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()));
     for ($second = 0;; $second++) {
         if ($second >= 600) {
             $this->fail("timeout");
         }
         $this->driver->get(ROOT_URL . "/src/ajax/map_variants.php");
         if (strcmp("0 99 There are no variants to map in the database", $this->driver->findElement(WebDriverBy::tagName("body"))->getText())) {
             break;
         }
         $this->assertNotContains("of 25 variants", $this->driver->findElement(WebDriverBy::tagName("body"))->getText());
         sleep(1);
     }
 }
コード例 #5
0
 private function captcha()
 {
     $path = \Yii::getAlias('@runtime/tmp') . '/' . time() . '_' . rand() . '.png';
     $this->driver->takeScreenshot($path);
     $coordinates = $this->driver->findElement(WebDriverBy::tagName('img'))->getCoordinates()->onPage();
     if (Image::crop($path, $coordinates->getX(), $coordinates->getY(), 130, 50)) {
         if (\Yii::$app->get('captcha')->run($path)) {
             $this->driver->findElement(WebDriverBy::xpath('//input[@name=\'captcha_key\']'))->click();
             $this->driver->findElement(WebDriverBy::xpath('//input[@name=\'captcha_key\']'))->sendKeys(\Yii::$app->get('captcha')->result());
         }
     } else {
         throw new Exception('Проблема при обрезании картинки');
     }
 }
コード例 #6
0
 public function testAddVCFFileToIVAIndividual()
 {
     // wait for page redirect
     $this->waitUntil(WebDriverExpectedCondition::titleContains("Submission of"));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000003$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create&target=0000000003$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//tr[3]/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create&target=0000000003$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants\\/upload[\\s\\S]create&type=VCF&target=0000000003$/', $this->driver->getCurrentURL()));
     $this->enterValue(WebDriverBy::name("variant_file"), ROOT_PATH . "../tests/test_data_files/ShortVCFfilev1.vcf");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="hg_build"]/option[text()="hg19"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="dbSNP_column"]/option[text()="VariantOnGenome/Reference"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="genotype_field"]/option[text()="Use Phred-scaled genotype likelihoods (PL)"]'));
     $option->click();
     $this->check(WebDriverBy::name("allow_mapping"));
     $this->check(WebDriverBy::name("allow_create_genes"));
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="owned_by"]/option[text()="LOVD3 Admin"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="statusid"]/option[text()="Public"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Upload VCF file']"));
     $element->click();
     $this->assertEquals("25 variants were imported, 1 variant could not be imported.", $this->driver->findElement(WebDriverBy::id("lovd__progress_message"))->getText());
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
     $element->click();
     for ($second = 0;; $second++) {
         if ($second >= 600) {
             $this->fail("timeout");
         }
         $this->driver->get(ROOT_URL . "/src/ajax/map_variants.php");
         if (strcmp("0 99 There are no variants to map in the database", $this->driver->findElement(WebDriverBy::tagName("body"))->getText())) {
             break;
         }
         $this->assertNotContains("of 25 variants", $this->driver->findElement(WebDriverBy::tagName("body"))->getText());
         sleep(1);
     }
     // Test whether a variant was parsed correctly via mutalyzer.
     $this->driver->get(ROOT_URL . '/src/genes/ARSD');
     $element = $this->driver->findElement(WebDriverBy::xpath('//tr[@class="data"]/td[text()="X"]'));
     $element->click();
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath('//td[text()="p.(Gln318His)"]')));
 }
コード例 #7
0
 public function test_permission_roles()
 {
     $this->login();
     $this->admin_login();
     $this->add_lang('acp/permissions');
     $this->visit('adm/index.php?i=acp_permissions&mode=setting_forum_local&sid=' . $this->sid);
     // Select forums
     $elements = self::find_element('cssSelector', 'select#forum')->findElements(\Facebook\WebDriver\WebDriverBy::tagName('option'));
     foreach ($elements as $element) {
         $element->click();
     }
     self::find_element('cssSelector', 'form#select_victim')->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=submit]'))->click();
     // Select administrators and guests
     $groups_form = self::find_element('cssSelector', 'form#groups');
     $elements = $groups_form->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('select'))->findElements(\Facebook\WebDriver\WebDriverBy::tagName('option'));
     foreach ($elements as $element) {
         if ($element->getText() === 'Administrators' || $element->getText() === 'Guests') {
             $element->click();
         }
     }
     $groups_form->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[name=submit_edit_options]'))->click();
     $first_fieldset = self::find_element('cssSelector', '#perm11');
     $this->assertEquals('none', $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
     $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->click();
     $this->assertEquals('block', $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
     $lis = $first_fieldset->findElements(\Facebook\WebDriver\WebDriverBy::cssSelector('ul > li'));
     foreach ($lis as $li) {
         if ($li->getAttribute('data-id') == 18) {
             $li->click();
             break;
         }
     }
     $this->assertEquals('none', $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
     $this->assertEquals(18, $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value'));
     $this->assertEquals($this->lang('ROLE_FORUM_LIMITED'), $first_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText());
     // Check that admin settings didn't get changed
     $second_fieldset = self::find_element('cssSelector', '#perm10');
     $this->assertEquals('none', $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
     // Full access = 14
     $this->assertEquals(14, $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value'));
     $this->assertEquals($this->lang('ROLE_FORUM_FULL'), $second_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText());
     // Check that category settings were not modified
     $category_fieldset = self::find_element('cssSelector', '#perm00');
     $this->assertEquals('none', $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('div.dropdown'))->getCSSValue('display'));
     // No settings
     $this->assertEquals('', $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('input[type=hidden]'))->getAttribute('value'));
     $this->assertEquals($this->lang('NO_ROLE_ASSIGNED'), $category_fieldset->findElement(\Facebook\WebDriver\WebDriverBy::cssSelector('span.dropdown-toggle'))->getText());
 }
コード例 #8
0
 /**
  * Set user agent
  */
 public function testSetUserAgent()
 {
     $useragent = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16';
     // setup
     $capabilities = DesiredCapabilities::firefox();
     /** @var FirefoxProfile $profile */
     $profile = $capabilities->getCapability(FirefoxDriver::PROFILE);
     $profile->setPreference('general.useragent.override', $useragent);
     $this->webDriver = RemoteWebDriver::create('http://' . self::HOST . '/wd/hub', $capabilities);
     // test
     $this->webDriver->get('http://demo.mobiledetect.net/');
     $elements = $this->webDriver->findElements(WebDriverBy::tagName('h1'));
     static::assertEquals(3, count($elements));
     $elementContainingQuestion = $elements[1];
     static::assertEquals('Is your device really a phone?', $elementContainingQuestion->getText());
     $this->webDriver->quit();
 }
コード例 #9
0
ファイル: EditGroupTest.php プロジェクト: amyboyd/overwatch
 public function testChangeGroupMembership()
 {
     $this->getUsers()[0]->findElement(WebDriverBy::tagName("a"))->click();
     $this->waitForAlert();
     $this->webDriver->switchTo()->alert()->dismiss();
     $this->assertCount(2, $this->getUsers());
     $this->getUsers()[0]->findElement(WebDriverBy::tagName("a"))->click();
     $this->waitForAlert();
     $this->webDriver->switchTo()->alert()->accept();
     $this->waitForLoadingAnimation();
     $this->assertCount(1, $this->getUsers());
     $this->webDriver->findElement(WebDriverBy::cssSelector("ul.users li:last-child a:nth-child(2)"))->click();
     $this->waitForAlert();
     $this->webDriver->switchTo()->alert()->dismiss();
     $this->assertCount(1, $this->getUsers());
     $this->webDriver->findElement(WebDriverBy::cssSelector("ul.users li:last-child a:nth-child(2)"))->click();
     $this->waitForAlert();
     $this->webDriver->switchTo()->alert()->sendKeys(UserFixtures::$users['user-1']->getEmail());
     $this->webDriver->switchTo()->alert()->accept();
     $this->waitForLoadingAnimation();
     $this->assertCount(2, $this->getUsers());
 }
コード例 #10
0
ファイル: SongListTest.php プロジェクト: phanan/koel
 public function testSorting()
 {
     $this->loginAndWait()->repopulateList();
     // Confirm that we can't sort in Queue screen
     /** @var WebDriverElement $th */
     foreach ($this->els('#queueWrapper div.song-list-wrap th') as $th) {
         if (!$th->isDisplayed()) {
             continue;
         }
         foreach ($th->findElements(WebDriverBy::tagName('i')) as $sortDirectionIcon) {
             static::assertFalse($sortDirectionIcon->isDisplayed());
         }
     }
     // Now go to All Songs screen and sort there
     $this->goto('songs')->click('#songsWrapper div.song-list-wrap th:nth-child(2)');
     $last = null;
     $results = [];
     /** @var WebDriverElement $td */
     foreach ($this->els('#songsWrapper div.song-list-wrap td.title') as $td) {
         $current = $td->getText();
         $results[] = $last === null ? true : $current <= $last;
         $last = $current;
     }
     static::assertNotContains(false, $results);
     // Second click will reverse the sort
     $this->click('#songsWrapper div.song-list-wrap th:nth-child(2)');
     $last = null;
     $results = [];
     /** @var WebDriverElement $td */
     foreach ($this->els('#songsWrapper div.song-list-wrap td.title') as $td) {
         $current = $td->getText();
         $results[] = $last === null ? true : $current >= $last;
         $last = $current;
     }
     static::assertNotContains(false, $results);
 }
コード例 #11
0
 public function getDeviceInfo()
 {
     //Заходим на страницу железки
     $this->driver->get("http://{$this->user}:{$this->password}@{$this->host}");
     //Собираем строки из таблицы
     $infoRows = $this->driver->findElement(WebDriverBy::id('Status'))->findElements(WebDriverBy::tagName('tr'));
     $result = [];
     foreach ($infoRows as $infoRow) {
         //Выбираем из строки ячейки
         $tds = [];
         foreach ($infoRow->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;
             }
         }
     }
     return $result;
 }
コード例 #12
0
ファイル: false_update_import.php プロジェクト: LOVDnl/LOVD3
 public function testFalseUpdatetImport()
 {
     $this->driver->get(ROOT_URL . "/src/import");
     $this->enterValue(WebDriverBy::name("import"), ROOT_PATH . "../tests/test_data_files/FalseUpdateImport.txt");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="mode"]/option[text()="Update existing data (in beta)"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::name("simulate"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Import file']"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Show 33 warnings"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 8\\): Will not update column Individual\\/Age_of_death, too many fields are different from the database \\(col_order, width, standard, head_column, description_form, description_legend_short, description_legend_full, mysql_type, form_type, select_options, preg_pattern\\)\\. There is a maximum of 1 difference to prevent accidental updates\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 8\\): Can[\\s\\S]t update hgvs for column entry Individual\\/Age_of_death: Not allowed to change the HGVS standard status of any column\\. Value is currently "0" and value in the import file is "1"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 8\\): Incorrect value for field [\\s\\S]col_order[\\s\\S], which needs to be numeric, between 0 and 255\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 8\\): Incorrect value for field [\\s\\S]standard[\\s\\S], which should be 0 or 1\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 8\\): Select option #3 "yes\\(\\)[\\s\\S]* = Consanguineous parents" not understood\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 8\\): The [\\s\\S]Regular expression pattern[\\s\\S] field does not seem to contain valid PHP Perl compatible regexp syntax\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 9\\): ID "Individual\\/Age_of_death" already defined at line 8\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Genes, line 14\\): Can[\\s\\S]t update chromosome for gene entry IVD: Not allowed to change the chromosome\\. Value is currently "15" and value in the import file is "151"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Genes, line 14\\): Can[\\s\\S]t update name for gene entry IVD: Not allowed to change the gene name\\. Value is currently "isovaleryl-CoA dehydrogenase" and value in the import file is "isovaleryl-CoA dehydrogenase1"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Genes, line 15\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Transcripts, line 20\\): Can[\\s\\S]t update id_ncbi for transcript entry 00001: Not allowed to change the NCBI ID\\. Value is currently "NM_002225\\.3" and value in the import file is "NM_999999\\.3"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Transcripts, line 20\\): Transcript "00001" does not match the same gene and\\/or the same NCBI ID as in the database\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Transcripts, line 21\\): ID "00001" already defined at line 20\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 27\\): Will not update disease 00000, too many fields are different from the database \\(symbol, name, id_omim\\)\\. There is a maximum of 1 difference to prevent accidental updates\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 27\\): Another disease already exists with this OMIM ID[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 27\\): Another disease already exists with the same name![\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 28\\): Will not update disease 00002, too many fields are different from the database \\(symbol, name, id_omim\\)\\. There is a maximum of 1 difference to prevent accidental updates\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 28\\): Another disease already exists with the same name![\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Genes_To_Diseases, line 34\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 39\\): Individual "00000022" does not exist in the database and is not defined \\(properly\\) in this import file\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 40\\): Will not update individual 00000002, too many fields are different from the database \\(panelid, panel_size\\)\\. There is a maximum of 1 difference to prevent accidental updates\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 40\\): The [\\s\\S]Panel ID[\\s\\S] can not link to itself; this field is used to indicate to which panel this individual belongs\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 40\\): Panel size of Individual "00000002" must be lower than the panel size of Individual "00000002"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 41\\): Will not update individual 00000003, too many fields are different from the database \\(fatherid, motherid, panelid\\)\\. There is a maximum of 1 difference to prevent accidental updates\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 41\\): Panel ID "00000001" refers to an individual, not a panel \\(group of individuals\\)\\. If you want to configure that individual as a panel, set its [\\s\\S]Panel size[\\s\\S] field to a value higher than 1\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 41\\): The [\\s\\S]fatherid[\\s\\S] can not link to itself; this field is used to indicate which individual in the database is the parent of the given individual\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 41\\): The fatherid "00000003" you entered does not refer to a male individual\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 41\\): Individual "00000022" does not exist in the database and is not defined \\(properly\\) in this import file\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 42\\): The motherid "00000002" refers to an panel \\(group of individuals\\), not an individual\\. If you want to configure that panel as an individual, set its [\\s\\S]Panel size[\\s\\S] field to value 1\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 43\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals_To_Diseases, line 49\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Phenotypes, line 54\\): Can[\\s\\S]t update diseaseid for phenotype entry 0000000001: Not allowed to change the disease\\. Value is currently "00001" and value in the import file is "00004"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Phenotypes, line 54\\): Can[\\s\\S]t update individualid for phenotype entry 0000000001: Not allowed to change the individual\\. Value is currently "00000001" and value in the import file is "00000022"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Phenotypes, line 54\\): Disease "00004" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Phenotypes, line 54\\): Individual "00000022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Phenotypes, line 55\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings, line 60\\): Can[\\s\\S]t update individualid for screening entry 0000000001: Not allowed to change the individual\\. Value is currently "00000001" and value in the import file is "00000022"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings, line 60\\): Individual "00000022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings, line 61\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Genes, line 67\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Genome, line 72\\): Can[\\s\\S]t update position_g_start for variant entry 0000000001: Not allowed to change the genomic start position\\. Value is currently "40702876" and value in the import file is "abc"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Genome, line 72\\): The field \'position_g_start\' must contain a positive integer, "abc" does not match\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Genome, line 73\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 78\\): Can[\\s\\S]t update position_c_start for variant entry 0000000001: Not allowed to change the start position\\. Value is currently "345" and value in the import file is "abc"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 78\\): The field \'position_c_start\' must contain an integer, "abc" does not match\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 80\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Variants, line 86\\): This line refers to a non-existing entry\\. When the import mode is set to update, no new inserts can be done\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Columns, line 8\\): Created date field is set by LOVD Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-02 15:42:07"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Columns, line 8\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00000"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Columns, line 8\\): Edited date field is set by LOVD Value is currently empty and the value in the import file is "2015-06-02 15:42:07"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Columns, line 9\\): Created date field is set by LOVD Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-12 15:33:25"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Genes, line 14\\): Created date field is set by LOVD Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-02 15:42:21"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Genes, line 14\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Genes, line 14\\): Updated date field is set by LOVD\\. Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-02 15:42:48"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Transcripts, line 20\\): Created date field is set by LOVD Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-02 15:42:21"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Transcripts, line 20\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Transcripts, line 20\\): Edited date field is set by LOVD Value is currently empty and the value in the import file is "2015-06-02 15:42:21"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Transcripts, line 21\\): Created date field is set by LOVD Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-12 15:33:40"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Diseases, line 26\\): Created date field is set by LOVD Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-02 15:42:23"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Diseases, line 26\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Diseases, line 26\\): Edited date field is set by LOVD Value is currently empty and the value in the import file is "2015-06-02 15:42:23"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Diseases, line 27\\): Created by field is set by LOVD Value is currently "00000" and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Diseases, line 27\\): Created date field is set by LOVD Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-02 15:42:23"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Diseases, line 28\\): Created date field is set by LOVD Value is currently "[\\s\\S]*" and the value in the import file is "2015-06-03 10:29:37"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Diseases, line 28\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Diseases, line 28\\): Edited date field is set by LOVD Value is currently empty and the value in the import file is "2015-06-02 15:42:23"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning: It is currently not possible to do an update on section Genes_To_Diseases via an import[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Individuals, line 39\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Individuals, line 39\\): Edited date field is set by LOVD Value is currently empty and the value in the import file is "2015-06-03 11:30:26"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning: It is currently not possible to do an update on section Individuals_To_Diseases via an import[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Phenotypes, line 54\\): Created date field is set by LOVD Value is currently "2015-06-03 11:30:56" and the value in the import file is "2015-06-02 15:42:32"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Phenotypes, line 54\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Phenotypes, line 54\\): Edited date field is set by LOVD Value is currently empty and the value in the import file is "2015-06-02 15:42:32"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Screenings, line 60\\): Created date field is set by LOVD Value is currently "2015-06-03 11:31:03" and the value in the import file is "2015-06-02 15:42:37"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Screenings, line 60\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Screenings, line 60\\): Edited date field is set by LOVD Value is currently empty and the value in the import file is "2015-06-02 15:42:37"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning: It is currently not possible to do an update on section Screenings_To_Genes via an import[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Variants_On_Genome, line 72\\): Created date field is set by LOVD Value is currently "2015-06-03 11:31:16" and the value in the import file is "2015-06-02 15:42:48"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning \\(Variants_On_Genome, line 72\\): Edited by field is set by LOVD Value is currently empty and the value in the import file is "00001"\\.[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Warning: It is currently not possible to do an update on section Screenings_To_Variants via an import[\\s\\S]*$/', $this->driver->findElement(WebDriverBy::tagName("body"))->getText()));
 }
コード例 #13
0
ファイル: WebDriverSelect.php プロジェクト: corcre/elabftw
 /**
  * @return WebDriverElement[] All options belonging to this select tag.
  */
 public function getOptions()
 {
     return $this->element->findElements(WebDriverBy::tagName('option'));
 }
コード例 #14
0
 /**
  * Returns an element by the given tag name.
  * If nothing is found, an empty array will be returned.
  *
  * @param string $tagName  Tag name of expected element.
  * @param int    $attempts Attempts until the method will fail and return false.
  *
  * @return WebDriverElement[]|array
  */
 public function getArrayByTagName($tagName, $attempts = 2)
 {
     if ($this->isFailed()) {
         return [];
     }
     $by = WebDriverBy::tagName($tagName);
     return $this->getArrayBy($by, $attempts);
 }
コード例 #15
0
 /**
  * Client expects that an element is selected by the given tag name.
  * 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 $tagName  Tag name of expected element.
  * @param int    $attempts (Optional) Attempts until the method will fail and return false.
  *
  * @return bool
  */
 public function expectsToBeSelectedByTagName($tagName, $attempts = 2)
 {
     if ($this->isFailed()) {
         return false;
     }
     $by = WebDriverBy::tagName($tagName);
     return $this->expectsToBeSelected($by, $attempts);
 }
コード例 #16
0
 /**
  * Получить спискок VLAN-ов
  */
 public function getVlans()
 {
     //Заходим на страницу с таблицей вланов
     $this->driver->get("http://{$this->host}/H_21_1QVLAN_Asy_table.htm");
     //Выбираем строки в таблице
     $vlanTableRows = $this->driver->findElement(WebDriverBy::id('mainGray'))->findElements(WebDriverBy::tagName('tr'));
     //Первая строка - шапка - она нас не интересует
     array_shift($vlanTableRows);
     $results = [];
     foreach ($vlanTableRows as $vlanTableRow) {
         $tds = $vlanTableRow->findElements(WebDriverBy::tagName('td'));
         $vlanId = $tds[0]->getText();
         //Имя влана лежит в инпуте
         $vlanName = $tds[1]->findElement(WebDriverBy::id('VlanName'))->getAttribute('value');
         $vlanUntagedPorts = $tds[2]->getText();
         $vlanTaggedPorts = $tds[3]->getText();
         //Очищаем строки от знаков переноса
         $vlanUntagedPorts = str_replace("\n", "", $vlanUntagedPorts);
         $vlanTaggedPorts = str_replace("\n", "", $vlanTaggedPorts);
         //Разибваем строку с портами в массив
         $vlanUntagedPorts = explode(",", $vlanUntagedPorts);
         $vlanTaggedPorts = explode(",", $vlanTaggedPorts);
         $results[$vlanId] = ['name' => $vlanName, 'ports' => ['untagged' => $vlanUntagedPorts, 'tagged' => $vlanTaggedPorts]];
     }
     return $results;
 }
コード例 #17
0
 function testGoBackByClickingReset()
 {
     $user = new User();
     $user->setEmail("*****@*****.**");
     $user->setUsername("test");
     $user->setPassword("ouhosu");
     $this->em->persist($user);
     $tree = new Tree();
     $tree->setTitleAdmin('Tree');
     $tree->setPublicId('tree');
     $tree->setOwner($user);
     $this->em->persist($tree);
     $treeVersion = new TreeVersion();
     $treeVersion->setTree($tree);
     $treeVersion->setPublicId('version');
     $this->em->persist($treeVersion);
     $startNode = new Node();
     $startNode->setTreeVersion($treeVersion);
     $startNode->setTitle("START HERE");
     $startNode->setPublicId('start');
     $this->em->persist($startNode);
     $endNode = new Node();
     $endNode->setTreeVersion($treeVersion);
     $endNode->setTitle("END HERE");
     $endNode->setPublicId('end');
     $this->em->persist($endNode);
     $nodeOption = new NodeOption();
     $nodeOption->setTitle("LETS GO HERE");
     $nodeOption->setTreeVersion($treeVersion);
     $nodeOption->setNode($startNode);
     $nodeOption->setDestinationNode($endNode);
     $nodeOption->setPublicId('option');
     $this->em->persist($nodeOption);
     $treeVersionPublished = new TreeVersionPublished();
     $treeVersionPublished->setTreeVersion($treeVersion);
     $treeVersionPublished->setPublishedBy($user);
     $this->em->flush();
     $tvsn = new TreeVersionStartingNode();
     $tvsn->setNode($startNode);
     $tvsn->setTreeVersion($treeVersion);
     $this->em->persist($tvsn);
     $published = new TreeVersionPublished();
     $published->setTreeVersion($treeVersion);
     $this->em->persist($published);
     $this->em->flush();
     // ######################################################## LOAD PAGE
     $this->driver->get('http://localhost/app_dev.php/tree/tree/demo');
     $startLink = $this->driver->findElement(WebDriverBy::id('StartTreeLink'));
     $this->assertEquals('Start Tree!', $startLink->getText());
     // ######################################################## Start Tree
     $startLink->click();
     sleep($this->sleepOnActionWithNetwork);
     $nodeTitle = $this->driver->findElement(WebDriverBy::id('DemoHere'))->findElement(WebDriverBy::className('node'))->findElement(WebDriverBy::className('title'));
     $this->assertEquals('START HERE', $nodeTitle->getText());
     // ######################################################## LOAD PAGE
     $this->driver->findElement(WebDriverBy::id('DemoHere'))->findElements(WebDriverBy::className('option'))[0]->click();
     $this->driver->findElement(WebDriverBy::id('DemoHere'))->findElement(WebDriverBy::cssSelector('input[type="submit"]'))->click();
     sleep($this->sleepOnActionNoNetwork);
     $nodeTitle = $this->driver->findElement(WebDriverBy::id('DemoHere'))->findElement(WebDriverBy::className('node'))->findElement(WebDriverBy::className('title'));
     $this->assertEquals('END HERE', $nodeTitle->getText());
     // ######################################################## GO BACK
     $this->driver->findElement(WebDriverBy::className('restart'))->findElement(WebDriverBy::tagName('a'))->click();
     sleep($this->sleepOnActionNoNetwork);
     $nodeTitle = $this->driver->findElement(WebDriverBy::id('DemoHere'))->findElement(WebDriverBy::className('node'))->findElement(WebDriverBy::className('title'));
     $this->assertEquals('START HERE', $nodeTitle->getText());
 }
コード例 #18
0
 /**
  * Expects to select an elements option by visible text and the elements tag name.
  * 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 $tagName     Tag name 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 expectSelectVisibleTextByTagName($tagName, $visibleText, $attempts = 2)
 {
     if ($this->isFailed()) {
         return false;
     }
     $by = WebDriverBy::tagName($tagName);
     return $this->expectSelectVisibleTextByElement($by, $visibleText, $attempts);
 }
コード例 #19
0
ファイル: setup.php プロジェクト: mattywebb/cyclery-northside
function setup_wordpress_site($driver)
{
    if ($driver->getCurrentURL() != wordpress('/wp-admin/install.php?step=1')) {
        $driver->get(wordpress('/wp-admin/install.php'));
    }
    $driver->findElement(WebDriverBy::name('weblog_title'))->sendKeys('Wordpress test');
    $driver->findElement(WebDriverBy::name('user_name'))->clear()->sendKeys('admin');
    if (wordpress_version() > 42) {
        $driver->findElement(WebDriverBy::id('pass1-text'))->clear()->sendKeys('a')->sendKeys('dmin');
    } else {
        $driver->findElement(WebDriverBy::name('admin_password'))->sendKeys('admin');
        $driver->findElement(WebDriverBy::name('admin_password2'))->sendKeys('admin');
    }
    $driver->findElement(WebDriverBy::name('admin_email'))->sendKeys('*****@*****.**');
    $driver->findElement(WebDriverBy::tagName('form'))->submit();
    $h1s = $driver->findElements(WebDriverBy::tagName('h1'));
    $texts = array_map(function ($h1) {
        return $h1->getText();
    }, $h1s);
    if (array_search('Success', $texts) >= 0) {
        print "Setting up WordPress is successful.\n";
    } else {
        var_dump($driver->getPageSource());
        throw new UnexpectedValueException('Setting up WordPress failed.');
    }
}
コード例 #20
0
ファイル: DashboardTest.php プロジェクト: amyboyd/overwatch
 private function getHoverTextForTest($test)
 {
     //If passed a fixture, construct expected value
     if ($test instanceof \Overwatch\TestBundle\Entity\Test) {
         return "Expect " . $test->getActual() . " " . $test->getExpectation() . " " . $test->getExpected();
     }
     //Else, find actual hover text
     return $test->findElement(WebDriverBy::tagName("span"))->getAttribute("title");
 }
コード例 #21
0
ファイル: test.php プロジェクト: rtens/selenium-phantomjs
<?php

use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\WebDriverCapabilityType;
use Facebook\WebDriver\WebDriverBy;
require_once 'vendor/autoload.php';
echo "Test started" . PHP_EOL;
$driver = RemoteWebDriver::create('http://127.0.0.1:4444/wd/hub', [WebDriverCapabilityType::BROWSER_NAME => 'phantomjs']);
$driver->get('http://127.0.0.1:8000/index.php');
echo $driver->findElement(WebDriverBy::tagName('h1'))->getText() . PHP_EOL;
コード例 #22
0
 /**
  * Wait until an element is enabled by the given tag name or the value of the timeout argument is achieved.
  *
  * @param int $tagName  Tag name 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 waitUntilTagNameIsEnabled($tagName, $timeOut = 30, $interval = 250)
 {
     if ($this->isFailed()) {
         return $this;
     }
     $by = WebDriverBy::tagName($tagName);
     return $this->waitUntilElementIsEnabled($by, $timeOut, $interval);
 }
コード例 #23
0
ファイル: false_insert_import.php プロジェクト: LOVDnl/LOVD3
 public function testFalseInsertImport()
 {
     $this->driver->get(ROOT_URL . "/src/import");
     $this->enterValue(WebDriverBy::name("import"), ROOT_PATH . "../tests/test_data_files/FalseInsertImport.txt");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="mode"]/option[text()="Add only, treat all data as new"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::name("simulate"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Import file']"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::linkText("Show 5 warnings"));
     $element->click();
     $bodyText = $this->driver->findElement(WebDriverBy::tagName("body"))->getText();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 9\\): Incorrect value for field [\\s\\S]col_order[\\s\\S], which needs to be numeric, between 0 and 255\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 9\\): Incorrect value for field [\\s\\S]standard[\\s\\S], which should be 0 or 1\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 9\\): Select option #3 "yes\\(\\)[\\s\\S]* = Consanguineous parents" not understood\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 9\\): The [\\s\\S]Regular expression pattern[\\s\\S] field does not seem to contain valid PHP Perl compatible regexp syntax\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Columns, line 9\\): Not allowed to create new HGVS standard columns\\. Change the value for [\\s\\S]hgvs[\\s\\S] to 0\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Genes, line 15\\): Gene "ARSE" \\(arylsulfatase E \\(chondrodysplasia punctata 1\\)\\) does not exist in the database\\. Currently, it is not possible to import genes into LOVD using this file format\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Transcripts, line 21\\): Transcript "00002" does not match the same gene and\\/or the same NCBI ID as in the database\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 28\\): Another disease already exists with the same name![\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 28\\): Import file contains OMIM ID for disease Majeed syndrome, while OMIM ID is missing in database\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 29\\): Another disease already exists with this OMIM ID at line 27\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Diseases, line 29\\): Another disease already exists with the same name at line 27\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Genes_To_Diseases, line 37\\): ID "IVD|2" already defined at line 36\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Genes_To_Diseases, line 38\\): Gene "DAAM1" does not exist in the database\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Genes_To_Diseases, line 38\\): Disease "00022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 45\\): Individual "00000022" does not exist in the database and is not defined \\(properly\\) in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 46\\): The [\\s\\S]Panel ID[\\s\\S] can not link to itself; this field is used to indicate to which panel this individual belongs\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 46\\): Panel ID "00000004" refers to an individual, not a panel \\(group of individuals\\)\\. If you want to configure that individual as a panel, set its [\\s\\S]Panel size[\\s\\S] field to a value higher than 1\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 47\\): Panel ID "00000001" refers to an individual, not a panel \\(group of individuals\\)\\. If you want to configure that individual as a panel, set its [\\s\\S]Panel size[\\s\\S] field to a value higher than 1\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 48\\): Panel size of Individual "00000006" must be lower than the panel size of Individual "00000002"\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 49\\): Individual "00000022" does not exist in the database and is not defined \\(properly\\) in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 49\\): Individual "00000022" does not exist in the database and is not defined \\(properly\\) in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 50\\): Individual "00000008" does not exist in the database and is not defined \\(properly\\) in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 50\\): The [\\s\\S]fatherid[\\s\\S] can not link to itself; this field is used to indicate which individual in the database is the parent of the given individual\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 50\\): Individual "00000008" does not exist in the database and is not defined \\(properly\\) in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 50\\): The [\\s\\S]motherid[\\s\\S] can not link to itself; this field is used to indicate which individual in the database is the parent of the given individual\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 51\\): The fatherid "00000002" refers to an panel \\(group of individuals\\), not an individual\\. If you want to configure that panel as an individual, set its [\\s\\S]Panel size[\\s\\S] field to value 1\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 51\\): The motherid "00000002" refers to an panel \\(group of individuals\\), not an individual\\. If you want to configure that panel as an individual, set its [\\s\\S]Panel size[\\s\\S] field to value 1\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 54\\): The fatherid "00000011" you entered does not refer to a male individual\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals, line 54\\): The motherid "00000010" you entered does not refer to a female individual\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals_To_Diseases, line 60\\): ID "1|1" already defined at line 59\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals_To_Diseases, line 61\\): Individual "00000022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Individuals_To_Diseases, line 61\\): Disease "00022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Phenotypes, line 67\\): Disease "00022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Phenotypes, line 68\\): Individual "00000022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings, line 75\\): Individual "00000022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Genes, line 82\\): ID "2|IVD" already defined at line 81\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Genes, line 83\\): Gene "DAAM1" does not exist in the database\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Genes, line 83\\): Screening "0000000022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Genes, line 85\\): ID "2|IVD" already defined at line 81\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Genome, line 90\\): The field \'position_g_start\' must contain a positive integer, "abc" does not match\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 96\\): ID "1|1" already defined at line 95\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 97\\): Genomic Variant "0000000003" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 97\\): The field \'position_c_start\' must contain an integer, "abc" does not match\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 98\\): Transcript "00022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 98\\): Genomic Variant "0000000003" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 98\\): The field \'position_c_start\' must contain an integer, "abc" does not match\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Variants_On_Transcripts, line 98\\): The gene belonging to this variant entry is yet to be inserted into the database\\. First create the gene and set up the custom columns, then import the variants\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Variants, line 105\\): ID "3|1" already defined at line 104\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Variants, line 106\\): Screening "0000000022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*Error \\(Screenings_To_Variants, line 106\\): Genomic Variant "0000000022" does not exist in the database and is not defined in this import file\\.[\\s\\S]*$/', $bodyText));
     $this->assertTrue((bool) preg_match('/Warning: There is already a Individual column with column ID Age_of_death\\. This column is not imported!/', $bodyText));
     $this->assertTrue((bool) preg_match('/Warning \\(Diseases, line 26\\): There is already a disease with disease name Healthy individual \\/ control\\. This disease is not imported!/', $bodyText));
     $this->assertTrue((bool) preg_match('/Warning \\(Diseases, line 27\\): There is already a disease with disease name isovaleric acidemia and\\/or OMIM ID 243500\\. This disease is not imported!/', $bodyText));
     $this->assertTrue((bool) preg_match('/Warning \\(Diseases, line 29\\): There is already a disease with disease name isovaleric acidemia and\\/or OMIM ID 243500\\. This disease is not imported!/', $bodyText));
     $this->assertTrue((bool) preg_match('/Warning \\(Phenotypes, line 68\\): The disease belonging to this phenotype entry is yet to be inserted into the database\\. Perhaps not all this phenotype entry[\\s\\S]s custom columns will be enabled for this disease!/', $bodyText));
 }
コード例 #24
0
 /**
  * Verify an element with a regular expression by tag name.
  * Retry the process two times or until the attempts argument count
  * is reached when an exception is thrown.
  *
  * @param string $tagName  Tag name 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 verifyRegexByTagName($tagName, $regex, $type, $attempts = 2)
 {
     if ($this->isFailed()) {
         return false;
     }
     $by = WebDriverBy::tagName($tagName);
     return $this->_verifyBy($by, $regex, $type, $attempts, true);
 }
コード例 #25
0
 /**
  * Получить спискок VLAN-ов
  */
 public function getVlans()
 {
     $this->driver->switchTo()->defaultContent();
     //Нажимаем ссылку "802.1Q VLAN" в левом фрейме меню
     $leftMenuFrame = $this->driver->findElement(WebDriverBy::name('leftMenu'));
     $this->driver->switchTo()->frame($leftMenuFrame);
     $this->driver->switchTo()->frame('treeConfig');
     $this->driver->findElement(WebDriverBy::cssSelector('a[title="VLAN"]'))->click();
     sleep(1);
     $this->driver->findElement(WebDriverBy::cssSelector('a[title="802.1Q VLAN"]'))->click();
     sleep(1);
     //Возвращаемся на верхний уровень страницы (выходим из фреймов)
     $this->driver->switchTo()->defaultContent();
     //Ждем когда страница прогрузится
     sleep(2);
     //Работаем с фреймом mf0
     $this->driver->switchTo()->frame('mf0');
     //Выбираем строки в таблице
     $vlanTableRows = $this->driver->findElement(WebDriverBy::id('listQVlan'))->findElements(WebDriverBy::tagName('tr'));
     //Первая строка - шапка - она нас не интересует
     array_shift($vlanTableRows);
     $results = [];
     foreach ($vlanTableRows as $vlanTableRow) {
         $tds = $vlanTableRow->findElements(WebDriverBy::tagName('td'));
         $vlanId = $tds[0]->getText();
         //Имя влана лежит в инпуте
         $vlanName = $tds[1]->findElement(WebDriverBy::id('VlanName'))->getAttribute('value');
         $vlanUntagedPorts = $tds[2]->getText();
         $vlanTaggedPorts = $tds[3]->getText();
         //Очищаем строки от знаков переноса
         $vlanUntagedPorts = str_replace("\n", "", $vlanUntagedPorts);
         $vlanTaggedPorts = str_replace("\n", "", $vlanTaggedPorts);
         //Разибваем строку с портами в массив
         $vlanUntagedPorts = explode(",", $vlanUntagedPorts);
         $vlanTaggedPorts = explode(",", $vlanTaggedPorts);
         $results[$vlanId] = ['name' => $vlanName, 'ports' => ['untagged' => $vlanUntagedPorts, 'tagged' => $vlanTaggedPorts]];
     }
     return $results;
 }
コード例 #26
0
try {
    $driver->wait(10, 500)->until(function () use($driver, $token) {
        $element = $driver->findElement(WebDriverBy::name('cars_app_csrf_token'));
        $token = $element->getAttribute("value");
        return trim($token) != "";
    });
    $s++;
} catch (TimeOutException $e) {
    print "[view_car_details:1] Never loaded dynamic token." . PHP_EOL;
    $f++;
}
try {
    $element = $driver->findElement(WebDriverBy::id("passenger_list"));
    $trs = $element->findElements(WebDriverBy::tagName("tr"));
    $tds = $trs[count($trs) - 1]->findElements(WebDriverBy::tagName("td"));
    $element = $tds[0]->findElement(WebDriverBy::tagName("a"));
    $search_text = $element->getText();
    $s++;
} catch (Exception $e) {
    echo $e->getTraceAsString() . PHP_EOL;
    print "[view_car_details:2] Missing car anchor tag." . PHP_EOL;
    $f++;
}
try {
    if (!isset($element)) {
        throw new Exception();
    }
    $element->click();
    $s++;
} catch (Exception $e) {
    print "[view_car_details:3] Cannot click element." . PHP_EOL;
コード例 #27
0
 /**
  * Types values on an element by the given tag name.
  *
  * @param string $tagName  Tag name 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 expectTypeTagName($tagName, $value, $clear = true, $attempts = 2)
 {
     if ($this->isFailed()) {
         return false;
     }
     $by = WebDriverBy::tagName($tagName);
     return $this->expectType($by, $value, $clear, $attempts);
 }
コード例 #28
0
ファイル: install_LOVD.php プロジェクト: LOVDnl/LOVD3
 public function testInstallLOVD()
 {
     // Check if an XDebug session needs to be started, and if so, add the
     // XDebug get parameter.
     // Note: this has to be done once per session. Starting XDebug in
     //       setUp() is not possible as the session may not have
     //       initialized yet. The current method is the common starting
     //       point for most selenium tests.
     global $bXDebugStatus;
     if (XDEBUG_ENABLED && isset($bXDebugStatus) && !$bXDebugStatus) {
         $this->driver->get(ROOT_URL . "/src/install/?XDEBUG_SESSION_START=test");
         $bXDebugStatus = true;
     } else {
         $this->driver->get(ROOT_URL . "/src/install");
     }
     $bodyElement = $this->driver->findElement(WebDriverBy::tagName('body'));
     $this->assertContains("install", $bodyElement->getText());
     // Start installation procedure
     $startButton = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Start >>']"));
     $startButton->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/install\\/[\\s\\S]step=1$/', $this->driver->getCurrentURL()));
     // Fill out form
     $this->enterValue(WebDriverBy::name("name"), "LOVD3 Admin");
     $this->enterValue(WebDriverBy::name("institute"), "Leiden University Medical Center");
     $this->enterValue(WebDriverBy::name("department"), "Human Genetics");
     $this->enterValue(WebDriverBy::name("address"), "Einthovenweg 20\n2333 ZC Leiden");
     $this->enterValue(WebDriverBy::name("email"), "*****@*****.**");
     $this->enterValue(WebDriverBy::name("telephone"), "+31 (0)71 526 9438");
     $this->enterValue(WebDriverBy::name("username"), "admin");
     $this->enterValue(WebDriverBy::name("password_1"), "test1234");
     $this->enterValue(WebDriverBy::name("password_2"), "test1234");
     $countryOption = $this->driver->findElement(WebDriverBy::xpath('//select[@name="countryid"]/option[text()="Netherlands"]'));
     $countryOption->click();
     $this->enterValue(WebDriverBy::name("city"), "Leiden");
     // Click through next steps
     $continueButton = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
     $continueButton->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/install\\/[\\s\\S]step=1&sent=true$/', $this->driver->getCurrentURL()));
     $nextButton = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Next >>']"));
     $this->clickNoTimeout($nextButton);
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/install\\/[\\s\\S]step=2$/', $this->driver->getCurrentURL()));
     $nextButton = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Next >>']"));
     $nextButton->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/install\\/[\\s\\S]step=3$/', $this->driver->getCurrentURL()));
     // Another form
     $this->enterValue(WebDriverBy::name("institute"), "Leiden University Medical Center");
     $this->enterValue(WebDriverBy::name("email_address"), "*****@*****.**");
     $countryOption = $this->driver->findElement(WebDriverBy::xpath('//select[@name="refseq_build"]/option[text()="hg19 / GRCh37"]'));
     $countryOption->click();
     $sendstatsButton = $this->driver->findElement(WebDriverBy::name("send_stats"));
     $sendstatsButton->click();
     $includeButton = $this->driver->findElement(WebDriverBy::name("include_in_listing"));
     $includeButton->click();
     $lockCheckBox = $this->driver->findElement(WebDriverBy::name("lock_uninstall"));
     $lockCheckBox->click();
     $continueButton = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
     $continueButton->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/install\\/[\\s\\S]step=3&sent=true$/', $this->driver->getCurrentURL()));
     $nextButton = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Next >>']"));
     $nextButton->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/install\\/[\\s\\S]step=4$/', $this->driver->getCurrentURL()));
     $button = $this->driver->findElement(WebDriverBy::cssSelector("button"));
     $button->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/setup[\\s\\S]newly_installed$/', $this->driver->getCurrentURL()));
 }