public function testAddScreeningToHealthyIndividual()
 {
     // wait for page redirect
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr[2]/td[2]/b")));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/individual\\/00000001$/', $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]*\\/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();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="genes[]"]/option[text()="IVD (isovaleryl-CoA dehydrogenase)"]'));
     $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());
 }
 public function testAddVariantLocatedWithinGeneToHealthyIndividual()
 {
     // wait for page redirect
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b")));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000001$/', $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=0000000001$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::xpath('//b[contains(., "A variant that is located within a gene")]'));
     //        $element = $this->driver->findElement(WebDriverBy::xpath("//table[2]/tbody/tr/td[2]/b"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//tr[@id='IVD']/td[2]"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/variants[\\s\\S]create&reference=Transcript&geneid=IVD&target=0000000001$/', $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.456T>G");
     $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.
     $firstRNAInput = $this->driver->findElement(WebDriverBy::xpath($firstRNAInputSelector));
     $firstRNAValue = $firstRNAInput->getAttribute('value');
     $this->assertTrue((bool) preg_match('/^r\\.\\([\\s\\S]\\)$/', $firstRNAValue));
     // Check protein description.
     $firstProteinInputSelector = '(//input[contains(@name, "VariantOnTranscript/Protein")])[1]';
     $firstProteinInput = $this->driver->findElement(WebDriverBy::xpath($firstProteinInputSelector));
     $firstProteinValue = $firstProteinInput->getAttribute('value');
     $this->assertRegExp('/^p\\.\\(Tyr152[\\s\\S]*\\)$/', $firstProteinValue);
     $GenomicDNAChange = $this->driver->findElement(WebDriverBy::name('VariantOnGenome/DNA'));
     $this->assertEquals("g.40702987T>G", $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();
     $this->enterValue(WebDriverBy::name("VariantOnGenome/Reference"), "{PMID:Fokkema et al (2011):21520333}");
     $this->enterValue(WebDriverBy::name("VariantOnGenome/Frequency"), "0.05");
     $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->assertEquals("Successfully created the variant entry!", $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText());
 }
 public function testAccessSharingSubmitter()
 {
     $aUserRecords = CreateUsersSubmitterTest::userRecords();
     if (count($aUserRecords) < 2) {
         $this->fail('Cannot run test because CreateUsersSubmitterTest::userRecords() returned
                      too few records.');
     }
     // Example record: array('Test Submitter1', '*****@*****.**', 'testsubmitter1',
     //                       'testsubmitter1')
     list($sSubName1, $sSubEmail1, $sSubUsername1, $sSubPass1) = $aUserRecords[0];
     list($sSubName2, $sSubEmail2, $sSubUsername2, $sSubPass2) = $aUserRecords[1];
     $this->logout();
     $this->login($sSubUsername1, $sSubPass1);
     // Create individual as first submitter.
     $this->driver->get(ROOT_URL . "/src/individuals?create");
     $this->enterValue(WebDriverBy::name("Individual/Lab_ID"), "dummy");
     $createButton = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Create individual information entry']"));
     $createButton->click();
     $this->waitUntil(WebDriverExpectedCondition::titleContains('Submission of'));
     $header = $this->driver->findElement(WebDriverBy::xpath('//h2[@class="LOVD"]'));
     $sIndividualID = substr($header->getText(), -8);
     $this->logout();
     $this->login($sSubUsername2, $sSubPass2);
     // Try (unsuccessfully) to access individual.
     $this->driver->get(ROOT_URL . '/src/individuals/' . $sIndividualID);
     $infoBox = $this->driver->findElement(WebDriverBy::xpath('//table[@class="info"]/tbody/tr/td[@valign="middle"]'));
     $this->assertEquals($infoBox->getText(), 'No such ID!');
     $this->logout();
     $this->login($sSubUsername1, $sSubPass1);
     // Open access sharing page
     $yourAccountLink = $this->driver->findElement(WebDriverBy::xpath('//a/b[text()="Your account"]'));
     $yourAccountLink->click();
     $sMenuSelector = '//img[@id="viewentryOptionsButton_Users"]';
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath($sMenuSelector)));
     $optionsMenu = $this->driver->findElement(WebDriverBy::xpath($sMenuSelector));
     $optionsMenu->click();
     $sMenuItemSelector = '//a[text()="Share access to your entries with other users"]';
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath($sMenuItemSelector)));
     $shareAccessItem = $this->driver->findElement(WebDriverBy::xpath($sMenuItemSelector));
     $shareAccessItem->click();
     // Share access with other submitter.
     $sUserSelector = '//a[text()="' . $sSubName2 . '"]';
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath($sUserSelector)));
     $userRow = $this->driver->findElement(WebDriverBy::xpath($sUserSelector));
     $userRow->click();
     $this->enterValue(WebDriverBy::xpath('//td/input[@type="password"]'), $sSubPass1);
     $saveButton = $this->driver->findElement(WebDriverBy::xpath('//input[@value="Save access permissions"]'));
     $saveButton->click();
     $this->logout();
     $this->login($sSubUsername2, $sSubPass2);
     // Try (successfully) to access individual.
     $this->driver->get(ROOT_URL . '/src/individuals/' . $sIndividualID);
     $header = $this->driver->findElement(WebDriverBy::xpath('//h2[@class="LOVD"]'));
     $this->assertEquals($header->getText(), 'View individual #' . $sIndividualID);
     $nonpubFieldHead = $this->driver->findElement(WebDriverBy::xpath('//table[@class="data"]/tbody/tr[4]/th'));
     $this->assertEquals($nonpubFieldHead->getText(), 'Remarks (non public)');
 }
Example #4
0
 public function login()
 {
     $this->driver->get('https://web.skype.com');
     $this->driver->wait()->until(function () {
         return WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::id('username'));
     });
     $this->driver->findElement(WebDriverBy::id('username'))->sendKeys($this->username);
     $this->driver->findElement(WebDriverBy::id('password'))->sendKeys($this->password);
     $this->driver->findElement(WebDriverBy::cssSelector('form'))->submit();
     $this->waitForSelector('[name=query]');
     sleep(15);
     return true;
 }
 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)"]')));
 }
 public function testConfirmVariantToCMTIndividual()
 {
     // Wait for redirect
     $this->waitUntil(WebDriverExpectedCondition::titleContains("Submission of"));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/screening\\/0000000001$/', $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();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/individual\\/00000001$/', $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]*\\/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()="Single Base Extension"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="Screening/Technique[]"]/option[text()="Single-Strand DNA Conformation polymorphism Analysis (SSCP)"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="Screening/Technique[]"]/option[text()="SSCA, fluorescent (SSCP)"]'));
     $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());
     // Wait for redirect
     $this->waitUntil(WebDriverExpectedCondition::titleContains("Submission of"));
     $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/td[2]/b"));
     $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("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
     $element->click();
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/screenings\\/0000000002[\\s\\S]confirmVariants$/', $this->driver->getCurrentURL()));
     $element = $this->driver->findElement(WebDriverBy::id("check_0000000001"));
     $element->click();
     $this->enterValue(WebDriverBy::xpath("//td/input[@type='password']"), "test1234");
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Save variant list']"));
     $element->click();
     $confirmElementSelector = WebDriverBy::xpath('//td[text()="Successfully confirmed the variant entry!"]');
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated($confirmElementSelector));
 }
 public function testAddPhenotypeInfoToHealthyIndividual()
 {
     // wait for page redirect
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b")));
     $this->assertTrue((bool) preg_match('/^[\\s\\S]*\\/src\\/submit\\/individual\\/00000001$/', $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\\/phenotypes[\\s\\S]create&target=00000001$/', $this->driver->getCurrentURL()));
     //        $this->selectWindow("null");
     $this->enterValue(WebDriverBy::name("Phenotype/Age"), "35y");
     $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 phenotype information entry']"));
     $element->click();
     $this->assertEquals("Successfully created the phenotype entry!", $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText());
 }
Example #8
0
 public function testCreateGeneIVD()
 {
     $this->driver->get(ROOT_URL . "/src/genes?create");
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::name("hgnc_id")));
     $this->enterValue(WebDriverBy::name("hgnc_id"), "IVD");
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Continue »']"));
     $element->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="active_transcripts[]"]/option[text()="transcript variant 1 (NM_002225.3)"]'));
     $option->click();
     $element = $this->driver->findElement(WebDriverBy::name("show_hgmd"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::name("show_genecards"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::name("show_genetests"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Create gene information entry']"));
     $element->click();
     $this->assertEquals("Successfully created the gene information entry!", $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText());
 }
Example #9
0
 /**
  * Waits up to $timeout seconds for an element to appear on the page.
  * If the element doesn't appear, a timeout exception is thrown.
  *
  * ``` php
  * <?php
  * $I->waitForElement('#agree_button', 30); // secs
  * $I->click('#agree_button');
  * ?>
  * ```
  *
  * @param $element
  * @param int $timeout seconds
  * @throws \Exception
  */
 public function waitForElement($element, $timeout = 10)
 {
     $condition = WebDriverExpectedCondition::presenceOfElementLocated($this->getLocator($element));
     $this->webDriver->wait($timeout)->until($condition);
 }
 public function testAddSummaryVariantLocatedWithinGene()
 {
     $element = $this->driver->findElement(WebDriverBy::id("tab_submit"));
     $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();
     $element = $this->driver->findElement(WebDriverBy::xpath("//div/table/tbody/tr/td/table/tbody/tr/td[2]/b"));
     $element->click();
     $element = $this->driver->findElement(WebDriverBy::cssSelector("#ARSD > td.ordered"));
     $element->click();
     $this->assertContains("src/variants?create&reference=Transcript&geneid=ARSD", $this->driver->getCurrentURL());
     for ($second = 0;; $second++) {
         if ($second >= 60) {
             $this->fail("timeout");
         }
         try {
             if ($this->isElementPresent(WebDriverBy::name("ignore_00000002"))) {
                 break;
             }
         } catch (Exception $e) {
         }
         sleep(1);
     }
     $this->uncheck(WebDriverBy::name("ignore_00000003"));
     $this->enterValue(WebDriverBy::name("00000002_VariantOnTranscript/Exon"), "3");
     $this->enterValue(WebDriverBy::name("00000002_VariantOnTranscript/DNA"), "c.62T>A");
     $element = $this->driver->findElement(WebDriverBy::cssSelector("button.mapVariant"));
     $element->click();
     // Wait until the first two RNA-change input fields contain data.
     $firstRNAInputSelector = '(//input[contains(@name, "VariantOnTranscript/RNA")])[1]';
     $secondRNAInputSelector = '(//input[contains(@name, "VariantOnTranscript/RNA")])[2]';
     $this->waitUntil(function ($driver) use($firstRNAInputSelector, $secondRNAInputSelector) {
         $firstRNAInput = $driver->findElement(WebDriverBy::xpath($firstRNAInputSelector));
         $firstRNAValue = $firstRNAInput->getAttribute('value');
         $secondRNAInput = $driver->findElement(WebDriverBy::xpath($secondRNAInputSelector));
         $secondRNAValue = $secondRNAInput->getAttribute('value');
         return !empty($firstRNAValue) && !empty($secondRNAValue);
     });
     // 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.(Leu21Gln)", $firstProteinValue);
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="00000002_effect_reported"]/option[text()="Probably affects function"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="00000002_effect_concluded"]/option[text()="Probably does not affect function"]'));
     $option->click();
     $this->enterValue(WebDriverBy::name("00000003_VariantOnTranscript/Exon"), "3");
     $this->enterValue(WebDriverBy::name("00000004_VariantOnTranscript/Exon"), "3");
     $this->enterValue(WebDriverBy::name("00000005_VariantOnTranscript/Exon"), "3");
     // Check DNA description for first transcript.
     $firstDNAInputSelector = '(//input[contains(@name, "VariantOnTranscript/DNA")])[1]';
     $firstDNAInput = $this->driver->findElement(WebDriverBy::xpath($firstDNAInputSelector));
     $firstDNAValue = $firstDNAInput->getAttribute('value');
     $this->assertEquals("c.62T>A", $firstDNAValue);
     // Check RNA description for second transcript.
     $secondRNAInput = $this->driver->findElement(WebDriverBy::xpath($secondRNAInputSelector));
     $secondRNAValue = $secondRNAInput->getAttribute('value');
     $this->assertTrue((bool) preg_match('/^r\\.\\([\\s\\S]\\)$/', $secondRNAValue));
     // Check protein description for second transcript.
     $secondProteinInputSelector = '(//input[contains(@name, "VariantOnTranscript/Protein")])[2]';
     $secondProteinInput = $this->driver->findElement(WebDriverBy::xpath($secondProteinInputSelector));
     $secondProteinValue = $secondProteinInput->getAttribute('value');
     $this->assertEquals("p.(Leu21Gln)", $secondProteinValue);
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="00000003_effect_reported"]/option[text()="Probably affects function"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="00000003_effect_concluded"]/option[text()="Probably does not affect function"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="allele"]/option[text()="Maternal (confirmed)"]'));
     $option->click();
     $GenomicDNAChange = $this->driver->findElement(WebDriverBy::name('VariantOnGenome/DNA'));
     $this->assertEquals("g.2843789A>T", $GenomicDNAChange->getAttribute('value'));
     $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"), "55/18000");
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="effect_reported"]/option[text()="Affects function"]'));
     $option->click();
     $option = $this->driver->findElement(WebDriverBy::xpath('//select[@name="effect_concluded"]/option[text()="Affects function"]'));
     $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->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::cssSelector("table[class=info]")));
     $this->assertContains("Successfully processed your submission and sent an email notification to the relevant curator", $this->driver->findElement(WebDriverBy::cssSelector("table[class=info]"))->getText());
 }
Example #11
0
 public function testFindReplace()
 {
     // Upload variant data.
     $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");
     $uploadButton = $this->driver->findElement(WebDriverBy::xpath("//input[@value='Upload VCF file']"));
     $uploadButton->click();
     // Go to variant overview
     $this->driver->get(ROOT_URL . '/src/variants');
     // Open find and replace for Reference col.
     $this->openFRMenuForCol(6);
     // Click cancel button.
     sleep(1);
     $cancelButton = $this->driver->findElement(WebDriverBy::id('FRCancel_VOG'));
     $cancelButton->click();
     // Check if cancel button is hidden together with FR options menu by javascript.
     $this->waitUntil(WebDriverExpectedCondition::invisibilityOfElementLocated(WebDriverBy::id('FRCancel_VOG')));
     // Open find and replace for Reference col.
     $this->openFRMenuForCol(6);
     $columnReference = $this->driver->findElement(WebDriverBy::id('viewlistFRColDisplay_VOG'));
     $this->assertEquals($columnReference->getText(), 'Reference');
     $this->enterValue(WebDriverBy::name('FRReplace_VOG'), 'newvalue');
     $previewButton = $this->driver->findElement(WebDriverBy::id('FRPreview_VOG'));
     $previewButton->click();
     // Click on header to close tooltip.
     $previewTooltip = $this->driver->findElement(WebDriverBy::xpath('//div[@class="ui-tooltip-content" and contains(., "Preview changes")]'));
     $mainHeader = $this->driver->findElement(WebDriverBy::xpath('//h2[contains(., "LOVD")]'));
     $mainHeader->click();
     // Check if tooltip is closed.
     $this->waitUntil(WebDriverExpectedCondition::stalenessOf($previewTooltip));
     $this->assertContains($this->driver->findElement(WebDriverBy::xpath('//th[@data-fieldname="VariantOnGenome/Reference_FR"]'))->getText(), 'Reference (PREVIEW)');
     $aNewValueElements = $this->driver->findElements(WebDriverBy::xpath('//td[text()="newvalue"]'));
     $this->assertEquals(count($aNewValueElements), 25);
     $this->enterValue(WebDriverBy::xpath('//input[@type="password"]'), 'test1234');
     $submitButton = $this->driver->findElement(WebDriverBy::id('FRSubmit_VOG'));
     $submitButton->click();
     $this->chooseOkOnNextConfirmation();
     // Wait for refresh of viewlist with string "newvalue" in 6th column (Reference).
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath('//table[@id="viewlistTable_VOG"]/tbody/tr/td[position()=6 and text()="newvalue"]')));
     // Open find & replace menu for field "DNA change (genomic) (hg19)"
     $this->openFRMenuForCol(5);
     // Set search field to 'C' and preview.
     $this->enterValue(WebDriverBy::name('FRSearch_VOG'), 'C');
     $previewButton = $this->driver->findElement(WebDriverBy::id('FRPreview_VOG'));
     $previewButton->click();
     // Click on tooltip to close it
     $previewTooltip = $this->driver->findElement(WebDriverBy::xpath('//div[@class="ui-tooltip-content" and text()="Preview changes (14 rows affected)"]'));
     $previewTooltip->click();
     // Filter on 'Variant ID' > 10 during preview.
     $sSearchIDSelector = WebDriverBy::name('search_id_');
     $this->enterValue($sSearchIDSelector, '>10');
     $searchIDElement = $this->driver->findElement($sSearchIDSelector);
     // Use json_decode to send enter key to browser.
     $searchIDElement->sendKeys(json_decode('"\\uE007"'));
     // Check that viewlist is refreshed. (id='0000000004' should be filtered)
     $this->waitUntil(function ($driver) {
         $vlTable = $driver->findElement(WebDriverBy::id('viewlistTable_VOG'));
         // Avoid checking text exactly during refresh.
         try {
             $sTableText = $vlTable->getText();
         } catch (StaleElementReferenceException $e) {
             // try again next poll
             return false;
         }
         return strpos($sTableText, '0000000004') === false;
     });
     // Submit find & replace
     $this->enterValue(WebDriverBy::xpath('//input[@type="password"]'), 'test1234');
     $submitButton = $this->driver->findElement(WebDriverBy::id('FRSubmit_VOG'));
     $submitButton->click();
     // Check that filter has effect (otherwise 14 records are modified).
     $alertText = $this->driver->switchTo()->alert()->getText();
     $this->assertContains('You are about to modify 9 records', $alertText);
     $this->chooseOkOnNextConfirmation();
     // Wait until viewlist is refreshed.
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath('//td[@valign="middle" and contains(., "Find & Replace applied to column")]')));
     // Open find and replace for Reference col.
     $this->openFRMenuForCol(6);
     $matchBeginningRadio = $this->driver->findElement(WebDriverBy::xpath('//input[@name="FRMatchType_VOG" and @value="2"]'));
     $matchBeginningRadio->click();
     $this->enterValue(WebDriverBy::name('FRReplace_VOG'), 'prefix');
     // Find empty string at beginning of field and insert prefix string.
     $previewButton = $this->driver->findElement(WebDriverBy::id('FRPreview_VOG'));
     $previewButton->click();
     // Click on tooltip to close it
     $previewTooltip = $this->driver->findElement(WebDriverBy::xpath('//div[@class="ui-tooltip-content" and text()="Preview changes (15 rows affected)"]'));
     $previewTooltip->click();
     $this->enterValue(WebDriverBy::xpath('//input[@type="password"]'), 'test1234');
     $submitButton = $this->driver->findElement(WebDriverBy::id('FRSubmit_VOG'));
     $submitButton->click();
     $this->chooseOkOnNextConfirmation();
     $this->waitUntil(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::xpath('//td[text()="prefixnewvalue"]')));
 }
Example #12
0
 /**
  * Получить список организаций в категории
  * @param string $cityHref Ссылка на страницу города
  * @param string $rubricName Название рубрики
  * @param string $rubricId Id рубрики
  * @return array
  */
 public function getOrganisationsByRubric($cityHref, $rubricName, $rubricId)
 {
     $rubricName = urlencode($rubricName);
     $this->driver->get("{$cityHref}/search/{$rubricName}/rubricId/{$rubricId}");
     $results = [];
     //Особенность 2гис - элементы рендерят вначале несколько раз, ждем пока не зарендерятся
     sleep(1);
     $organisationList = $this->driver->findElements(WebDriverBy::className('mixedResults'));
     if (isset($organisationList[0])) {
         $organisations = $organisationList[0]->findElements(WebDriverBy::className('miniCard'));
         foreach ($organisations as $organisation) {
             $organisation->click();
             //Ждем появления карточки организации
             $this->driver->wait(5, 500)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::className('firmCard')));
             $firmCard = $this->driver->findElements(WebDriverBy::className('firmCard'));
             if (isset($firmCard[0])) {
                 $results[] = $this->extractDataFromFirmCard($firmCard[0]);
             }
         }
     } else {
         //Если списка организаций нет - проверяем наличие карточки организации
         $firmCard = $this->driver->findElements(WebDriverBy::className('firmCard'));
         if (isset($firmCard[0])) {
             $results[] = $this->extractDataFromFirmCard($firmCard[0]);
         }
     }
     return $results;
 }
    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;
    $f++;
}
try {
    $driver->wait(10, 500)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::className("jumbotron")));
    $s++;
} catch (Exception $e) {
    print "[view_car_details:4] Never loaded page with jumbotron." . PHP_EOL;
    $f++;
}
try {
    $elements = $driver->findElements(WebDriverBy::cssSelector(".jumbotron label"));
    $text = trim($elements[0]->getText());
    if (strpos($text, "Number of Passengers:") == -1) {
        throw new Exception();
    }
    $s++;
} catch (Exception $e) {
    print "[view_car_details:5] Passenger text missing." . PHP_EOL;
    $f++;
Example #14
0
 /**
  * @param string   $locator
  * @param int|null $timeout
  */
 public function waitForElement($locator, $timeout = null)
 {
     $this->_waitUntil(WebDriverExpectedCondition::presenceOfElementLocated($this->_getLocator($locator)), $timeout);
 }
Example #15
0
function login($driver)
{
    print 'Logging in to WordPress... ';
    try {
        $driver->get(wordpress('/wp-login.php'));
        usleep(250000);
        $driver->findElement(WebDriverBy::id('user_login'))->sendKeys('admin');
        $driver->findElement(WebDriverBy::id('user_pass'))->sendKeys('admin');
        $driver->findElement(WebDriverBy::id('loginform'))->submit();
        $driver->wait(2)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::cssSelector('div.wrap h1, div.wrap h2')));
    } catch (Exception $e) {
        var_dump($driver->getPageSource());
        print $e;
        throw new UnexpectedValueException('Login failed.');
    }
}