/**
  * Tests that, when loading the User accounts module > edit_user submodule, some
  * text appears in the body.
  *
  * @return void
  */
 function testUserAccountsEditUserDoespageLoad()
 {
     $this->webDriver->get($this->url . "?test_name=user_accounts&subtest=edit_user");
     $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText();
     $this->assertContains("Edit User", $bodyText);
     $this->assertEquals("password", $this->webDriver->findElement(WebDriverBy::Name("Password_md5"))->getAttribute("type"));
     $this->assertEquals("checkbox", $this->webDriver->findElement(WebDriverBy::Name("NA_Password"))->getAttribute("type"));
     $this->assertEquals("password", $this->webDriver->findElement(WebDriverBy::Name("__Confirm"))->getAttribute("type"));
 }
Beispiel #2
0
 function testLoginSuccess()
 {
     $this->webDriver->get($this->url . '/main.php?logout=true');
     $username = $this->webDriver->findElement(WebDriverBy::Name("username"));
     $this->assertEquals('', $username->getAttribute("value"));
     $password = $this->webDriver->findElement(WebDriverBy::Name("password"));
     $this->assertEquals('', $password->getAttribute("value"));
     $login = $this->webDriver->findElement(WebDriverBy::Name("login"));
     $this->assertEquals('submit', $login->getAttribute("type"));
     $this->assertEquals('Login', $login->getAttribute("value"));
     $username->sendKeys("UnitTester");
     $password->sendKeys("4test4");
     $login->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText();
     $this->assertContains("Welcome", $bodyText);
 }
 /**
  * Tests that with useEDC turned off, edc related fields do not appear
  * on the page.
  *
  * @return none
  */
 function testNewProfileLoadsWithoutEDC()
 {
     $this->setUpConfigSetting("useEDC", "false");
     $this->webDriver->get($this->url . "?test_name=new_profile");
     try {
         $edc1 = $this->webDriver->findElement(WebDriverBy::Name("edc1"));
     } catch (NoSuchElementException $e) {
         $edc1 = null;
     }
     $this->assertNull($edc1);
     try {
         $edc2 = $this->webDriver->findElement(WebDriverBy::Name("edc2"));
     } catch (NoSuchElementException $e) {
         $edc2 = null;
     }
     $this->assertNull($edc2);
     $this->restoreConfigSetting("useEDC");
 }
Beispiel #4
0
 function testDataDictSearchKeywordFilters()
 {
     $this->webDriver->get($this->url . "/datadict/");
     $this->webDriver->wait(120, 1000)->until(WebDriverExpectedCondition::presenceOfElementLocated(WebDriverBy::Name("keyword")));
     $searchKey = $this->webDriver->findElements(WebDriverBy::Name("keyword"));
     switch (count($searchKey)) {
         case 1:
             break;
         case 0:
             $this->fail("Could not find search keyword field");
             return;
         default:
             $this->fail("Too many search keyword fields.");
             return;
     }
     $searchKey[0]->sendKeys("NotRealMAGICNUMBER335");
     $searchButton = $this->webDriver->findElement(WebDriverBy::Name("filter"));
     $searchButton->click();
     $this->markTestSkipped("Data Dict test not yet updated for React");
     /*
     		try {
        while (true) {
            $oldBody->isDisplayed();
             }
     		} catch(Exception $e) {
     			$this->webDriver->executescript("document.documentElement.outerHTML");
     
     		}
     */
     $rows = $this->webDriver->findElements(WebDriverBy::cssSelector("table tbody tr"));
     $this->assertTrue(count($rows) == 1, "Incorrect number of rows returned when filtering for keyword on datadict" . print_r($rows, true));
     $cols = $this->webDriver->findElements(WebDriverBy::cssSelector("table tbody tr td"));
     // Rownumber
     $this->assertEquals($cols[0]->getText(), "1");
     // SourceFrom
     $this->assertEquals($cols[1]->getText(), "nowhere");
     // Name
     $this->assertEquals($cols[2]->getText(), "TestParameterNotRealMAGICNUMBER335");
     // SourceField
     $this->assertEquals($cols[3]->getText(), "imaginary");
     // Description
     $this->assertEquals($cols[4]->getText(), "I am a fake description used only for testing you should not see me. MAGICNUMBER335");
 }
Beispiel #5
0
 /**
  * Performs a candidate search using the specified criteria and verifies
  * the candidates obtained.
  *
  * @param array  $criteria        criteria for the search.
  * @param string $expectedResults the candidates that should be returned.
  *
  * @return void.
  */
 private function _assertSearchBy(array $criteria, $expectedResults)
 {
     foreach ($criteria as $elementName => $elementValue) {
         $element = $this->webDriver->findElement(WebDriverBy::Name($elementName));
         switch ($element->getTagName()) {
             case 'input':
                 $element->clear();
                 $element->sendKeys($elementValue);
                 break;
             case 'select':
                 $selectElement = new WebDriverSelect($element);
                 $selectElement->selectByVisibleText($elementValue);
                 break;
             default:
                 throw Exception('Element type ' . $element->getTagName() . ' not supported');
         }
     }
     $showDataButton = $this->webDriver->findElement(WebDriverBy::Id("showdata_advanced_options"));
     $showDataButton->click();
     $this->_assertCandidateTableContents('datatable', $expectedResults);
 }
 /**
  * Tests that, upload function in document_repository module
  *
  * @return void
  */
 function testDocumentRepositoryUploadFileEditDeleteComment()
 {
     $this->markTestSkipped("This method isn't working properly on travis.");
     $this->safeGet($this->url . "/document_repository/");
     $this->safeFindElement(WebDriverBy::Xpath("//*[@id='TESTTESTTESTTESTa']/td/span"))->click();
     $this->safeFindElement(WebDriverBy::Id("9999999"))->click();
     // modify comment,search it and check it
     $select = $this->safeFindElement(WebDriverBy::Id("categoryEdit"));
     $element = new WebDriverSelect($select);
     $element->selectByVisibleText("TESTTESTTESTTEST");
     $site = $this->safeFindElement(WebDriverBy::Id("siteEdit"));
     $elementSite = new WebDriverSelect($site);
     $elementSite->selectByVisibleText("Any");
     $this->safeFindElement(WebDriverBy::Id("commentsEdit"))->sendKeys("This is a test comment!");
     $this->safeFindElement(WebDriverBy::Id("postEdit"))->click();
     sleep(5);
     $this->safeFindElement(WebDriverBy::Name("File_name"))->sendKeys("README.md");
     $this->safeFindElement(WebDriverBy::Name("filter"))->click();
     $text = $this->safeFindElement(WebDriverBy::cssSelector("#dir-tree > tr"), 3000)->getText();
     $this->assertContains("This is a test comment!", $text);
     // delete upload file
     $this->safeFindElement(WebDriverBy::linkText("Delete"), 3000)->click();
     $this->safeFindElement(WebDriverBy::Id("postDelete"))->click();
     $this->safeFindElement(WebDriverBy::Name("File_name"))->sendKeys("README.md");
     $this->safeFindElement(WebDriverBy::Name("filter"))->click();
     sleep(5);
     $text = $this->safeFindElement(WebDriverBy::cssSelector("tbody"), 3000)->getText();
     $this->assertEquals('', $text);
 }
Beispiel #7
0
 /**
  * Tests that, SNP 'Show brief fields' filter works.
  *
  * Note: the brief fields option should have been tested in
  * testGenomicBrowserSNPDataSortableBrief
  *
  * @-depends testGenomicBrowserSNPDatatable
  *
  * @return void
  */
 function testGenomicBrowserSNPShowBriefFields()
 {
     $this->markTestIncomplete('Test should be updated for new main genomic browser tab.');
     $expected_headers = array('No.', 'PSC', 'DCCID', 'PSCID', 'Gender', 'Subproject', 'DoB', 'ExternalID', 'Chromosome', 'Strand', 'StartLoc', 'EndLoc', 'Size', 'Gene Symbol', 'Gene Name', 'Platform', 'RsID', 'SNP Name', 'SNP Description', 'External Source', 'Observed Base', 'Reference Base', 'Array Report', 'Markers', 'Validation Method', 'Validated', 'Function Prediction', 'Damaging', 'Genotype Quality', 'Exonic Function');
     $this->safeGet($this->url . "/genomic_browser/?submendu=snp_browser");
     // Apply filter
     $this->webDriver->findElement(WebDriverBy::Name('Show_Brief_Results'))->sendKeys("All fields");
     $button = $this->webDriver->findElement(WebDriverBy::xPath("\n                //input[@name='filter']\n            "));
     $this->clickToLoadNewPage($button);
     // Check column count
     $this->safeGet($this->url . "/genomic_browser/?submenu=snp_browser");
     $headers = $this->webDriver->findElements(WebDriverBy::xPath("\n                //div[@id='lorisworkspace']\n                //table[contains(@class, 'dynamictable')]\n                /thead\n                /tr\n                /th\n            "));
     $this->assertCount(count($expected_headers), $headers, "There should be " . count($expected_headers) . " columns in the table.");
 }
Beispiel #8
0
 function testNewProfilePSCIDSequential()
 {
     $this->changeStudySite();
     $this->webDriver->get($this->url . "/new_profile/");
     $dates = $this->webDriver->findElements(WebDriverBy::cssSelector(".input-date"));
     $dates[0]->sendKeys("01/01/2015");
     $dates[1]->sendKeys("01/01/2015");
     $gender = $this->webDriver->findElement(WebDriverBy::Name("gender"));
     $gender->sendKeys("Male");
     $startVisit = $this->webDriver->findElement(WebDriverBy::Name("fire_away"));
     $startVisit->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText();
     $this->assertContains("PSCID: BBQ0000", $bodyText);
     $this->webDriver->get($this->url . "/new_profile/");
     $dates = $this->webDriver->findElements(WebDriverBy::cssSelector(".input-date"));
     $dates[0]->sendKeys("01/01/2015");
     $dates[1]->sendKeys("01/01/2015");
     $gender = $this->webDriver->findElement(WebDriverBy::Name("gender"));
     $gender->sendKeys("Male");
     $startVisit = $this->webDriver->findElement(WebDriverBy::Name("fire_away"));
     $startVisit->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText();
     $this->assertContains("PSCID: BBQ0001", $bodyText);
     $this->deleteCandidate("BBQ0000");
     $this->deleteCandidate("BBQ0001");
     $this->resetStudySite();
 }
Beispiel #9
0
 /**
  * Performs a candidate search using the specified criteria and verifies
  * the candidates obtained.
  *
  * @param array  $criteria        criteria for the search.
  * @param string $expectedResults the candidates that should be returned.
  *
  * @return void.
  */
 private function _assertSearchBy(array $criteria, $expectedResults)
 {
     foreach ($criteria as $elementName => $elementValue) {
         $element = $this->safeFindElement(WebDriverBy::Name($elementName));
         $element->clear();
         $element->sendKeys($elementValue);
     }
     $this->safeClick(WebDriverBy::Name("filter"));
     $this->_assertUserTableContents('dynamictable', $expectedResults);
 }
Beispiel #10
0
 /**
  * Tests that, input some data and click search button, check the results.
  *
  * @return void
  */
 function testSurveyAccountsSearchButton()
 {
     //testing search by PSCID
     $this->safeGet($this->url . "/survey_accounts/");
     $this->webDriver->findElement(WebDriverBy::Name("PSCID"))->sendKeys("8888");
     $this->webDriver->findElement(WebDriverBy::Name("filter"))->click();
     sleep(5);
     $this->webDriver->findElement(WebDriverBy::Name("PSCID"))->clear();
     $bodyText = $this->webDriver->getPageSource();
     $this->assertContains("8888", $bodyText);
     //testing search by Email
     $this->safeGet($this->url . "/survey_accounts/");
     $this->webDriver->findElement(WebDriverBy::Name("Email"))->sendKeys("*****@*****.**");
     $this->webDriver->findElement(WebDriverBy::Name("filter"))->click();
     sleep(5);
     $this->webDriver->findElement(WebDriverBy::Name("Email"))->clear();
     $bodyText = $this->webDriver->getPageSource();
     $this->assertContains("*****@*****.**", $bodyText);
 }
Beispiel #11
0
 /**
  * Link to visit level comments editable with proper permissions
  *
  * @return void
  */
 function testImageCommentsWindowEditable()
 {
     $this->markTestSkipped('React components can not be tested');
     // Setting permissions to view all sites to view all datasets
     $this->setupPermissions(array('imaging_browser_view_allsites', 'imaging_browser_qc'));
     $this->safeGet($this->url . "/imaging_browser/");
     $NativeLink = $this->webDriver->findElement(WebDriverBy::xPath('//*[@id="lorisworkspace"]/div[2]/div/div/table/tbody/tr/td[12]/a'));
     $this->clickToLoadNewPage($NativeLink);
     $ImageQCFeedback = $this->webDriver->findElement(WebDriverBy::cssSelector(".mri-second-row-panel > a:nth-child(1) > " . "span:nth-child(1) > span:nth-child(2)"));
     $handleList = $this->webDriver->getWindowHandles();
     $ImageQCFeedback->click();
     $newHandleList = $this->webDriver->getWindowHandles();
     $diff = array_diff($newHandleList, $handleList);
     $this->assertCount(1, $diff);
     $this->webDriver->switchTo()->window($diff[1]);
     // First clear the field then send the comments/text
     $this->webDriver->findElement(WebDriverBy::Name("savecomments[text][1]"))->clear();
     $this->webDriver->findElement(WebDriverBy::Name("savecomments[text][1]"))->sendKeys("Testing comment field within Geometric Intensity");
     $SaveButton = $this->webDriver->findElement(WebDriverBy::Name("fire_away"));
     $SaveButton->click();
     $GeometricDistortionText = $this->webDriver->findElement(WebDriverBy::Name("savecomments[text][1]"))->getText();
     $this->assertEquals("Testing comment field within Geometric Intensity", $GeometricDistortionText);
     $this->webDriver->switchTo()->window($diff[1])->close();
 }
Beispiel #12
0
 /**
  * Tests that,in the not resolved menu, change the Resolution status of the first row.
  * Save it and check it. 
  *
  * @return void
  */
 function testNotResolvedSaveButton()
 {
     $this->safeGet($this->url . "/mri_violations/");
     $resolutionElement = $this->safeFindElement(WebDriverBy::Name("resolvable[c57b919a921eaa1a43bb5e0c44cd4226]"));
     $resolution = new WebDriverSelect($resolutionElement);
     $resolution->selectByVisibleText("Inserted");
     $this->safeClick(WebDriverBy::Name("fire_away"));
     $resolutionElement = $this->safeFindElement(WebDriverBy::Name("resolvable[c57b919a921eaa1a43bb5e0c44cd4226]"));
     $resolution = new WebDriverSelect($resolutionElement);
     $value = $resolution->getFirstSelectedOption()->getAttribute('value');
     $this->assertEquals("inserted", $value);
 }
Beispiel #13
0
 /**
  * Tests that page returns success when inputed correctly
  *
  * @return void
  */
 function testNextStageSuccess()
 {
     $this->webDriver->get($this->url . "/next_stage/?candID=900000&sessionID=999999&identifier=999999");
     $dates = $this->webDriver->findElements(WebDriverBy::cssSelector(".input-date"));
     $dates[0]->sendKeys("2015-01-01");
     $dates[1]->sendKeys("2015-01-01");
     $scanDone = $this->webDriver->findElement(WebDriverBy::Name("scan_done"));
     $scanDone->sendKeys("No");
     $Subproject = $this->webDriver->findElement(WebDriverBy::Name("SubprojectID"));
     $Subproject->sendKeys("Control");
     $startVisit = $this->webDriver->findElement(WebDriverBy::Name("fire_away"));
     $startVisit->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::cssSelector("body"))->getText();
     $this->assertContains("Next stage started.", $bodyText);
 }
Beispiel #14
0
 /**
  * Tests Clear Form function in resolved conflicts
  * author: Wang Shen
  *
  * @return void
  */
 function testClearFormResolvedConflicts()
 {
     $this->safeGet($this->url . "/conflict_resolver/?submenu=resolved_conflicts");
     $keywordElement = $this->webDriver->findElement(WebDriverBy::Name("Question"));
     $keywordElement->sendkeys('TestTestTest');
     //click clear form button
     $this->webDriver->findElement(WebDriverBy::ID("testClearForm1"))->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::Name("Question"))->getText();
     $this->assertNotContains("TestTestTest", $bodyText);
 }
Beispiel #15
0
 /**
  * Tests that filter with the date of birth
  *
  * @return void
  */
 function testdicomArchiveFileterByDateOfBirth()
 {
     $this->markTestSkipped("This method isn't working properly on travis.");
     //testing the Patient's date of birth
     $this->safeGet($this->url . "/dicom_archive/");
     $DoBElement = $this->safeFindElement(WebDriverBy::Name("DoB"));
     $DoBElement->sendKeys("1900-01-01");
     $this->safeClick(WebDriverBy::Name("filter"));
     $DoB = $this->safeFindElement(WebDriverBy::cssSelector("tbody"))->getText();
     $this->assertContains('1900-01-01', $DoB);
 }
Beispiel #16
0
 /**
  * Tests that Add examiner section, insert an Examiner and find it.
  *
  * @return void
  */
 function testExaminerAddExaminer()
 {
     //insert a new exmainer with name "Test_Examiner" and radiologist
     //in the TEST_Site.
     $this->safeGet($this->url . "/examiner/");
     $this->safeFindElement(WebDriverBy::Name("addName"))->sendKeys("Test_Examiner");
     $this->safeFindElement(WebDriverBy::Name("addRadiologist"))->click();
     $select = $this->safeFindElement(WebDriverBy::Name("addSite"));
     $element = new WebDriverSelect($select);
     $element->selectByVisibleText("TEST_Site");
     $bodyText = $this->safeFindElement(WebDriverBy::Name("fire_away"))->click();
     sleep(5);
     //search the examiner which inserted
     $this->webDriver->findElement(WebDriverBy::Name("examiner"))->sendKeys("Test_Examiner");
     $this->webDriver->findElement(WebDriverBy::Name("filter"))->click();
     $bodyText = $this->safeFindElement(WebDriverBy::cssSelector("body"))->getText();
     $this->assertContains("Test_Examiner", $bodyText);
 }
Beispiel #17
0
 /**
  * Tests that, create a timepoint and input a empty subproject
  * get Error message
  *
  * @return void
  */
 function testCreateTimepointErrorEmptySubproject()
 {
     $this->safeGet($this->url . "/create_timepoint/?candID=900000&identifier=900000");
     $this->webDriver->findElement(WebDriverBy::Name("fire_away"))->click();
     $bodyText = $this->webDriver->getPageSource();
     $this->assertContains("A visit label is required for creating a timepoint.", $bodyText);
 }
Beispiel #18
0
 /**
  * Tests that, input some data and click click clear button, check the results.
  * The form should refreash and the data should be gone.
  * @return void
  */
 function testReliabilityClearFormButton()
 {
     //testing search by PSCID
     $this->safeGet($this->url . "/reliability/");
     $this->webDriver->findElement(WebDriverBy::Name("PSCID"))->sendKeys("8888");
     $this->webDriver->findElement(WebDriverBy::Name("reset"))->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::Name("PSCID"))->getText();
     $this->assertEquals("", $bodyText);
     //testing search by DCCID
     $this->safeGet($this->url . "/reliability/");
     $this->webDriver->findElement(WebDriverBy::Name("DCCID"))->sendKeys("8888");
     $this->webDriver->findElement(WebDriverBy::Name("reset"))->click();
     $bodyText = $this->webDriver->findElement(WebDriverBy::Name("PSCID"))->getText();
     $this->assertEquals("", $bodyText);
     //testing search by Gender
     $this->safeGet($this->url . "/reliability/");
     $genderElement = $this->safeFindElement(WebDriverBy::Name("Gender"));
     $gender = new WebDriverSelect($genderElement);
     $gender->selectByVisibleText("Male");
     $this->webDriver->findElement(WebDriverBy::Name("reset"))->click();
     $genderElement = $this->safeFindElement(WebDriverBy::Name("Gender"));
     $gender = new WebDriverSelect($genderElement);
     $value = $gender->getFirstSelectedOption()->getAttribute('value');
     $this->assertEquals("", $value);
 }